@@ -26,7 +26,7 @@ export namespace ScriptFileMarkersRequest {
26
26
// TODO move some of the common interface to a separate file?
27
27
interface ScriptFileMarkersRequestParams {
28
28
filePath : string ;
29
- settings : string ;
29
+ settings : any ;
30
30
}
31
31
32
32
interface ScriptFileMarkersRequestResultParams {
@@ -219,38 +219,28 @@ class PSDocumentFormattingEditProvider implements DocumentFormattingEditProvider
219
219
this . languageClient = languageClient ;
220
220
}
221
221
222
- getSettings ( rule : string ) : string {
223
- let settings : Settings . ISettings = Settings . load ( Utils . PowerShellLanguageId ) ;
224
- let ruleProperty : string ;
222
+ getSettings ( rule : string ) : any {
223
+ let psSettings : Settings . ISettings = Settings . load ( Utils . PowerShellLanguageId ) ;
224
+ let ruleSettings = new Object ( ) ;
225
+ ruleSettings [ "Enable" ] = true ;
226
+
225
227
switch ( rule ) {
226
228
case "PSPlaceOpenBrace" :
227
- ruleProperty = `${ rule } = @{
228
- Enable = \$true
229
- OnSameLine = \$${ settings . codeFormatting . openBraceOnSameLine }
230
- NewLineAfter = \$${ settings . codeFormatting . newLineAfterOpenBrace }
231
- }` ;
229
+ ruleSettings [ "OnSameLine" ] = psSettings . codeFormatting . openBraceOnSameLine ;
230
+ ruleSettings [ "NewLineAfter" ] = psSettings . codeFormatting . newLineAfterOpenBrace ;
232
231
break ;
233
232
234
233
case "PSUseConsistentIndentation" :
235
- ruleProperty = `${ rule } = @{
236
- Enable = \$true
237
- IndentationSize = ${ vscode . workspace . getConfiguration ( "editor" ) . get < number > ( "tabSize" ) }
238
- }` ;
234
+ ruleSettings [ "IndentationSize" ] = vscode . workspace . getConfiguration ( "editor" ) . get < number > ( "tabSize" ) ;
239
235
break ;
240
236
241
237
default :
242
- ruleProperty = `${ rule } = @{
243
- Enable = \$true
244
- }` ;
245
238
break ;
246
239
}
247
240
248
- return `@{
249
- IncludeRules = @('${ rule } ')
250
- Rules = @{
251
- ${ ruleProperty }
252
- }
253
- }` ;
241
+ let settings : Object = new Object ( ) ;
242
+ settings [ rule ] = ruleSettings ;
243
+ return settings ;
254
244
}
255
245
}
256
246
0 commit comments