Skip to content

Commit 7547cdd

Browse files
roblourensweinand
authored andcommitted
add property for controlling escaping arguments for the runInTerminal request (#305)
Fixes #146
1 parent fb7445b commit 7547cdd

File tree

5 files changed

+36
-7
lines changed

5 files changed

+36
-7
lines changed

changelog.md

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ sectionid: changelog
66

77
#### All notable changes to the specification will be documented in this file.
88

9+
* 1.57.X:
10+
* Add the `argsCanBeInterpretedByShell` property to the `RunInTerminalRequest`
11+
912
* 1.56.X:
1013
* Add additional information to the `StepInTarget`
1114
* Clarification around wording for "clients"

debugAdapterProtocol.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@
734734
"allOf": [ { "$ref": "#/definitions/Request" }, {
735735
"type": "object",
736736
"title": "Reverse Requests",
737-
"description": "This optional request is sent from the debug adapter to the client to run a command in a terminal.\nThis is typically used to launch the debuggee in a terminal provided by the client.\nThis request should only be called if the corresponding capability `supportsRunInTerminalRequest` is true.",
737+
"description": "This optional request is sent from the debug adapter to the client to run a command in a terminal.\nThis is typically used to launch the debuggee in a terminal provided by the client.\nThis request should only be called if the corresponding capability `supportsRunInTerminalRequest` is true.\nClient implementations of `runInTerminal` are free to run the command however they choose including issuing the command to a command line interpreter (aka 'shell'). Argument strings passed to the `runInTerminal` request must arrive verbatim in the command to be run. As a consequence, clients which use a shell are responsible for escaping any special shell characters in the argument strings to prevent them from being interpreted (and modified) by the shell.\nSome users may wish to take advantage of shell processing in the argument strings. For clients which implement `runInTerminal` using an intermediary shell, the `argsCanBeInterpretedByShell` property can be set to true. In this case the client is requested not to escape any special shell characters in the argument strings.",
738738
"properties": {
739739
"command": {
740740
"type": "string",
@@ -778,6 +778,10 @@
778778
"type": [ "string", "null" ],
779779
"description": "Proper values must be strings. A value of `null` removes the variable from the environment."
780780
}
781+
},
782+
"argsCanBeInterpretedByShell": {
783+
"type": "boolean",
784+
"description": "This property should only be set if the client has passed the value true for the 'supportsArgsCanBeInterpretedByShell' capability of the 'initialize' request. If the client uses an intermediary shell to launch the application, then the client must not attempt to escape characters with special meanings for the shell. The user is fully responsible for escaping as needed and that arguments using special characters may not be portable across shells."
781785
}
782786
},
783787
"required": [ "args", "cwd" ]
@@ -882,6 +886,10 @@
882886
"supportsMemoryEvent": {
883887
"type": "boolean",
884888
"description": "Client supports the memory event."
889+
},
890+
"supportsArgsCanBeInterpretedByShell": {
891+
"type": "boolean",
892+
"description": "Client supports the 'argsCanBeInterpretedByShell' attribute on the 'runInTerminal' request."
885893
}
886894
},
887895
"required": [ "adapterID" ]

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ <h1 class="text-center"><i class="fa fa-cogs" aria-hidden="true"></i></h1>
8686
<h1 class="text-center"><i class="fas fa-book" aria-hidden="true"></i></h1>
8787
<a href='{{ "/specification" | prepend: site.baseurl }}'><h3 class="text-center">Specification</h3></a>
8888
<p>
89-
The latest version of the protocol specification is version 1.56.0.
89+
The latest version of the protocol specification is version 1.57.0.
9090
</p>
9191
<p>
9292
<a href='{{ "/changelog" | prepend: site.baseurl }}'>Change History</a>

overview.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,8 @@ It is not necessary to return an explicit `false` for unsupported capabilities.
130130
After the debug adapter has been initialized, it is ready to accept requests for starting debugging.
131131
Two requests exist for this:
132132
- [**launch**](./specification#Requests_Launch) request: the debug adapter launches the program ("debuggee") in debug mode and then starts to communicate with it.
133-
Since the debug adapter is responsible for the debuggee, it should provide options for the end user to interact with the debuggee.
134-
Basically there are three options how the debuggee can be launched. Two of the options are available to the debug adapter via the [**RunInTerminal**](./specification#Reverse_Requests_RunInTerminal) request.
135-
- the **_debug console_**: this is an interactive REPL environment which allows the user to evaluate expressions in the context of the debuggee. Program output shows up in the debug console too, but the program cannot read input through it (because of the REPL functionality).
136-
- an **_integrated terminal_**: this is a terminal emulator integrated in the development tool. It supports the usual terminal control codes and supports reading program input.
137-
- in an **_external terminal_**: similar to the integrated terminal, but the terminal runs outside of the development tool.
133+
Since the debug adapter is responsible for launching the debuggee, it should provide a mechanism for the end user to configure the debuggee. For example, passing arguments or specifying a working directory.
134+
- Debug adapters are free to launch the debuggee however they choose. Typically the debuggee is launched as a child process and its output channels are connected to a client's debug console via [**output**](./specification.md#Events_Output) events. However, this has certain limitations, such as not being able to write to the terminal device directly and not being able to accept standard input. For those cases, launching the debuggee in a terminal is preferable. A debug adapter can use the the [**runInTerminal**](./specification#Reverse_Requests_RunInTerminal) request to ask the client to launch the debuggee in a terminal that is integrated into the client or in a terminal that runs outside of the client (but still configured and managed from the client).
138135
- [**attach**](./specification#Requests_Attach) request: the debug adapter connects to an already running program. Here the end user is responsible for launching and terminating the program.
139136

140137
Since arguments for both requests are highly dependent on a specific debugger and debug adapter implementation, the Debug Adapter Protocol does not specify any arguments for these requests.

specification.md

+21
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,10 @@ This is typically used to launch the debuggee in a terminal provided by the clie
796796

797797
This request should only be called if the client has passed the value true for the 'supportsRunInTerminalRequest' capability of the 'initialize' request.
798798

799+
Client implementations of runInTerminal are free to run the command however they choose including issuing the command to a command line interpreter (aka 'shell'). Argument strings passed to the runInTerminal request must arrive verbatim in the command to be run. As a consequence, clients which use a shell are responsible for escaping any special shell characters in the argument strings to prevent them from being interpreted (and modified) by the shell
800+
801+
Some users may wish to take advantage of shell processing in the argument strings. For clients which implement runInTerminal using an intermediary shell, the 'argsCanBeInterpretedByShell' property can be set to true. In this case the client is requested not to escape any special shell characters in the argument strings.
802+
799803
```typescript
800804
interface RunInTerminalRequest extends Request {
801805
command: 'runInTerminal';
@@ -836,6 +840,17 @@ interface RunInTerminalRequestArguments {
836840
* environment.
837841
*/
838842
env?: { [key: string]: string | null; };
843+
844+
/**
845+
* This property should only be set if the client has passed the value true
846+
* for the 'supportsArgsCanBeInterpretedByShell' capability of the
847+
* 'initialize' request. If the client uses an intermediary shell to launch
848+
* the application, then the client must not attempt to escape characters with
849+
* special meanings for the shell. The user is fully responsible for escaping
850+
* as needed and that arguments using special characters may not be portable
851+
* across shells.
852+
*/
853+
argsCanBeInterpretedByShell?: boolean;
839854
}
840855
```
841856

@@ -956,6 +971,12 @@ interface InitializeRequestArguments {
956971
* Client supports the memory event.
957972
*/
958973
supportsMemoryEvent?: boolean;
974+
975+
/**
976+
* Client supports the 'argsCanBeInterpretedByShell' attribute on the
977+
* 'runInTerminal' request.
978+
*/
979+
supportsArgsCanBeInterpretedByShell?: boolean;
959980
}
960981
```
961982

0 commit comments

Comments
 (0)