Skip to content

Commit 7f22985

Browse files
committed
Fix crash when VS Code sends file path with 'git' scheme
Today's VS Code Insiders release has started sending file requests with a file scheme of 'git' which causes a crash in our language server. This is a temporary fix until we add more robust file URI scheme handling with the fix to issue #342.
1 parent 21f3f8a commit 7f22985

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/PowerShellEditorServices/Workspace/Workspace.cs

+6-4
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,15 @@ internal static bool IsPathInMemory(string filePath)
301301
// When viewing PowerShell files in the Git diff viewer, VS Code
302302
// sends the contents of the file at HEAD with a URI that starts
303303
// with 'inmemory'. Untitled files which have been marked of
304-
// type PowerShell have a path starting with 'untitled'. Files
305-
// opened from the find/replace view will be prefixed with
306-
// 'private'.
304+
// type PowerShell have a path starting with 'untitled'.
307305
return
308306
filePath.StartsWith("inmemory") ||
309307
filePath.StartsWith("untitled") ||
310-
filePath.StartsWith("private");
308+
filePath.StartsWith("private") ||
309+
filePath.StartsWith("git");
310+
311+
// TODO #342: Remove 'private' and 'git' and then add logic to
312+
// throw when any unsupported file URI scheme is encountered.
311313
}
312314

313315
private string GetBaseFilePath(string filePath)

0 commit comments

Comments
 (0)