@@ -96,7 +96,10 @@ class WebSocketTerminal implements vscode.Pseudoterminal {
9696 // eslint-disable-next-line no-control-regex
9797 private _colorsRegex = / \x1b [ ^ m ] * ?m / g;
9898
99- constructor ( private readonly _targetUri : vscode . Uri ) { }
99+ constructor (
100+ private readonly _targetUri : vscode . Uri ,
101+ private readonly _nsOverride ?: string
102+ ) { }
100103
101104 /** Hide the cursor, write `data` to the terminal, then show the cursor again. */
102105 private _hideCursorWrite ( data : string ) : void {
@@ -201,6 +204,7 @@ class WebSocketTerminal implements vscode.Pseudoterminal {
201204
202205 open ( initialDimensions ?: vscode . TerminalDimensions ) : void {
203206 const api = new AtelierAPI ( this . _targetUri ) ;
207+ if ( this . _nsOverride ) api . setNamespace ( this . _nsOverride ) ;
204208 this . _cols = initialDimensions ?. columns ?? 100000 ;
205209 try {
206210 // Open the WebSocket
@@ -728,7 +732,8 @@ function reportError(msg: string, throwErrors = false) {
728732function terminalConfigForUri (
729733 api : AtelierAPI ,
730734 targetUri : vscode . Uri ,
731- throwErrors = false
735+ throwErrors : boolean ,
736+ nsOverride ?: string
732737) : vscode . ExtensionTerminalOptions | undefined {
733738 // Make sure the server connection is active
734739 if ( ! api . active || api . ns == "" ) {
@@ -751,13 +756,13 @@ function terminalConfigForUri(
751756 vscode . window . terminals . length > 0
752757 ? vscode . TerminalLocation . Editor
753758 : vscode . TerminalLocation . Panel ,
754- pty : new WebSocketTerminal ( targetUri ) ,
759+ pty : new WebSocketTerminal ( targetUri , nsOverride ) ,
755760 isTransient : true ,
756761 iconPath : iscIcon ,
757762 } ;
758763}
759764
760- export async function launchWebSocketTerminal ( targetUri ?: vscode . Uri ) : Promise < void > {
765+ export async function launchWebSocketTerminal ( targetUri ?: vscode . Uri , nsOverride ?: string ) : Promise < void > {
761766 // Determine the server to connect to
762767 if ( targetUri ) {
763768 // Uri passed as command argument might be for a server we haven't yet resolved
@@ -779,7 +784,7 @@ export async function launchWebSocketTerminal(targetUri?: vscode.Uri): Promise<v
779784 await api . serverInfo ( ) ;
780785
781786 // Get the terminal configuration
782- const terminalOpts = terminalConfigForUri ( api , targetUri ) ;
787+ const terminalOpts = terminalConfigForUri ( api , targetUri , false , nsOverride ) ;
783788 if ( terminalOpts ) {
784789 // Launch the terminal
785790 const terminal = vscode . window . createTerminal ( terminalOpts ) ;
0 commit comments