Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 97313

Detect when document is closed

$
0
0

I'm working on Visual Studio Code extension and I need to detect when some document window is closed. I know about vscode.workspace.onDidCloseTextDocument event and it works at general.

But if I open a file from the workspace via API:

vscode.workspace.openTextDocument(localPath).then(function (doc) {
    vscode.window.showTextDocument(doc, 1);
});

and then close it, the onDidCloseTextDocument doesn't fire as usual. Its fire but few minutes later.

I know if this is some bug or this is the way VSCode works but I need to know how to detect when document window is closed.

I was reading that opening file via API is some kind of "virtual" file. So, probably this cause the problem.


Viewing all articles
Browse latest Browse all 97313

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>