Skip to content

Commit 7a41066

Browse files
author
Keegan Irby
committed
Comment why we iterate tabGroups to close session
1 parent d44fb4c commit 7a41066

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/core/src/awsService/cloudWatchLogs/commands/tailLogGroup.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,18 @@ async function updateTextDocumentWithNewLogEvents(
115115
await vscode.workspace.applyEdit(edit)
116116
}
117117

118+
/**
119+
* The LiveTail session should be automatically closed if the user does not have the session's
120+
* document in any Tab in their editor.
121+
*
122+
* `onDidCloseTextDocument` doesn't work for our case because the tailLogGroup command will keep the stream
123+
* writing to the doc even when all its tabs/editors are closed, seemingly keeping the doc 'open'.
124+
* Also there is no guarantee that this event fires when an editor tab is closed
125+
*
126+
* `onDidChangeVisibleTextEditors` returns editors that the user can see its contents. An editor that is open, but hidden
127+
* from view, will not be returned. Meaning a Tab that is created (shown in top bar), but not open, will not be returned. Even if
128+
* the tab isn't visible, we want to continue writing to the doc, and keep the session alive.
129+
*/
118130
function registerTabChangeCallback(
119131
session: LiveTailSession,
120132
registry: LiveTailSessionRegistry,

0 commit comments

Comments
 (0)