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
72
72
73
73
if ( formattedScript is null )
74
74
{
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 ;
77
83
}
78
84
79
85
return new TextEditContainer ( new TextEdit
@@ -152,8 +158,14 @@ public override async Task<TextEditContainer> Handle(DocumentRangeFormattingPara
152
158
153
159
if ( formattedScript is null )
154
160
{
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 ;
157
169
}
158
170
159
171
return new TextEditContainer ( new TextEdit
You can’t perform that action at this time.
0 commit comments