Archived
1
0
This repository has been archived on 2024-09-09. You can view files and clone it, but cannot push or open issues or pull requests.
code-server/patches/cli-window-open.diff

35 lines
1.3 KiB
Diff
Raw Normal View History

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
5. Run code-server with a file or directory argument
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
@@ -99,10 +99,14 @@ class RemoteTerminalBackend extends Base
}
const reqId = e.reqId;
const commandId = e.commandId;
+ const terminalId = e.persistentProcessId;
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);