mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-11 00:59:24 +01:00
Removed redundant instantiations of LinkDetetector for each ANSI output. Corrected regex description.
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user