File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
src/PowerShellEditorServices.Protocol/Server Expand file tree Collapse file tree 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(
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 ,
You can’t perform that action at this time.
0 commit comments