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

Enable web links in terminal renderers

上级 750680d2
......@@ -443,6 +443,8 @@ export class TerminalInstance implements ITerminalInstance {
}
this._linkHandler = this._instantiationService.createInstance(TerminalLinkHandler, this._xterm, platform.platform, this._processManager);
});
} else if (this.shellLaunchConfig.isRendererOnly) {
this._linkHandler = this._instantiationService.createInstance(TerminalLinkHandler, this._xterm, undefined, undefined);
}
this._xterm.on('focus', () => this._onFocus.fire(this));
......@@ -600,6 +602,9 @@ export class TerminalInstance implements ITerminalInstance {
});
}
});
} else if (this._shellLaunchConfig.isRendererOnly) {
this._widgetManager = new TerminalWidgetManager(this._wrapperElement);
this._linkHandler.setWidgetManager(this._widgetManager);
}
const computedStyle = window.getComputedStyle(this._container);
......
......@@ -74,8 +74,8 @@ export class TerminalLinkHandler {
constructor(
private _xterm: any,
private _platform: platform.Platform,
private readonly _processManager: ITerminalProcessManager,
private _platform: platform.Platform | undefined,
private readonly _processManager: ITerminalProcessManager | undefined,
@IOpenerService private readonly _openerService: IOpenerService,
@IEditorService private readonly _editorService: IEditorService,
@IConfigurationService private readonly _configurationService: IConfigurationService,
......@@ -97,8 +97,10 @@ export class TerminalLinkHandler {
};
this.registerWebLinkHandler();
this.registerLocalLinkHandler();
this.registerGitDiffLinkHandlers();
if (this._platform) {
this.registerLocalLinkHandler();
this.registerGitDiffLinkHandlers();
}
}
public setWidgetManager(widgetManager: TerminalWidgetManager): void {
......@@ -186,6 +188,9 @@ export class TerminalLinkHandler {
}
protected get _localLinkRegex(): RegExp {
if (!this._processManager) {
throw new Error('Process manager is required');
}
const baseLocalLinkClause = this._processManager.os === platform.OperatingSystem.Windows ? winLocalLinkClause : unixLocalLinkClause;
// Append line and column number regex
return new RegExp(`${baseLocalLinkClause}(${lineAndColumnClause})`);
......@@ -246,6 +251,9 @@ export class TerminalLinkHandler {
}
private get osPath(): IPath {
if (!this._processManager) {
throw new Error('Process manager is required');
}
if (this._processManager.os === platform.OperatingSystem.Windows) {
return win32;
}
......@@ -253,6 +261,9 @@ export class TerminalLinkHandler {
}
protected _preprocessPath(link: string): string | null {
if (!this._processManager) {
throw new Error('Process manager is required');
}
if (link.charAt(0) === '~') {
// Resolve ~ -> userHome
if (!this._processManager.userHome) {
......@@ -283,6 +294,10 @@ export class TerminalLinkHandler {
}
private _resolvePath(link: string): PromiseLike<URI | null> {
if (!this._processManager) {
throw new Error('Process manager is required');
}
const preprocessedLink = this._preprocessPath(link);
if (!preprocessedLink) {
return Promise.resolve(null);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册