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 @@ -1379,6 +1379,12 @@ protected async Task HandleDocumentFormattingRequest(
1379
1379
DocumentFormattingParams formattingParams ,
1380
1380
RequestContext < TextEdit [ ] > requestContext )
1381
1381
{
1382
+ if ( this . editorSession . AnalysisService == null )
1383
+ {
1384
+ await requestContext . SendError ( "Script analysis is not enabled in this session" ) ;
1385
+ return ;
1386
+ }
1387
+
1382
1388
var result = await Format (
1383
1389
formattingParams . TextDocument . Uri ,
1384
1390
formattingParams . options ,
@@ -1398,6 +1404,12 @@ protected async Task HandleDocumentRangeFormattingRequest(
1398
1404
DocumentRangeFormattingParams formattingParams ,
1399
1405
RequestContext < TextEdit [ ] > requestContext )
1400
1406
{
1407
+ if ( this . editorSession . AnalysisService == null )
1408
+ {
1409
+ await requestContext . SendError ( "Script analysis is not enabled in this session" ) ;
1410
+ return ;
1411
+ }
1412
+
1401
1413
var result = await Format (
1402
1414
formattingParams . TextDocument . Uri ,
1403
1415
formattingParams . Options ,
You can’t perform that action at this time.
0 commit comments