提交 87251319 编写于 作者: D Daniel Imms

Support experimental webgl renderer

上级 a7fcd5c8
......@@ -23,6 +23,7 @@
"xterm": "4.3.0-beta11",
"xterm-addon-search": "0.4.0-beta4",
"xterm-addon-web-links": "0.2.1",
"xterm-addon-webgl": "0.4.0-beta2",
"yauzl": "^2.9.2",
"yazl": "^2.4.3"
},
......
......@@ -7,6 +7,7 @@
"vscode-textmate": "^4.3.0",
"xterm": "4.3.0-beta11",
"xterm-addon-search": "0.4.0-beta4",
"xterm-addon-web-links": "0.2.1"
"xterm-addon-web-links": "0.2.1",
"xterm-addon-webgl": "0.4.0-beta2"
}
}
......@@ -41,6 +41,11 @@ xterm-addon-web-links@0.2.1:
resolved "https://registry.yarnpkg.com/xterm-addon-web-links/-/xterm-addon-web-links-0.2.1.tgz#6d1f2ce613e09870badf17615e7a1170a31542b2"
integrity sha512-2KnHtiq0IG7hfwv3jw2/jQeH1RBk2d5CH4zvgwQe00rLofSJqSfgnJ7gwowxxpGHrpbPr6Lv4AmH/joaNw2+HQ==
xterm-addon-webgl@0.4.0-beta2:
version "0.4.0-beta2"
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.4.0-beta2.tgz#3384a46b8b0856d2b5dc1a6f6724cfc4119de327"
integrity sha512-yFwMdC5L4PMDmzWV3DJYV1APeGOAcLdFblMRvJRuMzPba25jGmEg0Zg84O/oJ1sg2bjD3mzVA/C0ENn7bpKgHw==
xterm@4.3.0-beta11:
version "4.3.0-beta11"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.3.0-beta11.tgz#6be833d3fbebf3f7945ccc79ffb7d8811b31aa4e"
......
......@@ -428,6 +428,11 @@ xterm-addon-web-links@0.2.1:
resolved "https://registry.yarnpkg.com/xterm-addon-web-links/-/xterm-addon-web-links-0.2.1.tgz#6d1f2ce613e09870badf17615e7a1170a31542b2"
integrity sha512-2KnHtiq0IG7hfwv3jw2/jQeH1RBk2d5CH4zvgwQe00rLofSJqSfgnJ7gwowxxpGHrpbPr6Lv4AmH/joaNw2+HQ==
xterm-addon-webgl@0.4.0-beta2:
version "0.4.0-beta2"
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.4.0-beta2.tgz#3384a46b8b0856d2b5dc1a6f6724cfc4119de327"
integrity sha512-yFwMdC5L4PMDmzWV3DJYV1APeGOAcLdFblMRvJRuMzPba25jGmEg0Zg84O/oJ1sg2bjD3mzVA/C0ENn7bpKgHw==
xterm@4.3.0-beta11:
version "4.3.0-beta11"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.3.0-beta11.tgz#6be833d3fbebf3f7945ccc79ffb7d8811b31aa4e"
......
......@@ -32,6 +32,7 @@
'xterm': `${window.location.origin}/static/remote/web/node_modules/xterm/lib/xterm.js`,
'xterm-addon-search': `${window.location.origin}/static/remote/web/node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
'xterm-addon-web-links': `${window.location.origin}/static/remote/web/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js`,
'xterm-addon-webgl': `${window.location.origin}/static/remote/web/node_modules/xterm-addon-webgl/lib/xterm-addon-webgl.js`,
'semver-umd': `${window.location.origin}/static/remote/web/node_modules/semver-umd/lib/semver-umd.js`,
}
};
......
......@@ -36,6 +36,7 @@
'xterm': `${window.location.origin}/static/node_modules/xterm/lib/xterm.js`,
'xterm-addon-search': `${window.location.origin}/static/node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
'xterm-addon-web-links': `${window.location.origin}/static/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js`,
'xterm-addon-webgl': `${window.location.origin}/static/node_modules/xterm-addon-webgl/lib/xterm-addon-webgl.js`,
'semver-umd': `${window.location.origin}/static/node_modules/semver-umd/lib/semver-umd.js`,
}
};
......
......@@ -209,11 +209,12 @@ configurationRegistry.registerConfiguration({
},
'terminal.integrated.rendererType': {
type: 'string',
enum: ['auto', 'canvas', 'dom'],
enum: ['auto', 'canvas', 'dom', 'webgl'],
enumDescriptions: [
nls.localize('terminal.integrated.rendererType.auto', "Let VS Code guess which renderer to use."),
nls.localize('terminal.integrated.rendererType.canvas', "Use the standard GPU/canvas-based renderer"),
nls.localize('terminal.integrated.rendererType.dom', "Use the fallback DOM-based renderer.")
nls.localize('terminal.integrated.rendererType.canvas', "Use the standard GPU/canvas-based renderer."),
nls.localize('terminal.integrated.rendererType.dom', "Use the fallback DOM-based renderer."),
nls.localize('terminal.integrated.rendererType.experimentalWebgl', "Use the experimental webgl-based renderer. Note that this has some [known issues](https://github.com/xtermjs/xterm.js/issues?q=is%3Aopen+is%3Aissue+label%3Aarea%2Faddon%2Fwebgl) and this will only be enabled for new terminals (not hot swappable like the other renderers).")
],
default: 'auto',
description: nls.localize('terminal.integrated.rendererType', "Controls how the terminal is rendered.")
......
......@@ -6,6 +6,7 @@
import { Terminal as XTermTerminal } from 'xterm';
import { WebLinksAddon as XTermWebLinksAddon } from 'xterm-addon-web-links';
import { SearchAddon as XTermSearchAddon } from 'xterm-addon-search';
import { WebglAddon as XTermWebglAddon } from 'xterm-addon-webgl';
import { IWindowsShellHelper, ITerminalConfigHelper, ITerminalChildProcess, IShellLaunchConfig, IDefaultShellAndArgsRequest, ISpawnExtHostProcessRequest, IStartExtensionTerminalRequest, IAvailableShellsRequest, ITerminalProcessExtHostProxy, ICommandTracker, INavigationMode, TitleEventSource, ITerminalDimensions } from 'vs/workbench/contrib/terminal/common/terminal';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IProcessEnvironment, Platform } from 'vs/base/common/platform';
......@@ -31,6 +32,7 @@ export interface ITerminalInstanceService {
getXtermConstructor(): Promise<typeof XTermTerminal>;
getXtermWebLinksConstructor(): Promise<typeof XTermWebLinksAddon>;
getXtermSearchConstructor(): Promise<typeof XTermSearchAddon>;
getXtermWebglConstructor(): Promise<typeof XTermWebglAddon>;
createWindowsShellHelper(shellProcessId: number, instance: ITerminalInstance, xterm: XTermTerminal): IWindowsShellHelper;
createTerminalProcess(shellLaunchConfig: IShellLaunchConfig, cwd: string, cols: number, rows: number, env: IProcessEnvironment, windowsEnableConpty: boolean): ITerminalChildProcess;
......
......@@ -471,7 +471,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
fastScrollModifier: 'alt',
fastScrollSensitivity: editorOptions.fastScrollSensitivity,
scrollSensitivity: editorOptions.mouseWheelScrollSensitivity,
rendererType: config.rendererType === 'auto' ? 'canvas' : config.rendererType
rendererType: config.rendererType === 'auto' || config.rendererType === 'webgl' ? 'canvas' : config.rendererType
});
this._xterm = xterm;
this._xtermCore = (xterm as any)._core as XTermCore;
......@@ -568,6 +568,11 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
this._wrapperElement.appendChild(this._xtermElement);
this._container.appendChild(this._wrapperElement);
xterm.open(this._xtermElement);
if (this._configHelper.config.rendererType === 'webgl') {
this._terminalInstanceService.getXtermWebglConstructor().then(Addon => {
xterm.loadAddon(new Addon());
});
}
if (!xterm.element || !xterm.textarea) {
throw new Error('xterm elements not set after open');
......
......@@ -8,6 +8,7 @@ import { IWindowsShellHelper, ITerminalChildProcess, IDefaultShellAndArgsRequest
import { Terminal as XTermTerminal } from 'xterm';
import { WebLinksAddon as XTermWebLinksAddon } from 'xterm-addon-web-links';
import { SearchAddon as XTermSearchAddon } from 'xterm-addon-search';
import { WebglAddon as XTermWebglAddon } from 'xterm-addon-webgl';
import { IProcessEnvironment } from 'vs/base/common/platform';
import { Emitter, Event } from 'vs/base/common/event';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
......@@ -15,6 +16,7 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
let Terminal: typeof XTermTerminal;
let WebLinksAddon: typeof XTermWebLinksAddon;
let SearchAddon: typeof XTermSearchAddon;
let WebglAddon: typeof XTermWebglAddon;
export class TerminalInstanceService implements ITerminalInstanceService {
public _serviceBrand: undefined;
......@@ -43,6 +45,13 @@ export class TerminalInstanceService implements ITerminalInstanceService {
return SearchAddon;
}
public async getXtermWebglConstructor(): Promise<typeof XTermWebglAddon> {
if (!WebglAddon) {
WebglAddon = (await import('xterm-addon-webgl')).WebglAddon;
}
return WebglAddon;
}
public createWindowsShellHelper(): IWindowsShellHelper {
throw new Error('Not implemented');
}
......
......@@ -87,7 +87,7 @@ export interface ITerminalConfiguration {
};
macOptionIsMeta: boolean;
macOptionClickForcesSelection: boolean;
rendererType: 'auto' | 'canvas' | 'dom';
rendererType: 'auto' | 'canvas' | 'dom' | 'webgl';
rightClickBehavior: 'default' | 'copyPaste' | 'paste' | 'selectWord';
cursorBlinking: boolean;
cursorStyle: string;
......
......@@ -13,6 +13,7 @@ import { getSystemShell } from 'vs/workbench/contrib/terminal/node/terminal';
import { Terminal as XTermTerminal } from 'xterm';
import { WebLinksAddon as XTermWebLinksAddon } from 'xterm-addon-web-links';
import { SearchAddon as XTermSearchAddon } from 'xterm-addon-search';
import { WebglAddon as XTermWebglAddon } from 'xterm-addon-webgl';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { getDefaultShell, getDefaultShellArgs } from 'vs/workbench/contrib/terminal/common/terminalEnvironment';
import { StorageScope, IStorageService } from 'vs/platform/storage/common/storage';
......@@ -25,6 +26,7 @@ import { ILogService } from 'vs/platform/log/common/log';
let Terminal: typeof XTermTerminal;
let WebLinksAddon: typeof XTermWebLinksAddon;
let SearchAddon: typeof XTermSearchAddon;
let WebglAddon: typeof XTermWebglAddon;
export class TerminalInstanceService implements ITerminalInstanceService {
public _serviceBrand: undefined;
......@@ -61,6 +63,13 @@ export class TerminalInstanceService implements ITerminalInstanceService {
return SearchAddon;
}
public async getXtermWebglConstructor(): Promise<typeof XTermWebglAddon> {
if (!WebglAddon) {
WebglAddon = (await import('xterm-addon-webgl')).WebglAddon;
}
return WebglAddon;
}
public createWindowsShellHelper(shellProcessId: number, instance: ITerminalInstance, xterm: XTermTerminal): IWindowsShellHelper {
return new WindowsShellHelper(shellProcessId, instance, xterm);
}
......
......@@ -46,6 +46,9 @@ class MockTerminalInstanceService implements ITerminalInstanceService {
getXtermSearchConstructor(): Promise<any> {
throw new Error('Method not implemented.');
}
getXtermWebglConstructor(): Promise<any> {
throw new Error('Method not implemented.');
}
createWindowsShellHelper(): any {
throw new Error('Method not implemented.');
}
......
......@@ -9352,6 +9352,11 @@ xterm-addon-web-links@0.2.1:
resolved "https://registry.yarnpkg.com/xterm-addon-web-links/-/xterm-addon-web-links-0.2.1.tgz#6d1f2ce613e09870badf17615e7a1170a31542b2"
integrity sha512-2KnHtiq0IG7hfwv3jw2/jQeH1RBk2d5CH4zvgwQe00rLofSJqSfgnJ7gwowxxpGHrpbPr6Lv4AmH/joaNw2+HQ==
xterm-addon-webgl@0.4.0-beta2:
version "0.4.0-beta2"
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.4.0-beta2.tgz#3384a46b8b0856d2b5dc1a6f6724cfc4119de327"
integrity sha512-yFwMdC5L4PMDmzWV3DJYV1APeGOAcLdFblMRvJRuMzPba25jGmEg0Zg84O/oJ1sg2bjD3mzVA/C0ENn7bpKgHw==
xterm@4.3.0-beta11:
version "4.3.0-beta11"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.3.0-beta11.tgz#6be833d3fbebf3f7945ccc79ffb7d8811b31aa4e"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册