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 @@ -1380,6 +1380,12 @@ protected async Task HandleDocumentFormattingRequestAsync(
13801380 DocumentFormattingParams formattingParams ,
13811381 RequestContext < TextEdit [ ] > requestContext )
13821382 {
1383+ if ( this . editorSession . AnalysisService == null )
1384+ {
1385+ await requestContext . SendErrorAsync ( "Script analysis is not enabled in this session" ) ;
1386+ return ;
1387+ }
1388+
13831389 var result = await FormatAsync (
13841390 formattingParams . TextDocument . Uri ,
13851391 formattingParams . options ,
@@ -1399,6 +1405,12 @@ protected async Task HandleDocumentRangeFormattingRequestAsync(
13991405 DocumentRangeFormattingParams formattingParams ,
14001406 RequestContext < TextEdit [ ] > requestContext )
14011407 {
1408+ if ( this . editorSession . AnalysisService == null )
1409+ {
1410+ await requestContext . SendErrorAsync ( "Script analysis is not enabled in this session" ) ;
1411+ return ;
1412+ }
1413+
14021414 var result = await FormatAsync (
14031415 formattingParams . TextDocument . Uri ,
14041416 formattingParams . Options ,
You can’t perform that action at this time.
0 commit comments