Skip to content

Commit

Permalink
Backport #974 (#994)
Browse files Browse the repository at this point in the history
* Backport 5f9d89a

* Fix async abuse

* Add semicolon
  • Loading branch information
rjmholt authored Jul 27, 2019
1 parent b181326 commit 4518fa1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1379,6 +1379,12 @@ protected async Task HandleDocumentFormattingRequest(
DocumentFormattingParams formattingParams,
RequestContext<TextEdit[]> requestContext)
{
if (this.editorSession.AnalysisService == null)
{
await requestContext.SendError("Script analysis is not enabled in this session");
return;
}

var result = await Format(
formattingParams.TextDocument.Uri,
formattingParams.options,
Expand All @@ -1398,6 +1404,12 @@ protected async Task HandleDocumentRangeFormattingRequest(
DocumentRangeFormattingParams formattingParams,
RequestContext<TextEdit[]> requestContext)
{
if (this.editorSession.AnalysisService == null)
{
await requestContext.SendError("Script analysis is not enabled in this session");
return;
}

var result = await Format(
formattingParams.TextDocument.Uri,
formattingParams.Options,
Expand Down

0 comments on commit 4518fa1

Please sign in to comment.