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

Fix file:/// links

Fixes #95166
上级 8ee91a55
......@@ -299,9 +299,9 @@ export class TerminalLinkManager extends DisposableStore {
public registerLinkProvider(): void {
// Web links
const tooltipWebCallback = (event: MouseEvent, link: string, location: IViewportRange) => {
this._tooltipCallback(event, link, location, this._handleHypertextLink.bind(this, link));
this._tooltipCallback(event, link, location, this._handleProtocolLink.bind(this, link));
};
const wrappedActivateCallback = this._wrapLinkHandler(this._handleHypertextLink.bind(this));
const wrappedActivateCallback = this._wrapLinkHandler(this._handleProtocolLink.bind(this));
this._linkProviders.push(this._xterm.registerLinkProvider(
new TerminalWebLinkProvider(this._xterm, wrappedActivateCallback, tooltipWebCallback, this._leaveCallback)
));
......@@ -472,6 +472,19 @@ export class TerminalLinkManager extends DisposableStore {
this._openerService.open(url, { allowTunneling: !!(this._processManager && this._processManager.remoteAuthority) });
}
private async _handleProtocolLink(link: string): Promise<void> {
// Check if it's a file:/// link, hand off to local link handler so to open an editor and
// respect line/col attachment
const uri = URI.parse(link);
if (uri.scheme === 'file') {
this._handleLocalLink(uri.fsPath);
return;
}
// Open as a web link if it's not a file
this._handleHypertextLink(link);
}
protected _isLinkActivationModifierDown(event: MouseEvent): boolean {
const editorConf = this._configurationService.getValue<{ multiCursorModifier: 'ctrlCmd' | 'alt' }>('editor');
if (editorConf.multiCursorModifier === 'ctrlCmd') {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册