Skip to content

Commit f3da699

Browse files
workaround to support inmemory:// (#712)
* workaround 711 * add test
1 parent 5717ad0 commit f3da699

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/PowerShellEditorServices.Host/CodeLens/ReferencesCodeLensProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ private static string GetFileUri(string filePath)
109109
{
110110
// If the file isn't untitled, return a URI-style path
111111
return
112-
!filePath.StartsWith("untitled")
112+
!filePath.StartsWith("untitled") && !filePath.StartsWith("inmemory")
113113
? new Uri("file://" + filePath).AbsoluteUri
114114
: filePath;
115115
}
116116
}
117-
}
117+
}

src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,7 @@ public static string GetFileUri(string filePath)
13581358
{
13591359
// If the file isn't untitled, return a URI-style path
13601360
return
1361-
!filePath.StartsWith("untitled")
1361+
!filePath.StartsWith("untitled") && !filePath.StartsWith("inmemory")
13621362
? new Uri("file://" + filePath).AbsoluteUri
13631363
: filePath;
13641364
}

test/PowerShellEditorServices.Test/Session/WorkspaceTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public void CanDetermineIsPathInMemory()
5757
// Test short non-file paths
5858
new { IsInMemory = true, Path = "untitled:untitled-1" },
5959
new { IsInMemory = true, Path = shortUriForm },
60+
new { IsInMemory = true, Path = "inmemory://foo.ps1" },
6061

6162
// Test long non-file path - known to have crashed PSES
6263
new { IsInMemory = true, Path = longUriForm },

0 commit comments

Comments
 (0)