Skip to content

Commit 1109f93

Browse files
author
Loïc Mangeonjean
committed
fix: fix terminals
1 parent 9533af6 commit 1109f93

File tree

2 files changed

+38
-5
lines changed

2 files changed

+38
-5
lines changed

demo/src/features/terminal.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import ansiColors from 'ansi-colors'
33
import * as vscode from 'vscode'
44

55
export class TerminalBackend extends SimpleTerminalBackend {
6-
getDefaultSystemShell = async (): Promise<string> => 'fake'
7-
createProcess = async (): Promise<ITerminalChildProcess> => {
6+
override getDefaultSystemShell = async (): Promise<string> => 'fake'
7+
override createProcess = async (): Promise<ITerminalChildProcess> => {
88
const dataEmitter = new vscode.EventEmitter<string>()
99
const propertyEmitter = new vscode.EventEmitter<{
1010
type: string
@@ -23,13 +23,13 @@ export class TerminalBackend extends SimpleTerminalBackend {
2323
return undefined
2424
}
2525

26-
onDidChangeProperty = propertyEmitter.event
26+
override onDidChangeProperty = propertyEmitter.event
2727

28-
shutdown (immediate: boolean): void {
28+
override shutdown (immediate: boolean): void {
2929
console.log('shutdown', immediate)
3030
}
3131

32-
input (data: string): void {
32+
override input (data: string): void {
3333
for (const c of data) {
3434
if (c.charCodeAt(0) === 13) {
3535
dataEmitter.fire(`\r\n${ansiColors.green('$')} `)
@@ -49,6 +49,9 @@ export class TerminalBackend extends SimpleTerminalBackend {
4949
resize (cols: number, rows: number): void {
5050
console.log('resize', cols, rows)
5151
}
52+
53+
override clearBuffer (): void | Promise<void> {
54+
}
5255
}
5356
return new FakeTerminalProcess(1, 1, '/tmp', dataEmitter.event)
5457
}

scripts/vscode.patch

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,36 @@ index ff766b9acb8..599bab9dd59 100644
690690
}
691691

692692
isVisible(): boolean {
693+
diff --git a/src/vs/workbench/contrib/terminal/browser/terminalService.ts b/src/vs/workbench/contrib/terminal/browser/terminalService.ts
694+
index 34b62b8fb2b..66d4b7bb70f 100644
695+
--- a/src/vs/workbench/contrib/terminal/browser/terminalService.ts
696+
+++ b/src/vs/workbench/contrib/terminal/browser/terminalService.ts
697+
@@ -19,7 +19,7 @@ import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/c
698+
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
699+
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
700+
import { INotificationService } from 'vs/platform/notification/common/notification';
701+
-import { ICreateContributedTerminalProfileOptions, IPtyHostAttachTarget, IRawTerminalInstanceLayoutInfo, IRawTerminalTabLayoutInfo, IShellLaunchConfig, ITerminalBackend, ITerminalLaunchError, ITerminalLogService, ITerminalsLayoutInfo, ITerminalsLayoutInfoById, TerminalExitReason, TerminalLocation, TerminalLocationString, TitleEventSource } from 'vs/platform/terminal/common/terminal';
702+
+import { ICreateContributedTerminalProfileOptions, IPtyHostAttachTarget, IRawTerminalInstanceLayoutInfo, IRawTerminalTabLayoutInfo, IShellLaunchConfig, ITerminalBackend, ITerminalBackendRegistry, ITerminalLaunchError, ITerminalLogService, ITerminalsLayoutInfo, ITerminalsLayoutInfoById, TerminalExitReason, TerminalExtensions, TerminalLocation, TerminalLocationString, TitleEventSource } from 'vs/platform/terminal/common/terminal';
703+
import { formatMessageForTerminal } from 'vs/platform/terminal/common/terminalStrings';
704+
import { iconForeground } from 'vs/platform/theme/common/colorRegistry';
705+
import { getIconRegistry } from 'vs/platform/theme/common/iconRegistry';
706+
@@ -52,6 +52,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
707+
import { TerminalCapabilityStore } from 'vs/platform/terminal/common/capabilities/terminalCapabilityStore';
708+
import { ITimerService } from 'vs/workbench/services/timer/browser/timerService';
709+
import { mark } from 'vs/base/common/performance';
710+
+import { Registry } from 'vs/platform/registry/common/platform';
711+
712+
export class TerminalService implements ITerminalService {
713+
declare _serviceBrand: undefined;
714+
@@ -213,7 +214,7 @@ export class TerminalService implements ITerminalService {
715+
this._handleInstanceContextKeys();
716+
this._terminalShellTypeContextKey = TerminalContextKeys.shellType.bindTo(this._contextKeyService);
717+
this._processSupportContextKey = TerminalContextKeys.processSupported.bindTo(this._contextKeyService);
718+
- this._processSupportContextKey.set(!isWeb || this._remoteAgentService.getConnection() !== null);
719+
+ this._processSupportContextKey.set(!isWeb || this._remoteAgentService.getConnection() !== null || Registry.as<ITerminalBackendRegistry>(TerminalExtensions.Backend).getTerminalBackend() !== undefined);
720+
this._terminalHasBeenCreated = TerminalContextKeys.terminalHasBeenCreated.bindTo(this._contextKeyService);
721+
this._terminalCountContextKey = TerminalContextKeys.count.bindTo(this._contextKeyService);
722+
this._terminalEditorActive = TerminalContextKeys.terminalEditorActive.bindTo(this._contextKeyService);
693723
diff --git a/src/vs/workbench/contrib/webview/browser/pre/service-worker.js b/src/vs/workbench/contrib/webview/browser/pre/service-worker.js
694724
index a6e9943b866..c470a1c9ed5 100644
695725
--- a/src/vs/workbench/contrib/webview/browser/pre/service-worker.js

0 commit comments

Comments
 (0)