2022-07-15 19:51:03 +03:00
|
|
|
Make opening files/folders from the terminal only open in the current instance
|
|
|
|
|
|
|
|
Previously they would open in every code-server tab/window.
|
|
|
|
|
|
|
|
To test:
|
|
|
|
|
|
|
|
1. Run code-server
|
|
|
|
2. Open code-server
|
|
|
|
3. Open terminal
|
|
|
|
4. Open another code-server window
|
2022-12-22 20:25:28 +03:00
|
|
|
5. Run node ./out/node/entry.js with a file or directory argument
|
2022-07-15 19:51:03 +03:00
|
|
|
|
|
|
|
The file or directory should only open from the instance attached to that
|
|
|
|
terminal.
|
|
|
|
|
|
|
|
Index: code-server/lib/vscode/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts
|
|
|
|
===================================================================
|
|
|
|
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts
|
|
|
|
+++ code-server/lib/vscode/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts
|
2023-09-21 02:33:28 +03:00
|
|
|
@@ -104,10 +104,14 @@ class RemoteTerminalBackend extends Base
|
2022-09-09 19:28:54 +03:00
|
|
|
}
|
2022-07-15 19:51:03 +03:00
|
|
|
const reqId = e.reqId;
|
|
|
|
const commandId = e.commandId;
|
2022-09-09 19:28:54 +03:00
|
|
|
+ const terminalId = e.persistentProcessId;
|
2022-07-15 19:51:03 +03:00
|
|
|
if (!allowedCommands.includes(commandId)) {
|
|
|
|
this._remoteTerminalChannel.sendCommandResult(reqId, true, 'Invalid remote cli command: ' + commandId);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
+ if (typeof terminalId !== "undefined" && !this._ptys.has(terminalId)) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
const commandArgs = e.commandArgs.map(arg => revive(arg));
|
|
|
|
try {
|
|
|
|
const result = await this._commandService.executeCommand(e.commandId, ...commandArgs);
|