onDidCloseTextDocument

An event that is emitted when a text document is disposed or when the language id of a text document languages.setTextDocumentLanguage.

Note 1: There is no guarantee that this event fires when an editor tab is closed, use the {@linkcode window.onDidChangeVisibleTextEditors onDidChangeVisibleTextEditors}-event to know when editors change.

Note 2: A document can be open but not shown in an editor which means this event can fire for a document that has not been shown in an editor.

Online Documentation