From 909e7f7df8676cd1b08fd4ecc717689d1e913dd3 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 26 Jul 2018 08:33:14 -0700 Subject: [PATCH 1/2] workaround 711 --- .../CodeLens/ReferencesCodeLensProvider.cs | 4 ++-- .../Server/LanguageServer.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PowerShellEditorServices.Host/CodeLens/ReferencesCodeLensProvider.cs b/src/PowerShellEditorServices.Host/CodeLens/ReferencesCodeLensProvider.cs index bed4559a2..abe29a997 100644 --- a/src/PowerShellEditorServices.Host/CodeLens/ReferencesCodeLensProvider.cs +++ b/src/PowerShellEditorServices.Host/CodeLens/ReferencesCodeLensProvider.cs @@ -109,9 +109,9 @@ private static string GetFileUri(string filePath) { // If the file isn't untitled, return a URI-style path return - !filePath.StartsWith("untitled") + !filePath.StartsWith("untitled") && !filePath.StartsWith("inmemory") ? new Uri("file://" + filePath).AbsoluteUri : filePath; } } -} \ No newline at end of file +} diff --git a/src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs b/src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs index 31fc68a4f..684d86d7c 100644 --- a/src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs +++ b/src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs @@ -1358,7 +1358,7 @@ public static string GetFileUri(string filePath) { // If the file isn't untitled, return a URI-style path return - !filePath.StartsWith("untitled") + !filePath.StartsWith("untitled") && !filePath.StartsWith("inmemory") ? new Uri("file://" + filePath).AbsoluteUri : filePath; } From 0dce01e4ff4ab1429f81afd9309b5b40eb853e5c Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 26 Jul 2018 10:20:48 -0700 Subject: [PATCH 2/2] add test --- test/PowerShellEditorServices.Test/Session/WorkspaceTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/test/PowerShellEditorServices.Test/Session/WorkspaceTests.cs b/test/PowerShellEditorServices.Test/Session/WorkspaceTests.cs index 272cc891b..d40e59511 100644 --- a/test/PowerShellEditorServices.Test/Session/WorkspaceTests.cs +++ b/test/PowerShellEditorServices.Test/Session/WorkspaceTests.cs @@ -57,6 +57,7 @@ public void CanDetermineIsPathInMemory() // Test short non-file paths new { IsInMemory = true, Path = "untitled:untitled-1" }, new { IsInMemory = true, Path = shortUriForm }, + new { IsInMemory = true, Path = "inmemory://foo.ps1" }, // Test long non-file path - known to have crashed PSES new { IsInMemory = true, Path = longUriForm },