Skip to content

Check _analysisService is null #1175

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

Closed
wants to merge 2 commits into from
Closed
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 @@ -65,7 +65,10 @@ public Task<Unit> Handle(DidChangeTextDocumentParams notification, CancellationT
#pragma warning disable CS4014
// Kick off script diagnostics without blocking the response
// TODO: Get all recently edited files in the workspace
_analysisService.RunScriptDiagnosticsAsync(new ScriptFile[] { changedFile });
if (_analysisService != null)
{
_analysisService.RunScriptDiagnosticsAsync(new ScriptFile[] { changedFile });
}
#pragma warning restore CS4014
return Unit.Task;
}
Expand Down Expand Up @@ -94,7 +97,10 @@ public Task<Unit> Handle(DidOpenTextDocumentParams notification, CancellationTok
#pragma warning disable CS4014
// Kick off script diagnostics without blocking the response
// TODO: Get all recently edited files in the workspace
_analysisService.RunScriptDiagnosticsAsync(new ScriptFile[] { openedFile });
if (_analysisService != null)
{
_analysisService.RunScriptDiagnosticsAsync(new ScriptFile[] { openedFile });
}
#pragma warning restore CS4014

_logger.LogTrace("Finished opening document.");
Expand All @@ -117,7 +123,10 @@ public Task<Unit> Handle(DidCloseTextDocumentParams notification, CancellationTo
if (fileToClose != null)
{
_workspaceService.CloseFile(fileToClose);
_analysisService.ClearMarkers(fileToClose);
if (_analysisService != null)
{
_analysisService.ClearMarkers(fileToClose);
}
}

_logger.LogTrace("Finished closing document.");
Expand Down