Skip to content

Commit 585fbdf

Browse files
author
Kapil Borle
committed
Enable InvokeFormatter range only in debug build
1 parent a4eb6f3 commit 585fbdf

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Engine/Commands/InvokeFormatterCommand.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class InvokeFormatterCommand : PSCmdlet, IOutputWriter
3333
[ValidateNotNull]
3434
public object Settings { get; set; }
3535

36+
#if DEBUG
3637
[Parameter(Mandatory = false)]
3738
public Range Range { get; set; }
3839

@@ -45,7 +46,6 @@ public class InvokeFormatterCommand : PSCmdlet, IOutputWriter
4546
[Parameter(Mandatory = false, ParameterSetName = "NoRange")]
4647
public int EndColumnNumber { get; set; } = -1;
4748

48-
#if DEBUG
4949
/// <summary>
5050
/// Attaches to an instance of a .Net debugger
5151
/// </summary>
@@ -94,16 +94,20 @@ protected override void BeginProcessing()
9494

9595
protected override void ProcessRecord()
9696
{
97-
// todo add range parameter
9897
// todo add tests to check range formatting
98+
string formattedScriptDefinition;
99+
#if DEBUG
99100
var range = Range;
100101
if (this.ParameterSetName.Equals("NoRange"))
101102
{
102103
range = new Range(StartLineNumber, StartColumnNumber, EndLineNumber, EndColumnNumber);
103104
}
104105

105-
var text = Formatter.Format(ScriptDefinition, inputSettings, range, this);
106-
this.WriteObject(text);
106+
formattedScriptDefinition = Formatter.Format(ScriptDefinition, inputSettings, range, this);
107+
#endif // DEBUG
108+
109+
formattedScriptDefinition = Formatter.Format(ScriptDefinition, inputSettings, null, this);
110+
this.WriteObject(formattedScriptDefinition);
107111
}
108112

109113
private void ValidateInputSettings()

0 commit comments

Comments
 (0)