Skip to content

Commit

Permalink
add private update dev mode function
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge committed Aug 15, 2023
1 parent 39b7db4 commit e983119
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/tsconfig.monaco.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"vs/platform/files/browser/htmlFileSystemProvider.ts",
"vs/platform/files/browser/webFileSystemAccess.ts",
"vs/platform/telemetry/*",
"vs/platform/assignment/*"
"vs/platform/assignment/*",
"vs/platform/terminal/*"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import type { Terminal } from 'xterm';

class TextAreaSyncContribution extends DisposableStore implements ITerminalContribution {
static readonly ID = 'terminal.textAreaSync';
private _xterm: IXtermTerminal & { raw: Terminal } | undefined;
static get(instance: ITerminalInstance): TextAreaSyncContribution | null {
return instance.getContribution<TextAreaSyncContribution>(TextAreaSyncContribution.ID);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ registerTerminalAction({

class DevModeContribution extends DisposableStore implements ITerminalContribution {
static readonly ID = 'terminal.devMode';
devModeClass = 'dev-mode';
private _xterm: IXtermTerminal & { raw: Terminal } | undefined;
static get(instance: ITerminalInstance): DevModeContribution | null {
return instance.getContribution<DevModeContribution>(DevModeContribution.ID);
Expand All @@ -123,16 +122,18 @@ class DevModeContribution extends DisposableStore implements ITerminalContributi
super();
this.add(this._configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration(TerminalSettingId.DevMode)) {
const devMode: boolean = this._configurationService.getValue(TerminalSettingId.DevMode) || false;
this._xterm?.raw.element?.classList.toggle(this.devModeClass, devMode);
this._updateDevMode();
}
}));
}
xtermReady(xterm: IXtermTerminal & { raw: Terminal }): void {
this._xterm = xterm;
if (this._configurationService.getValue(TerminalSettingId.DevMode)) {
this._xterm.raw.element?.classList.add(this.devModeClass);
}
this._updateDevMode();
}

private _updateDevMode() {
const devMode: boolean = this._configurationService.getValue(TerminalSettingId.DevMode) || false;
this._xterm?.raw.element?.classList.toggle('dev-mode', devMode);
}
}
registerTerminalContribution(DevModeContribution.ID, DevModeContribution);

0 comments on commit e983119

Please sign in to comment.