Skip to content

Commit 8f56a38

Browse files
bergmeisterTylerLeonhardt
authored andcommitted
1.x: Fix wiring of WhitespaceInsideBrace and WhitespaceAroundPipe that got broken in #1024 (#1142)
* Fix PipelineIndentation configuration issue (#1050) * legacy/1.x: Update minimum PSSA version to 1.18.3 (#1052) * Fix wiring of WhitespaceInsideBrace and WhitespaceAroundPipe * revert regression from master * add trailing comma * revert PSAvoidUsingCmdletAliases change
1 parent f4ba84c commit 8f56a38

File tree

1 file changed

+39
-35
lines changed

1 file changed

+39
-35
lines changed

src/PowerShellEditorServices.Protocol/Server/LanguageServerSettings.cs

+39-35
Original file line numberDiff line numberDiff line change
@@ -249,58 +249,62 @@ public Hashtable GetPSSASettingsHashtable(
249249

250250
private Hashtable GetCustomPSSASettingsHashtable(int tabSize, bool insertSpaces)
251251
{
252-
var ruleConfigurations = new Hashtable {
253-
{"PSPlaceOpenBrace", new Hashtable {
254-
{"Enable", true},
255-
{"OnSameLine", OpenBraceOnSameLine},
256-
{"NewLineAfter", NewLineAfterOpenBrace},
257-
{"IgnoreOneLineBlock", IgnoreOneLineBlock}
252+
var ruleConfigurations = new Hashtable
253+
{
254+
{ "PSPlaceOpenBrace", new Hashtable {
255+
{ "Enable", true },
256+
{ "OnSameLine", OpenBraceOnSameLine },
257+
{ "NewLineAfter", NewLineAfterOpenBrace },
258+
{ "IgnoreOneLineBlock", IgnoreOneLineBlock }
258259
}},
259-
{"PSPlaceCloseBrace", new Hashtable {
260-
{"Enable", true},
261-
{"NewLineAfter", NewLineAfterCloseBrace},
262-
{"IgnoreOneLineBlock", IgnoreOneLineBlock}
260+
{ "PSPlaceCloseBrace", new Hashtable {
261+
{ "Enable", true },
262+
{ "NewLineAfter", NewLineAfterCloseBrace },
263+
{ "IgnoreOneLineBlock", IgnoreOneLineBlock }
263264
}},
264-
{"PSUseConsistentIndentation", new Hashtable {
265-
{"Enable", true},
266-
{"IndentationSize", tabSize},
267-
{"PipelineIndentation", PipelineIndentationStyle },
268-
{"Kind", insertSpaces ? "space" : "tab"}
265+
{ "PSUseConsistentIndentation", new Hashtable {
266+
{ "Enable", true },
267+
{ "IndentationSize", tabSize },
268+
{ "PipelineIndentation", PipelineIndentationStyle },
269+
{ "Kind", insertSpaces ? "space" : "tab" }
269270
}},
270-
{"PSUseConsistentWhitespace", new Hashtable {
271-
{"Enable", true},
272-
{"CheckOpenBrace", WhitespaceBeforeOpenBrace},
273-
{"CheckOpenParen", WhitespaceBeforeOpenParen},
274-
{"CheckOperator", WhitespaceAroundOperator},
275-
{"CheckSeparator", WhitespaceAfterSeparator}
271+
{ "PSUseConsistentWhitespace", new Hashtable {
272+
{ "Enable", true },
273+
{ "CheckOpenBrace", WhitespaceBeforeOpenBrace },
274+
{ "CheckOpenParen", WhitespaceBeforeOpenParen },
275+
{ "CheckOperator", WhitespaceAroundOperator },
276+
{ "CheckSeparator", WhitespaceAfterSeparator },
277+
{ "CheckInnerBrace", WhitespaceInsideBrace },
278+
{ "CheckPipe", WhitespaceAroundPipe },
276279
}},
277-
{"PSAlignAssignmentStatement", new Hashtable {
278-
{"Enable", true},
279-
{"CheckHashtable", AlignPropertyValuePairs}
280+
{ "PSAlignAssignmentStatement", new Hashtable {
281+
{ "Enable", true },
282+
{ "CheckHashtable", AlignPropertyValuePairs }
280283
}},
281-
{"PSUseCorrectCasing", new Hashtable {
282-
{"Enable", UseCorrectCasing}
284+
{ "PSUseCorrectCasing", new Hashtable {
285+
{ "Enable", UseCorrectCasing }
283286
}},
284287
};
285288

286289
if (AutoCorrectAliases)
287290
{
291+
// Empty hashtable required to activate the rule,
292+
// since PSAvoidUsingCmdletAliases inherits from IScriptRule and not ConfigurableRule
288293
ruleConfigurations.Add("PSAvoidUsingCmdletAliases", new Hashtable());
289294
}
290295

291-
return new Hashtable
296+
return new Hashtable()
292297
{
293-
{"IncludeRules", new string[] {
294-
"PSPlaceCloseBrace",
295-
"PSPlaceOpenBrace",
296-
"PSUseConsistentWhitespace",
297-
"PSUseConsistentIndentation",
298-
"PSAlignAssignmentStatement",
299-
"PSAvoidUsingCmdletAliases",
298+
{ "IncludeRules", new string[] {
299+
"PSPlaceCloseBrace",
300+
"PSPlaceOpenBrace",
301+
"PSUseConsistentWhitespace",
302+
"PSUseConsistentIndentation",
303+
"PSAlignAssignmentStatement",
300304
}},
301305
{
302306
"Rules", ruleConfigurations
303-
},
307+
}
304308
};
305309
}
306310
}

0 commit comments

Comments
 (0)