@@ -31,26 +31,14 @@ function formatString(format: string, args: string[]) {
3131 return format ;
3232}
3333
34- // Initial configurations do not require escaping ${keyword}. If it is being used
35- // as a configuration snippet, then ${keyword} will need to be escaped or VsCode will
36- // try to evaluate it.
37- function EnsureTokensEscapedInLaunchJsonMacro ( keyword : string , isInitialConfiguration : boolean ) : string {
38- if ( isInitialConfiguration ) {
39- return "${" + keyword + "}" ;
40- }
41- else {
42- return "\\$\{" + keyword + "\}" ;
43- }
44- }
45-
46- function CreateLaunchString ( name : string , type : string , executable : string , isInitialConfiguration : boolean ) : string {
34+ function CreateLaunchString ( name : string , type : string , executable : string ) : string {
4735 return `"name": "${ name } ",
4836"type": "${ type } ",
4937"request": "launch",
50- "program": "${ "enter program name, for example " + EnsureTokensEscapedInLaunchJsonMacro ( " workspaceFolder" , isInitialConfiguration ) + "/" + executable } ",
38+ "program": "${ "enter program name, for example " + "$\{ workspaceFolder\}" + "/" + executable } ",
5139"args": [],
5240"stopAtEntry": false,
53- "cwd": \" ${ EnsureTokensEscapedInLaunchJsonMacro ( " workspaceFolder" , isInitialConfiguration ) } \ ",
41+ "cwd": "$\{ workspaceFolder\} ",
5442"environment": [],
5543"externalConsole": true
5644`
@@ -61,17 +49,17 @@ function CreateAttachString(name: string, type: string, executable: string): str
6149"name": "${ name } ",
6250"type": "${ type } ",
6351"request": "attach",{0}
64- "processId": \"\\ $\{command:pickProcess\}\ "
65- ` , [ type === "cppdbg" ? `${ os . EOL } "program": "${ "enter program name, for example \\ $\{workspaceFolder\}/" + executable } ",` : "" ] ) ;
52+ "processId": " $\{command:pickProcess\}"
53+ ` , [ type === "cppdbg" ? `${ os . EOL } "program": "${ "enter program name, for example $\{workspaceFolder\}/" + executable } ",` : "" ] ) ;
6654 }
6755
6856function CreateRemoteAttachString ( name : string , type : string , executable : string ) : string {
6957 return `
7058"name": "${ name } ",
7159"type": "${ type } ",
7260"request": "attach",
73- "program": "${ "enter program name, for example \\ $\{workspaceFolder\}/" + executable } ",
74- "processId": \"\\ $\{command:pickRemoteProcess\}\ "
61+ "program": "${ "enter program name, for example $\{workspaceFolder\}/" + executable } ",
62+ "processId": " $\{command:pickRemoteProcess\}"
7563` ;
7664 }
7765
@@ -86,7 +74,7 @@ function CreateRemoteAttachString(name: string, type: string, executable: string
8674 }
8775
8876export interface IConfiguration {
89- GetLaunchConfiguration ( isInitialConfiguration : boolean ) : IConfigurationSnippet ;
77+ GetLaunchConfiguration ( ) : IConfigurationSnippet ;
9078 GetAttachConfiguration ( ) : IConfigurationSnippet ;
9179}
9280
@@ -108,17 +96,17 @@ abstract class Configuration implements IConfiguration {
10896 this . additionalProperties = additionalProperties ;
10997 }
11098
111- abstract GetLaunchConfiguration ( isInitialConfiguration : boolean ) : IConfigurationSnippet ;
99+ abstract GetLaunchConfiguration ( ) : IConfigurationSnippet ;
112100 abstract GetAttachConfiguration ( ) : IConfigurationSnippet ;
113101}
114102
115103export class MIConfigurations extends Configuration {
116104
117- public GetLaunchConfiguration ( isInitialConfiguration : boolean ) : IConfigurationSnippet {
105+ public GetLaunchConfiguration ( ) : IConfigurationSnippet {
118106 let name : string = `(${ this . MIMode } ) Launch` ;
119107
120108 let body : string = formatString ( `{
121- \t${ indentJsonString ( CreateLaunchString ( name , this . miDebugger , this . executable , isInitialConfiguration ) ) } ,
109+ \t${ indentJsonString ( CreateLaunchString ( name , this . miDebugger , this . executable ) ) } ,
122110\t"MIMode": "${ this . MIMode } "{0}{1}
123111}` , [ this . miDebugger === "cppdbg" && os . platform ( ) === "win32" ? `,${ os . EOL } \t"miDebuggerPath": "/path/to/gdb"` : "" ,
124112this . additionalProperties ? `,${ os . EOL } \t${ indentJsonString ( this . additionalProperties ) } ` : "" ] ) ;
@@ -152,12 +140,12 @@ this.additionalProperties ? `,${os.EOL}\t${indentJsonString(this.additionalPrope
152140
153141export class PipeTransportConfigurations extends Configuration {
154142
155- public GetLaunchConfiguration ( isInitialConfiguration : boolean ) : IConfigurationSnippet {
143+ public GetLaunchConfiguration ( ) : IConfigurationSnippet {
156144 let name : string = `(${ this . MIMode } ) Pipe Launch` ;
157145
158146 let body : string = formatString ( `
159147{
160- \t${ indentJsonString ( CreateLaunchString ( name , this . miDebugger , this . executable , isInitialConfiguration ) ) } ,
148+ \t${ indentJsonString ( CreateLaunchString ( name , this . miDebugger , this . executable ) ) } ,
161149\t${ indentJsonString ( CreatePipeTransportString ( this . pipeProgram , this . MIMode ) ) } ,
162150\t"MIMode": "${ this . MIMode } "{0}
163151}` , [ this . additionalProperties ? `,${ os . EOL } \t${ indentJsonString ( this . additionalProperties ) } ` : "" ] ) ;
@@ -192,12 +180,12 @@ export class PipeTransportConfigurations extends Configuration {
192180
193181export class WindowsConfigurations extends Configuration {
194182
195- public GetLaunchConfiguration ( isInitialConfiguration : boolean ) : IConfigurationSnippet {
183+ public GetLaunchConfiguration ( ) : IConfigurationSnippet {
196184 let name = "(Windows) Launch" ;
197185
198186 let body : string = `
199187{
200- \t${ indentJsonString ( CreateLaunchString ( name , this . windowsDebugger , this . executable , isInitialConfiguration ) ) }
188+ \t${ indentJsonString ( CreateLaunchString ( name , this . windowsDebugger , this . executable ) ) }
201189}` ;
202190
203191 return {
@@ -229,14 +217,14 @@ export class WindowsConfigurations extends Configuration {
229217}
230218
231219export class WSLConfigurations extends Configuration {
232- public bashPipeProgram = "C:\\\\\\\\ Windows\\\\\\\\ sysnative\\\\ \\\\bash.exe" ;
220+ public bashPipeProgram = "C:\\\\Windows\\\\sysnative\\\\bash.exe" ;
233221
234- public GetLaunchConfiguration ( isInitialConfiguration : boolean ) : IConfigurationSnippet {
222+ public GetLaunchConfiguration ( ) : IConfigurationSnippet {
235223 let name : string = `(${ this . MIMode } ) Bash on Windows Launch` ;
236224
237225 let body : string = formatString ( `
238226{
239- \t${ indentJsonString ( CreateLaunchString ( name , this . miDebugger , this . executable , isInitialConfiguration ) ) } ,
227+ \t${ indentJsonString ( CreateLaunchString ( name , this . miDebugger , this . executable ) ) } ,
240228\t${ indentJsonString ( CreatePipeTransportString ( this . bashPipeProgram , this . MIMode ) ) } {0}
241229}` , [ this . additionalProperties ? `,${ os . EOL } \t${ indentJsonString ( this . additionalProperties ) } ` : "" ] ) ;
242230
0 commit comments