Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only run diagnostics on PowerShell files #1241

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Only run diagnostics on PowerShell files
  • Loading branch information
TylerLeonhardt committed Mar 24, 2020
commit 29b81d2d7fd31c5f0576754454005061e4b357b3
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ private async Task DelayThenInvokeDiagnosticsAsync(ScriptFile[] filesToAnalyze,

private void PublishScriptDiagnostics(ScriptFile scriptFile, IReadOnlyList<ScriptFileMarker> markers)
{
var diagnostics = new Diagnostic[scriptFile.DiagnosticMarkers.Count];
var diagnostics = new Diagnostic[markers.Count];

CorrectionTableEntry fileCorrections = _mostRecentCorrectionsByFile.GetOrAdd(
scriptFile,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,12 @@ public Task<Unit> Handle(DidOpenTextDocumentParams notification, CancellationTok
notification.TextDocument.Uri,
notification.TextDocument.Text);

// Kick off script diagnostics without blocking the response
// Kick off script diagnostics if we got a PowerShell file without blocking the response
// TODO: Get all recently edited files in the workspace
_analysisService.RunScriptDiagnostics(new ScriptFile[] { openedFile }, token);
if (notification.TextDocument.LanguageId == "powershell")
{
_analysisService.RunScriptDiagnostics(new ScriptFile[] { openedFile }, token);
}

_logger.LogTrace("Finished opening document.");
return Unit.Task;
Expand Down