diff options
author | Daniel Imms <2193314+Tyriar@users.noreply.github.com> | 2022-08-30 18:39:55 +0300 |
---|---|---|
committer | Daniel Imms <2193314+Tyriar@users.noreply.github.com> | 2022-08-30 18:39:55 +0300 |
commit | 76384da25ec7f82086505fcfe3976e5895c6bd48 (patch) | |
tree | 1aded55f87a382e6735c874c800e11c7b7d718b1 | |
parent | 93327316c0764f192eed5899571a415771e404a1 (diff) |
Working OSC hyperlinks
Part of #39278
-rw-r--r-- | package.json | 4 | ||||
-rw-r--r-- | remote/package.json | 2 | ||||
-rw-r--r-- | remote/web/package.json | 2 | ||||
-rw-r--r-- | remote/web/yarn.lock | 8 | ||||
-rw-r--r-- | remote/yarn.lock | 8 | ||||
-rw-r--r-- | src/vs/workbench/contrib/terminal/browser/links/terminalLinkManager.ts | 31 | ||||
-rw-r--r-- | src/vs/workbench/contrib/terminal/browser/media/xterm.css | 5 | ||||
-rw-r--r-- | yarn.lock | 8 |
8 files changed, 51 insertions, 17 deletions
diff --git a/package.json b/package.json index d3892dc3ba0..d4afe4b5122 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "vscode-proxy-agent": "^0.12.0", "vscode-regexpp": "^3.1.0", "vscode-textmate": "7.0.1", - "xterm": "5.0.0-beta.44", + "xterm": "5.0.0-beta.47", "xterm-addon-canvas": "0.2.0-beta.21", "xterm-addon-search": "0.10.0-beta.5", "xterm-addon-serialize": "0.8.0-beta.5", @@ -123,8 +123,8 @@ "@types/winreg": "^1.2.30", "@types/yauzl": "^2.9.1", "@types/yazl": "^2.4.2", - "@typescript-eslint/experimental-utils": "^5.10.0", "@typescript-eslint/eslint-plugin": "^5.10.0", + "@typescript-eslint/experimental-utils": "^5.10.0", "@typescript-eslint/parser": "^5.10.0", "@vscode/telemetry-extractor": "^1.9.8", "@vscode/test-web": "^0.0.29", diff --git a/remote/package.json b/remote/package.json index 60f9e80c27d..252779d34dc 100644 --- a/remote/package.json +++ b/remote/package.json @@ -24,7 +24,7 @@ "vscode-proxy-agent": "^0.12.0", "vscode-regexpp": "^3.1.0", "vscode-textmate": "7.0.1", - "xterm": "5.0.0-beta.44", + "xterm": "5.0.0-beta.47", "xterm-addon-canvas": "0.2.0-beta.21", "xterm-addon-search": "0.10.0-beta.5", "xterm-addon-serialize": "0.8.0-beta.5", diff --git a/remote/web/package.json b/remote/web/package.json index 487dd1fb375..c781c7e897e 100644 --- a/remote/web/package.json +++ b/remote/web/package.json @@ -11,7 +11,7 @@ "tas-client-umd": "0.1.6", "vscode-oniguruma": "1.6.1", "vscode-textmate": "7.0.1", - "xterm": "5.0.0-beta.44", + "xterm": "5.0.0-beta.47", "xterm-addon-canvas": "0.2.0-beta.21", "xterm-addon-search": "0.10.0-beta.5", "xterm-addon-unicode11": "0.4.0-beta.5", diff --git a/remote/web/yarn.lock b/remote/web/yarn.lock index edc1bbf2e95..6feee69bee8 100644 --- a/remote/web/yarn.lock +++ b/remote/web/yarn.lock @@ -88,7 +88,7 @@ xterm-addon-webgl@0.13.0-beta.45: resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.13.0-beta.45.tgz#f1f3c08e2a819970c1af0362eeb61185babcb6fc" integrity sha512-TXq5mxvG2alo5hSj/aFqHDzR2RSV2HH4is7R7kVmSCVPnl2RgDfAPilXOEJyYFLF09EgiGiG5UZASYJjvJfMRg== -xterm@5.0.0-beta.44: - version "5.0.0-beta.44" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.0.0-beta.44.tgz#854ed16c06808295777afc4ef7b78ccd55e59d4a" - integrity sha512-raKvoikUjKZTO9duYliDp5hSKAwYia9P51QCumHY30V/bRZ2fq9ryyKQ65PxW8LzGYK8o7x7vNRUHVWbS073Tw== +xterm@5.0.0-beta.47: + version "5.0.0-beta.47" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.0.0-beta.47.tgz#c2f865cb150dd649432d2f03749a2e03afa5b630" + integrity sha512-XgaKHn+/OGzfK4d40f3ebs6q/5+v/i6Y1HI64/9IcxYuwtZQUqdhY6fgdwpJxphQKe1lB29JvZghDVKq15LxBA== diff --git a/remote/yarn.lock b/remote/yarn.lock index 6c8f9ca4e15..bfb7d083f09 100644 --- a/remote/yarn.lock +++ b/remote/yarn.lock @@ -818,10 +818,10 @@ xterm-headless@5.0.0-beta.5: resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-5.0.0-beta.5.tgz#e29b6c5081f31f887122b7263ba996b0c46b3c22" integrity sha512-CMQ1+prBNF92oBMeZzc2rfTcmOaCGfwwSaoPYNTjyziZT6mZsEg7amajYkb0YAnqJ29MFm4kPGZbU78/dX4k2A== -xterm@5.0.0-beta.44: - version "5.0.0-beta.44" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.0.0-beta.44.tgz#854ed16c06808295777afc4ef7b78ccd55e59d4a" - integrity sha512-raKvoikUjKZTO9duYliDp5hSKAwYia9P51QCumHY30V/bRZ2fq9ryyKQ65PxW8LzGYK8o7x7vNRUHVWbS073Tw== +xterm@5.0.0-beta.47: + version "5.0.0-beta.47" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.0.0-beta.47.tgz#c2f865cb150dd649432d2f03749a2e03afa5b630" + integrity sha512-XgaKHn+/OGzfK4d40f3ebs6q/5+v/i6Y1HI64/9IcxYuwtZQUqdhY6fgdwpJxphQKe1lB29JvZghDVKq15LxBA== yallist@^4.0.0: version "4.0.0" diff --git a/src/vs/workbench/contrib/terminal/browser/links/terminalLinkManager.ts b/src/vs/workbench/contrib/terminal/browser/links/terminalLinkManager.ts index 28d0c22794f..b414044bdf0 100644 --- a/src/vs/workbench/contrib/terminal/browser/links/terminalLinkManager.ts +++ b/src/vs/workbench/contrib/terminal/browser/links/terminalLinkManager.ts @@ -32,6 +32,7 @@ import { ITerminalCapabilityStore, TerminalCapability } from 'vs/platform/termin import { ITerminalConfiguration, ITerminalProcessManager, TERMINAL_CONFIG_SECTION } from 'vs/workbench/contrib/terminal/common/terminal'; import { IHoverAction } from 'vs/workbench/services/hover/browser/hover'; import type { ILink, ILinkProvider, IViewportRange, Terminal } from 'xterm'; +import { convertBufferRangeToViewport } from 'vs/workbench/contrib/terminal/browser/links/terminalLinkHelpers'; export type XtermLinkMatcherHandler = (event: MouseEvent | undefined, link: string) => Promise<void>; export type XtermLinkMatcherValidationCallback = (uri: string, callback: (isValid: boolean) => void) => void; @@ -92,6 +93,36 @@ export class TerminalLinkManager extends DisposableStore { this._openers.set(TerminalBuiltinLinkType.Url, this._instantiationService.createInstance(TerminalUrlLinkOpener, !!this._processManager.remoteAuthority)); this._registerStandardLinkProviders(); + + this._xterm.options.linkHandler = { + activate: (e, text) => { + this._openers.get(TerminalBuiltinLinkType.Url)?.open({ + type: TerminalBuiltinLinkType.Url, + text, + bufferRange: null!, + uri: URI.parse(text) + }); + }, + hover: (e, text, range) => { + const core = (this._xterm as any)._core as IXtermCore; + const cellDimensions = { + width: core._renderService.dimensions.actualCellWidth, + height: core._renderService.dimensions.actualCellHeight + }; + const terminalDimensions = { + width: this._xterm.cols, + height: this._xterm.rows + }; + this._showHover({ + viewportRange: convertBufferRangeToViewport(range, this._xterm.buffer.active.viewportY), + cellDimensions, + terminalDimensions + }, this._getLinkHoverString(text, text), undefined, (text) => this._xterm.options.linkHandler!.activate(e, text, range)); + }, + leave: (e, text) => { + console.log('leave'); + } + }; } private _setupLinkDetector(id: string, detector: ITerminalLinkDetector, isExternal: boolean = false): ILinkProvider { diff --git a/src/vs/workbench/contrib/terminal/browser/media/xterm.css b/src/vs/workbench/contrib/terminal/browser/media/xterm.css index 174174dea43..30fdf93feb6 100644 --- a/src/vs/workbench/contrib/terminal/browser/media/xterm.css +++ b/src/vs/workbench/contrib/terminal/browser/media/xterm.css @@ -55,7 +55,10 @@ .xterm .xterm-helpers { position: absolute; top: 0; - /* The z-index of the helpers must be higher than the canvases in order for IMEs to appear on top. */ + /** + * The z-index of the helpers must be higher than the canvases in order for + * IMEs to appear on top. + */ z-index: 5; } diff --git a/yarn.lock b/yarn.lock index 17fee22266c..e3db9185fa5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11542,10 +11542,10 @@ xterm-headless@5.0.0-beta.5: resolved "https://registry.yarnpkg.com/xterm-headless/-/xterm-headless-5.0.0-beta.5.tgz#e29b6c5081f31f887122b7263ba996b0c46b3c22" integrity sha512-CMQ1+prBNF92oBMeZzc2rfTcmOaCGfwwSaoPYNTjyziZT6mZsEg7amajYkb0YAnqJ29MFm4kPGZbU78/dX4k2A== -xterm@5.0.0-beta.44: - version "5.0.0-beta.44" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.0.0-beta.44.tgz#854ed16c06808295777afc4ef7b78ccd55e59d4a" - integrity sha512-raKvoikUjKZTO9duYliDp5hSKAwYia9P51QCumHY30V/bRZ2fq9ryyKQ65PxW8LzGYK8o7x7vNRUHVWbS073Tw== +xterm@5.0.0-beta.47: + version "5.0.0-beta.47" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-5.0.0-beta.47.tgz#c2f865cb150dd649432d2f03749a2e03afa5b630" + integrity sha512-XgaKHn+/OGzfK4d40f3ebs6q/5+v/i6Y1HI64/9IcxYuwtZQUqdhY6fgdwpJxphQKe1lB29JvZghDVKq15LxBA== y18n@^3.2.1: version "3.2.2" |