mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Upgrade xterm.js, use new webLinks addon to allow dbl/tpl click on link
Fixes #41415
This commit is contained in:
parent
4b4e5ce84c
commit
3373b92ab7
|
@ -46,7 +46,7 @@
|
|||
"vscode-debugprotocol": "1.26.0",
|
||||
"vscode-ripgrep": "0.7.1-patch.0.1",
|
||||
"vscode-textmate": "^3.2.0",
|
||||
"vscode-xterm": "3.2.0-beta4",
|
||||
"vscode-xterm": "3.2.0-beta6",
|
||||
"yauzl": "2.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
1
src/typings/vscode-xterm.d.ts
vendored
1
src/typings/vscode-xterm.d.ts
vendored
|
@ -604,6 +604,7 @@ declare module 'vscode-xterm' {
|
|||
*/
|
||||
findPrevious(term: string): boolean;
|
||||
|
||||
webLinksInit(handler?: (event: MouseEvent, uri: string) => void, options?: ILinkMatcherOptions): void;
|
||||
winptyCompatInit(): void;
|
||||
}
|
||||
}
|
|
@ -267,9 +267,9 @@ export class TerminalInstance implements ITerminalInstance {
|
|||
protected async _createXterm(): TPromise<void> {
|
||||
if (!Terminal) {
|
||||
Terminal = (await import('vscode-xterm')).Terminal;
|
||||
// Enable search functionality in xterm.js instance
|
||||
// Enable xterm.js addons
|
||||
Terminal.applyAddon(require.__$__nodeRequire('vscode-xterm/lib/addons/search/search'));
|
||||
// Enable the winpty compatibility addon which will simulate wraparound mode
|
||||
Terminal.applyAddon(require.__$__nodeRequire('vscode-xterm/lib/addons/webLinks/webLinks'));
|
||||
Terminal.applyAddon(require.__$__nodeRequire('vscode-xterm/lib/addons/winptyCompat/winptyCompat'));
|
||||
// Localize strings
|
||||
Terminal.strings.blankLine = nls.localize('terminal.integrated.a11yBlankLine', 'Blank line');
|
||||
|
@ -312,7 +312,6 @@ export class TerminalInstance implements ITerminalInstance {
|
|||
return false;
|
||||
});
|
||||
this._linkHandler = this._instantiationService.createInstance(TerminalLinkHandler, this._xterm, platform.platform, this._initialCwd);
|
||||
this._linkHandler.registerLocalLinkHandler();
|
||||
this._instanceDisposables.push(this._themeService.onThemeChange(theme => this._updateTheme(theme)));
|
||||
}
|
||||
|
||||
|
|
|
@ -75,14 +75,8 @@ export class TerminalLinkHandler {
|
|||
const baseLocalLinkClause = _platform === platform.Platform.Windows ? winLocalLinkClause : unixLocalLinkClause;
|
||||
// Append line and column number regex
|
||||
this._localLinkPattern = new RegExp(`${baseLocalLinkClause}(${lineAndColumnClause})`);
|
||||
|
||||
this._xterm.setHypertextLinkHandler(this._wrapLinkHandler(uri => {
|
||||
this._handleHypertextLink(uri);
|
||||
}));
|
||||
|
||||
this._xterm.setHypertextValidationCallback((uri: string, callback: (isValid: boolean) => void) => {
|
||||
this._validateWebLink(uri, callback);
|
||||
});
|
||||
this.registerWebLinkHandler();
|
||||
this.registerLocalLinkHandler();
|
||||
}
|
||||
|
||||
public setWidgetManager(widgetManager: TerminalWidgetManager): void {
|
||||
|
@ -100,12 +94,23 @@ export class TerminalLinkHandler {
|
|||
});
|
||||
}
|
||||
|
||||
public registerLocalLinkHandler(): number {
|
||||
public registerWebLinkHandler(): void {
|
||||
const wrappedHandler = this._wrapLinkHandler(uri => {
|
||||
this._handleHypertextLink(uri);
|
||||
});
|
||||
this._xterm.webLinksInit(wrappedHandler, {
|
||||
validationCallback: (uri: string, callback: (isValid: boolean) => void) => this._validateWebLink(uri, callback),
|
||||
tooltipCallback: (e: MouseEvent) => this._widgetManager.showMessage(e.offsetX, e.offsetY, this._getLinkHoverString()),
|
||||
leaveCallback: () => this._widgetManager.closeMessage(),
|
||||
willLinkActivate: (e: MouseEvent) => this._isLinkActivationModifierDown(e)
|
||||
});
|
||||
}
|
||||
|
||||
public registerLocalLinkHandler(): void {
|
||||
const wrappedHandler = this._wrapLinkHandler(url => {
|
||||
this._handleLocalLink(url);
|
||||
});
|
||||
|
||||
return this._xterm.registerLinkMatcher(this._localLinkRegex, wrappedHandler, {
|
||||
this._xterm.registerLinkMatcher(this._localLinkRegex, wrappedHandler, {
|
||||
validationCallback: (uri: string, callback: (isValid: boolean) => void) => this._validateLocalLink(uri, callback),
|
||||
tooltipCallback: (e: MouseEvent) => this._widgetManager.showMessage(e.offsetX, e.offsetY, this._getLinkHoverString()),
|
||||
leaveCallback: () => this._widgetManager.closeMessage(),
|
||||
|
|
|
@ -6003,9 +6003,9 @@ vscode-textmate@^3.2.0:
|
|||
fast-plist "^0.1.2"
|
||||
oniguruma "^6.0.1"
|
||||
|
||||
vscode-xterm@3.2.0-beta4:
|
||||
version "3.2.0-beta4"
|
||||
resolved "https://registry.yarnpkg.com/vscode-xterm/-/vscode-xterm-3.2.0-beta4.tgz#fdcabafe1b6f89e5490cc816dcf29f0383147d48"
|
||||
vscode-xterm@3.2.0-beta6:
|
||||
version "3.2.0-beta6"
|
||||
resolved "https://registry.yarnpkg.com/vscode-xterm/-/vscode-xterm-3.2.0-beta6.tgz#17d6f41d741c4f7e60a322b18d7bdceec4dfded0"
|
||||
|
||||
vso-node-api@^6.1.2-preview:
|
||||
version "6.1.2-preview"
|
||||
|
|
Loading…
Reference in a new issue