提交 9901d2b7 编写于 作者: M Michel Kaporin

Removed redundant instantiations of LinkDetetector for each ANSI output....

Removed redundant instantiations of LinkDetetector for each ANSI output. Corrected regex description.
上级 4962cfee
......@@ -15,7 +15,7 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
export class LinkDetector {
private static FILE_LOCATION_PATTERNS: RegExp[] = [
// group 0: full path with line and column
// group 1: full path without line and column, matched by `*.*` in the end to work only on paths with extensions in the end (s.t. http://test.com:8000 would not match)
// group 1: full path without line and column, matched by `*.*` in the end to work only on paths with extensions in the end (s.t. node:10352 would not match)
// group 2: drive letter on windows with trailing backslash or leading slash on mac/linux
// group 3: line number, matched by (:(\d+))
// group 4: column number, matched by ((?::(\d+))?)
......
......@@ -86,11 +86,13 @@ export class ReplExpressionsRenderer implements IRenderer {
private width: number;
private characterWidth: number;
private linkDetector: LinkDetector;
constructor(
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IInstantiationService private instantiationService: IInstantiationService
) {
// noop
this.linkDetector = this.instantiationService.createInstance(LinkDetector);
}
public getHeight(tree: ITree, element: any): number {
......@@ -319,8 +321,7 @@ export class ReplExpressionsRenderer implements IRenderer {
// flush text buffer if we have any
if (buffer) {
const linkDetector = this.instantiationService.createInstance(LinkDetector);
this.insert(linkDetector.handleLinks(buffer), currentToken || tokensContainer);
this.insert(this.linkDetector.handleLinks(buffer), currentToken || tokensContainer);
buffer = '';
}
......@@ -340,8 +341,7 @@ export class ReplExpressionsRenderer implements IRenderer {
// flush remaining text buffer if we have any
if (buffer) {
const linkDetector = this.instantiationService.createInstance(LinkDetector);
let res = linkDetector.handleLinks(buffer);
let res = this.linkDetector.handleLinks(buffer);
if (typeof res !== 'string' || currentToken) {
if (!tokensContainer) {
tokensContainer = document.createElement('span');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册