Vscode API - provideTextDocument not executing more then once
VS Code will reuse the provided content as long as the document is open. Switching away from a document closes its editor but does close the document itself. If you fully close the document (in all tabs), you should see the provider invoked when you open a new document.
If you wish to update an existing document's content, implement the onDidChange
event on TextDocumentContentProvider
and use it to signal that VS Code should call provideTextDocumentContent
As @Matt Bierner said:
"If you wish to update an existing document's content, implement the onDidChange event on TextDocumentContentProvider and use it to signal that VS Code should call provideTextDocumentContent"
My problem was that I had to fire() _onDidChange
with an uri.
I ended up adding this line to my getTreeItem
method:
this._onDidChange.fire(element.resource);
now each item is freshly downloaded on opening.