Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b82b8b8

Browse files
Ignore didOpen notifications for git schemed documents from VS Code
For some reason VS Code, in some repositories and configurations, will send us `DidOpenTextDocument` notifications for special documents with the `git` scheme (not `file` or `untitled`). It's probably some internal representation that VS Code is using to supply VCS information. Because we were specifically ignoring the URI in this handler these files were getting erroneously added to our workspace service's list of open files, which then caused duplicate references.
1 parent d052a50 commit b82b8b8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎src/PowerShellEditorServices/Services/TextDocument/Handlers/TextDocumentHandler.cs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ protected override TextDocumentSyncRegistrationOptions CreateRegistrationOptions
7474

7575
public override Task<Unit> Handle(DidOpenTextDocumentParams notification, CancellationToken token)
7676
{
77+
// We're receiving notifications for special "git" scheme files from VS Code, and we
78+
// need to ignore those! Otherwise they're added to our workspace service's opened files
79+
// and cause duplicate references.
80+
if (notification.TextDocument.Uri.Scheme == "git")
81+
{
82+
return Unit.Task;
83+
}
84+
7785
// We use a fake Uri because we only want to test the LanguageId here and not if the
7886
// file ends in ps*1.
7987
TextDocumentAttributes attributes = new(s_fakeUri, notification.TextDocument.LanguageId);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /