Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShellIIntegration: TerminalRenderer's content not show while remote resolver runs #144729

Closed
chrmarti opened this issue Mar 9, 2022 · 2 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority insiders-released Patch has been released in VS Code Insiders remote Remote system operations issues terminal-shell-integration Shell integration, command decorations, etc. verified Verification succeeded
Milestone

Comments

@chrmarti
Copy link
Contributor

chrmarti commented Mar 9, 2022

With "terminal.integrated.shellIntegration.enabled": true I don't see the content in the Pseudoterminal of Remote-Containers' log terminal until the remote resolver has finished.

Version: 1.66.0-insider
Commit: 92f4bd7
Date: 2022-03-08T14:57:46.123Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 20.6.0

@meganrogge meganrogge added the terminal-shell-integration Shell integration, command decorations, etc. label Mar 9, 2022
@Tyriar Tyriar added this to the April 2022 milestone Mar 31, 2022
@Tyriar Tyriar added bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority remote Remote system operations issues labels Mar 31, 2022
@Tyriar
Copy link
Member

Tyriar commented Mar 31, 2022

This is certainly related to awaiting the backend when launching terminals that don't need it:

https://github.com/Microsoft/vscode/blob/a57c64f9c0e589d9cd8d1580109194e19b7f346d/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts#L447-L448

@Tyriar
Copy link
Member

Tyriar commented Mar 31, 2022

Repro in OSS:

Add the following to the top of vscode-test-resolver's activation function:

	const writeEmitter = new vscode.EventEmitter<string>();
	let line = '';
	const pty = {
		onDidWrite: writeEmitter.event,
		open: () => writeEmitter.fire('Type and press enter to echo the text\r\n\r\n'),
		close: () => { /* noop*/ },
		handleInput: (data: string) => {
			if (data === '\r') { // Enter
				writeEmitter.fire(`\r\necho: "${colorText(line)}"\r\n\n`);
				line = '';
				return;
			}
			if (data === '\x7f') { // Backspace
				if (line.length === 0) {
					return;
				}
				line = line.substr(0, line.length - 1);
				// Move cursor backward
				writeEmitter.fire('\x1b[D');
				// Delete character
				writeEmitter.fire('\x1b[P');
				return;
			}
			line += data;
			writeEmitter.fire(data);
		}
	};
	const terminal = (<any>vscode.window).createTerminal({ name: `My Extension REPL`, pty });
	terminal.show();
	function colorText(text: string): string {
		let output = '';
		let colorIndex = 1;
		for (let i = 0; i < text.length; i++) {
			const char = text.charAt(i);
			if (char === ' ' || char === '\r' || char === '\n') {
				output += char;
			} else {
				output += `\x1b[3${colorIndex++}m${text.charAt(i)}\x1b[0m`;
				if (colorIndex > 6) {
					colorIndex = 1;
				}
			}
		}
		return output;
	}

Replace the res call in vscode-test-resolver with:

							setTimeout(() => {
								res(new vscode.ResolvedAuthority('127.0.0.1', parseInt(match[1], 10), connectionToken)); // success!
							}, 10000);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority insiders-released Patch has been released in VS Code Insiders remote Remote system operations issues terminal-shell-integration Shell integration, command decorations, etc. verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants
@Tyriar @connor4312 @chrmarti @meganrogge and others