Skip to content

Commit 1dcd96b

Browse files
committed
Add setting for the formatter to trim trailing whitespace
1 parent 2b24392 commit 1dcd96b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/PowerShellEditorServices/Services/Workspace/LanguageServerSettings.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ public CodeFormattingSettings(CodeFormattingSettings codeFormattingSettings)
208208
public bool IgnoreOneLineBlock { get; set; }
209209
public bool AlignPropertyValuePairs { get; set; }
210210
public bool UseCorrectCasing { get; set; }
211+
public bool RemoveTrailingWhitespace { get; set; }
211212

212213
/// <summary>
213214
/// Get the settings hashtable that will be consumed by PSScriptAnalyzer.
@@ -328,6 +329,13 @@ private Hashtable GetCustomPSSASettingsHashtable(int tabSize, bool insertSpaces)
328329
ruleConfigurations.Add("PSAvoidUsingCmdletAliases", new Hashtable());
329330
}
330331

332+
if (RemoveTrailingWhitespace)
333+
{
334+
// Empty hashtable required to activate the rule,
335+
// since PSAvoidTrailingWhitespace inherits from IScriptRule and not ConfigurableRule
336+
ruleConfigurations.Add("PSAvoidTrailingWhitespace", new Hashtable());
337+
}
338+
331339
return new Hashtable()
332340
{
333341
{ "IncludeRules", new string[] {

0 commit comments

Comments
 (0)