diff --git a/src/PowerShellEditorServices/Server/PsesLanguageServer.cs b/src/PowerShellEditorServices/Server/PsesLanguageServer.cs index b454a190a..3daf3cd52 100644 --- a/src/PowerShellEditorServices/Server/PsesLanguageServer.cs +++ b/src/PowerShellEditorServices/Server/PsesLanguageServer.cs @@ -111,7 +111,10 @@ public async Task StartAsync() var workspaceService = serviceProvider.GetService(); // Grab the workspace path from the parameters - workspaceService.WorkspacePath = request.RootUri?.LocalPath; + if (request.RootUri != null) + { + workspaceService.WorkspacePath = workspaceService.ResolveFilePath(request.RootUri.ToString()); + } // Set the working directory of the PowerShell session to the workspace path if (workspaceService.WorkspacePath != null diff --git a/src/PowerShellEditorServices/Services/CodeLens/ReferencesCodeLensProvider.cs b/src/PowerShellEditorServices/Services/CodeLens/ReferencesCodeLensProvider.cs index 1ef194a56..c8dfc72d8 100644 --- a/src/PowerShellEditorServices/Services/CodeLens/ReferencesCodeLensProvider.cs +++ b/src/PowerShellEditorServices/Services/CodeLens/ReferencesCodeLensProvider.cs @@ -106,7 +106,7 @@ public CodeLens ResolveCodeLens(CodeLens codeLens, ScriptFile scriptFile) var acc = new List(); foreach (SymbolReference foundReference in referencesResult) { - if (!NotReferenceDefinition(foundSymbol, foundReference)) + if (IsReferenceDefinition(foundSymbol, foundReference)) { continue; } @@ -144,12 +144,13 @@ public CodeLens ResolveCodeLens(CodeLens codeLens, ScriptFile scriptFile) /// The symbol definition that may be referenced. /// The reference symbol to check. /// True if the reference is not a reference to the definition, false otherwise. - private static bool NotReferenceDefinition( + private static bool IsReferenceDefinition( SymbolReference definition, SymbolReference reference) { return - definition.ScriptRegion.StartLineNumber != reference.ScriptRegion.StartLineNumber + definition.FilePath != reference.FilePath + || definition.ScriptRegion.StartLineNumber != reference.ScriptRegion.StartLineNumber || definition.SymbolType != reference.SymbolType || !string.Equals(definition.SymbolName, reference.SymbolName, StringComparison.OrdinalIgnoreCase); }