Skip to content

Commit

Permalink
SLVSCODE-965 exclude files that are open in the background
Browse files Browse the repository at this point in the history
  • Loading branch information
sophio-japharidze-sonarsource committed Dec 11, 2024
1 parent 3e77e18 commit 4c895ae
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,18 @@ function installCustomRequestHandlers(context: VSCode.ExtensionContext) {
});
languageClient.onNotification(protocol.SuggestConnection.type, (params) => SharedConnectedModeSettingsService.instance.handleSuggestConnectionNotification(params.suggestionsByConfigScopeId));
languageClient.onRequest(protocol.IsOpenInEditor.type, fileUri => {
return VSCode.workspace.textDocuments.some(doc => code2ProtocolConverter(doc.uri) === fileUri);
console.log('fileUri', fileUri)
console.log('tabGroups', VSCode.window.tabGroups)
return isFileInAnyTabGroup(fileUri);
});
}

function isFileInAnyTabGroup(fileUri: string): boolean {
return VSCode.window.tabGroups.all.some(tabGroup => {
return code2ProtocolConverter((tabGroup.activeTab.input as VSCode.TabInputText).uri) === fileUri
|| tabGroup.tabs.some(tab => code2ProtocolConverter((tab.input as VSCode.TabInputText).uri) === fileUri
|| code2ProtocolConverter((tabGroup.activeTab.input as VSCode.TabInputNotebook).uri) === fileUri
|| tabGroup.tabs.some(tab => code2ProtocolConverter((tab.input as VSCode.TabInputNotebook).uri) === fileUri));
});
}

Expand Down

0 comments on commit 4c895ae

Please sign in to comment.