@@ -653,7 +653,7 @@ await editorSession.LanguageService.GetDefinitionOfSymbol(
653
653
definitionLocations . Add (
654
654
new Location
655
655
{
656
- Uri = new Uri ( "file://" + definition . FoundDefinition . FilePath ) . AbsoluteUri ,
656
+ Uri = GetFileUri ( definition . FoundDefinition . FilePath ) ,
657
657
Range = GetRangeFromScriptRegion ( definition . FoundDefinition . ScriptRegion )
658
658
} ) ;
659
659
}
@@ -692,7 +692,7 @@ await editorSession.LanguageService.FindReferencesOfSymbol(
692
692
{
693
693
return new Location
694
694
{
695
- Uri = new Uri ( "file://" + r . FilePath ) . AbsoluteUri ,
695
+ Uri = GetFileUri ( r . FilePath ) ,
696
696
Range = GetRangeFromScriptRegion ( r . ScriptRegion )
697
697
} ;
698
698
} )
@@ -936,7 +936,7 @@ protected async Task HandleDocumentSymbolRequest(
936
936
Kind = GetSymbolKind ( r . SymbolType ) ,
937
937
Location = new Location
938
938
{
939
- Uri = new Uri ( "file://" + r . FilePath ) . AbsolutePath ,
939
+ Uri = GetFileUri ( r . FilePath ) ,
940
940
Range = GetRangeFromScriptRegion ( r . ScriptRegion )
941
941
} ,
942
942
Name = GetDecoratedSymbolName ( r )
@@ -1009,7 +1009,7 @@ protected async Task HandleWorkspaceSymbolRequest(
1009
1009
Kind = r . SymbolType == SymbolType . Variable ? SymbolKind . Variable : SymbolKind . Function ,
1010
1010
Location = new Location
1011
1011
{
1012
- Uri = new Uri ( "file://" + r . FilePath ) . AbsoluteUri ,
1012
+ Uri = GetFileUri ( r . FilePath ) ,
1013
1013
Range = GetRangeFromScriptRegion ( r . ScriptRegion )
1014
1014
} ,
1015
1015
Name = GetDecoratedSymbolName ( r )
@@ -1194,6 +1194,15 @@ await this.SendEvent(
1194
1194
1195
1195
#region Helper Methods
1196
1196
1197
+ private static string GetFileUri ( string filePath )
1198
+ {
1199
+ // If the file isn't untitled, return a URI-style path
1200
+ return
1201
+ ! filePath . StartsWith ( "untitled" )
1202
+ ? new Uri ( "file://" + filePath ) . AbsoluteUri
1203
+ : filePath ;
1204
+ }
1205
+
1197
1206
private static Range GetRangeFromScriptRegion ( ScriptRegion scriptRegion )
1198
1207
{
1199
1208
return new Range
0 commit comments