Skip to content

Commit 4518fa1

Browse files
authored
Backport #974 (#994)
* Backport 5f9d89a * Fix async abuse * Add semicolon
1 parent b181326 commit 4518fa1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs

+12
Original file line numberDiff line numberDiff line change
@@ -1379,6 +1379,12 @@ protected async Task HandleDocumentFormattingRequest(
13791379
DocumentFormattingParams formattingParams,
13801380
RequestContext<TextEdit[]> requestContext)
13811381
{
1382+
if (this.editorSession.AnalysisService == null)
1383+
{
1384+
await requestContext.SendError("Script analysis is not enabled in this session");
1385+
return;
1386+
}
1387+
13821388
var result = await Format(
13831389
formattingParams.TextDocument.Uri,
13841390
formattingParams.options,
@@ -1398,6 +1404,12 @@ protected async Task HandleDocumentRangeFormattingRequest(
13981404
DocumentRangeFormattingParams formattingParams,
13991405
RequestContext<TextEdit[]> requestContext)
14001406
{
1407+
if (this.editorSession.AnalysisService == null)
1408+
{
1409+
await requestContext.SendError("Script analysis is not enabled in this session");
1410+
return;
1411+
}
1412+
14011413
var result = await Format(
14021414
formattingParams.TextDocument.Uri,
14031415
formattingParams.Options,

0 commit comments

Comments
 (0)