Skip to content

Commit d198694

Browse files
Wrap untitled script with newlines (#1804)
1 parent a4ea69a commit d198694

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/PowerShellEditorServices/Services/DebugAdapter/Handlers/ConfigurationDoneHandler.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,10 @@ private async Task LaunchScriptAsync(string scriptToLaunch)
135135
else
136136
{
137137
// Without the new APIs we can only execute the untitled script's contents.
138-
// Command breakpoints and `Wait-Debugger` will work.
138+
// Command breakpoints and `Wait-Debugger` will work. We must wrap the script
139+
// with newlines so that any included comments don't break the command.
139140
command = PSCommandHelpers.BuildDotSourceCommandWithArguments(
140-
string.Concat("{ ", untitledScript.Contents, " }"), _debugStateService.Arguments);
141+
string.Concat("{\n", untitledScript.Contents, "\n}"), _debugStateService.Arguments);
141142
}
142143
}
143144
else

0 commit comments

Comments
 (0)