Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -867,19 +867,11 @@ private void PublishScriptDiagnostics(
fileLock.Release();
}


var uriBuilder = new UriBuilder
{
Scheme = Uri.UriSchemeFile,
Path = scriptFile.FilePath,
Host = string.Empty,
};

// Always send syntax and semantic errors. We want to
// make sure no out-of-date markers are being displayed.
_languageServer.Document.PublishDiagnostics(new PublishDiagnosticsParams()
{
Uri = uriBuilder.Uri,
Uri = new Uri(scriptFile.DocumentUri),
Comment thread
TylerLeonhardt marked this conversation as resolved.
Resolved
Diagnostics = new Container<Diagnostic>(diagnostics),
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,11 @@ public class ScriptDocumentSymbolProvider : IDocumentSymbolProvider
IEnumerable<SymbolReference> IDocumentSymbolProvider.ProvideDocumentSymbols(
ScriptFile scriptFile)
{
if (scriptFile != null &&
scriptFile.FilePath != null &&
(scriptFile.FilePath.EndsWith(".ps1", StringComparison.OrdinalIgnoreCase) ||
scriptFile.FilePath.EndsWith(".psm1", StringComparison.OrdinalIgnoreCase)))
{
return FindSymbolsInDocument(scriptFile.ScriptAst);
}

return Enumerable.Empty<SymbolReference>();
// If we have an AST, then we know it's a PowerShell file
// so lets try to find symbols in the document.
return scriptFile?.ScriptAst != null
? FindSymbolsInDocument(scriptFile.ScriptAst)
: Enumerable.Empty<SymbolReference>();
}

/// <summary>
Expand Down