File tree 1 file changed +12
-0
lines changed
src/PowerShellEditorServices.Protocol/Server
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -1380,6 +1380,12 @@ protected async Task HandleDocumentFormattingRequestAsync(
1380
1380
DocumentFormattingParams formattingParams ,
1381
1381
RequestContext < TextEdit [ ] > requestContext )
1382
1382
{
1383
+ if ( this . editorSession . AnalysisService == null )
1384
+ {
1385
+ await requestContext . SendErrorAsync ( "Script analysis is not enabled in this session" ) ;
1386
+ return ;
1387
+ }
1388
+
1383
1389
var result = await FormatAsync (
1384
1390
formattingParams . TextDocument . Uri ,
1385
1391
formattingParams . options ,
@@ -1399,6 +1405,12 @@ protected async Task HandleDocumentRangeFormattingRequestAsync(
1399
1405
DocumentRangeFormattingParams formattingParams ,
1400
1406
RequestContext < TextEdit [ ] > requestContext )
1401
1407
{
1408
+ if ( this . editorSession . AnalysisService == null )
1409
+ {
1410
+ await requestContext . SendErrorAsync ( "Script analysis is not enabled in this session" ) ;
1411
+ return ;
1412
+ }
1413
+
1402
1414
var result = await FormatAsync (
1403
1415
formattingParams . TextDocument . Uri ,
1404
1416
formattingParams . Options ,
You can’t perform that action at this time.
0 commit comments