@@ -96,7 +96,10 @@ class WebSocketTerminal implements vscode.Pseudoterminal {
96
96
// eslint-disable-next-line no-control-regex
97
97
private _colorsRegex = / \x1b [ ^ m ] * ?m / g;
98
98
99
- constructor ( private readonly _targetUri : vscode . Uri ) { }
99
+ constructor (
100
+ private readonly _targetUri : vscode . Uri ,
101
+ private readonly _nsOverride ?: string
102
+ ) { }
100
103
101
104
/** Hide the cursor, write `data` to the terminal, then show the cursor again. */
102
105
private _hideCursorWrite ( data : string ) : void {
@@ -201,6 +204,7 @@ class WebSocketTerminal implements vscode.Pseudoterminal {
201
204
202
205
open ( initialDimensions ?: vscode . TerminalDimensions ) : void {
203
206
const api = new AtelierAPI ( this . _targetUri ) ;
207
+ if ( this . _nsOverride ) api . setNamespace ( this . _nsOverride ) ;
204
208
this . _cols = initialDimensions ?. columns ?? 100000 ;
205
209
try {
206
210
// Open the WebSocket
@@ -728,7 +732,8 @@ function reportError(msg: string, throwErrors = false) {
728
732
function terminalConfigForUri (
729
733
api : AtelierAPI ,
730
734
targetUri : vscode . Uri ,
731
- throwErrors = false
735
+ throwErrors : boolean ,
736
+ nsOverride ?: string
732
737
) : vscode . ExtensionTerminalOptions | undefined {
733
738
// Make sure the server connection is active
734
739
if ( ! api . active || api . ns == "" ) {
@@ -751,13 +756,13 @@ function terminalConfigForUri(
751
756
vscode . window . terminals . length > 0
752
757
? vscode . TerminalLocation . Editor
753
758
: vscode . TerminalLocation . Panel ,
754
- pty : new WebSocketTerminal ( targetUri ) ,
759
+ pty : new WebSocketTerminal ( targetUri , nsOverride ) ,
755
760
isTransient : true ,
756
761
iconPath : iscIcon ,
757
762
} ;
758
763
}
759
764
760
- export async function launchWebSocketTerminal ( targetUri ?: vscode . Uri ) : Promise < void > {
765
+ export async function launchWebSocketTerminal ( targetUri ?: vscode . Uri , nsOverride ?: string ) : Promise < void > {
761
766
// Determine the server to connect to
762
767
if ( targetUri ) {
763
768
// 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
779
784
await api . serverInfo ( ) ;
780
785
781
786
// Get the terminal configuration
782
- const terminalOpts = terminalConfigForUri ( api , targetUri ) ;
787
+ const terminalOpts = terminalConfigForUri ( api , targetUri , false , nsOverride ) ;
783
788
if ( terminalOpts ) {
784
789
// Launch the terminal
785
790
const terminal = vscode . window . createTerminal ( terminalOpts ) ;
0 commit comments