File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed
PowerShellEditorServices.Protocol/Server
PowerShellEditorServices/Analysis Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -200,8 +200,7 @@ await requestContext.SendResult(
200
200
{
201
201
TriggerCharacters = new string [ ] { " " } // TODO: Other characters here?
202
202
} ,
203
- DocumentFormattingProvider = true ,
204
- DocumentRangeFormattingProvider = true
203
+ DocumentFormattingProvider = true
205
204
}
206
205
} ) ;
207
206
}
Original file line number Diff line number Diff line change @@ -264,16 +264,26 @@ public async Task<string> Format(
264
264
return null ;
265
265
}
266
266
267
- var result = await InvokePowerShellAsync (
268
- "Invoke-Formatter" ,
269
- new Dictionary < string , object > {
267
+ Dictionary < string , object > argsDict ;
268
+
269
+ // this is a workaround till range formatter is enable in script analyzer
270
+ if ( startLineNumber == - 1 )
271
+ {
272
+ argsDict = new Dictionary < string , object > {
273
+ { "ScriptDefinition" , scriptDefinition }
274
+ } ;
275
+ }
276
+ else
277
+ {
278
+ argsDict = new Dictionary < string , object > {
270
279
{ "ScriptDefinition" , scriptDefinition } ,
271
280
{ "StartLineNumber" , startLineNumber } ,
272
281
{ "StartColumnNumber" , startColumnNumber } ,
273
282
{ "EndLineNumber" , endLineNumber } ,
274
283
{ "EndColumnNumber" , endColumnNumber }
275
- } ) ;
276
-
284
+ } ;
285
+ }
286
+ var result = await InvokePowerShellAsync ( "Invoke-Formatter" , argsDict ) ;
277
287
return result ? . Select ( r => r . ImmediateBaseObject as string ) . FirstOrDefault ( ) ;
278
288
}
279
289
You can’t perform that action at this time.
0 commit comments