Skip to content

Commit

Permalink
Fix crash when VS Code sends file path with 'git' scheme
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
daviwil committed Jan 18, 2017
1 parent 21f3f8a commit 7f22985
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/PowerShellEditorServices/Workspace/Workspace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,15 @@ internal static bool IsPathInMemory(string filePath)
// When viewing PowerShell files in the Git diff viewer, VS Code
// sends the contents of the file at HEAD with a URI that starts
// with 'inmemory'. Untitled files which have been marked of
// type PowerShell have a path starting with 'untitled'. Files
// opened from the find/replace view will be prefixed with
// 'private'.
// type PowerShell have a path starting with 'untitled'.
return
filePath.StartsWith("inmemory") ||
filePath.StartsWith("untitled") ||
filePath.StartsWith("private");
filePath.StartsWith("private") ||
filePath.StartsWith("git");

// TODO #342: Remove 'private' and 'git' and then add logic to
// throw when any unsupported file URI scheme is encountered.
}

private string GetBaseFilePath(string filePath)
Expand Down

0 comments on commit 7f22985

Please sign in to comment.