From 78cebea1e927a92b34913574bbdabe4bd6f3b293 Mon Sep 17 00:00:00 2001 From: Sean Poulter Date: Mon, 8 Jan 2018 14:03:19 -0500 Subject: [PATCH 1/2] Add note to differentiate btw TextDoc & TextEditor These are some of the things I wish I had known before using the TextDocument event listeners. cc @jrieken, Microsoft/vscode#40653 --- src/vs/vscode.d.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 515a5e62cfc37..dabc85202773c 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -5418,11 +5418,23 @@ declare module 'vscode' { /** * An event that is emitted when a [text document](#TextDocument) is opened. + * + * To add an event listener when a visible text document is opened, use the [TextEditor](#TextEditor) events in the + * [window](#_window) namespace. Note that: + * + * - The event is emitted before the [document](#TextDocument) is updated in the + * [active text editor](#window.activeTextEditor) + * - When a [text document](#TextDocument) is already open (e.g.: open in another [visible text editor](#window.visibleTextEditors)) this event is not emitted + * */ export const onDidOpenTextDocument: Event; /** * An event that is emitted when a [text document](#TextDocument) is disposed. + * + * To add an event listener when a visible text document is closed, use the [TextEditor](#TextEditor) events in the + * [window](#_window) namespace. Note that this event is not emitted when a [text document]#TextDocument is closed + * but remains open in another [visible text editor](#window.visibleTextEditors). */ export const onDidCloseTextDocument: Event; From 2c40789de977aa5c0fcc9c4e7d2e11e124dd8d0c Mon Sep 17 00:00:00 2001 From: Sean Poulter Date: Tue, 9 Jan 2018 08:37:05 -0500 Subject: [PATCH 2/2] Fix markdown, change wording --- src/vs/vscode.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index dabc85202773c..0920acba7475f 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -5433,8 +5433,8 @@ declare module 'vscode' { * An event that is emitted when a [text document](#TextDocument) is disposed. * * To add an event listener when a visible text document is closed, use the [TextEditor](#TextEditor) events in the - * [window](#_window) namespace. Note that this event is not emitted when a [text document]#TextDocument is closed - * but remains open in another [visible text editor](#window.visibleTextEditors). + * [window](#_window) namespace. Note that this event is not emitted when a [TextEditor](#TextEditor) is closed + * but the document remains open in another [visible text editor](#window.visibleTextEditors). */ export const onDidCloseTextDocument: Event;