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(
200200 {
201201 TriggerCharacters = new string [ ] { " " } // TODO: Other characters here?
202202 } ,
203- DocumentFormattingProvider = true ,
204- DocumentRangeFormattingProvider = true
203+ DocumentFormattingProvider = true
205204 }
206205 } ) ;
207206 }
Original file line number Diff line number Diff line change @@ -264,16 +264,26 @@ public async Task<string> Format(
264264 return null ;
265265 }
266266
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 > {
270279 { "ScriptDefinition" , scriptDefinition } ,
271280 { "StartLineNumber" , startLineNumber } ,
272281 { "StartColumnNumber" , startColumnNumber } ,
273282 { "EndLineNumber" , endLineNumber } ,
274283 { "EndColumnNumber" , endColumnNumber }
275- } ) ;
276-
284+ } ;
285+ }
286+ var result = await InvokePowerShellAsync ( "Invoke-Formatter" , argsDict ) ;
277287 return result ? . Select ( r => r . ImmediateBaseObject as string ) . FirstOrDefault ( ) ;
278288 }
279289
You can’t perform that action at this time.
0 commit comments