File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
src/PowerShellEditorServices/Services/TextDocument/Handlers Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -72,8 +72,14 @@ public override async Task<TextEditContainer> Handle(DocumentFormattingParams re
7272
7373 if ( formattedScript is null )
7474 {
75- _logger . LogWarning ( $ "Formatting returned null. Returning original contents for file: { scriptFile . DocumentUri } ") ;
76- formattedScript = scriptFile . Contents ;
75+ _logger . LogWarning ( $ "Formatting returned null. Not formatting: { scriptFile . DocumentUri } ") ;
76+ return null ;
77+ }
78+
79+ if ( cancellationToken . IsCancellationRequested )
80+ {
81+ _logger . LogWarning ( $ "Formatting request canceled for: { scriptFile . DocumentUri } ") ;
82+ return null ;
7783 }
7884
7985 return new TextEditContainer ( new TextEdit
@@ -152,8 +158,14 @@ public override async Task<TextEditContainer> Handle(DocumentRangeFormattingPara
152158
153159 if ( formattedScript is null )
154160 {
155- _logger . LogWarning ( $ "Formatting returned null. Returning original contents for file: { scriptFile . DocumentUri } ") ;
156- formattedScript = scriptFile . Contents ;
161+ _logger . LogWarning ( $ "Formatting returned null. Not formatting: { scriptFile . DocumentUri } ") ;
162+ return null ;
163+ }
164+
165+ if ( cancellationToken . IsCancellationRequested )
166+ {
167+ _logger . LogWarning ( $ "Formatting request canceled for: { scriptFile . DocumentUri } ") ;
168+ return null ;
157169 }
158170
159171 return new TextEditContainer ( new TextEdit
You can’t perform that action at this time.
0 commit comments