Skip to content

Commit 3853550

Browse files
committed
Improve trace logging in local link detector
Part of #179972
1 parent 1f8d8e9 commit 3853550

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/vs/workbench/contrib/terminalContrib/links/browser/terminalLocalLinkDetector.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { ITerminalCapabilityStore, TerminalCapability } from 'vs/platform/termin
1313
import { IBufferLine, IBufferRange, Terminal } from 'xterm';
1414
import { ITerminalBackend, ITerminalProcessManager } from 'vs/workbench/contrib/terminal/common/terminal';
1515
import { detectLinks } from 'vs/workbench/contrib/terminalContrib/links/browser/terminalLinkParsing';
16+
import { ILogService } from 'vs/platform/log/common/log';
1617

1718
const enum Constants {
1819
/**
@@ -69,6 +70,7 @@ export class TerminalLocalLinkDetector implements ITerminalLinkDetector {
6970
private readonly _capabilities: ITerminalCapabilityStore,
7071
private readonly _processManager: Pick<ITerminalProcessManager, 'initialCwd' | 'os' | 'remoteAuthority' | 'userHome'> & { backend?: Pick<ITerminalBackend, 'getWslPath'> },
7172
private readonly _linkResolver: ITerminalLinkResolver,
73+
@ILogService private readonly _logService: ILogService,
7274
@IUriIdentityService private readonly _uriIdentityService: IUriIdentityService,
7375
@IWorkspaceContextService private readonly _workspaceContextService: IWorkspaceContextService
7476
) {
@@ -88,7 +90,10 @@ export class TerminalLocalLinkDetector implements ITerminalLinkDetector {
8890

8991
const os = this._processManager.os || OS;
9092
const parsedLinks = detectLinks(text, os);
93+
this._logService.trace('terminalLocaLinkDetector#detect text', text);
94+
this._logService.trace('terminalLocaLinkDetector#detect parsedLinks', parsedLinks);
9195
for (const parsedLink of parsedLinks) {
96+
9297
// Don't try resolve any links of excessive length
9398
if (parsedLink.path.text.length > Constants.MaxResolvedLinkLength) {
9499
continue;
@@ -147,6 +152,7 @@ export class TerminalLocalLinkDetector implements ITerminalLinkDetector {
147152
}
148153
}
149154
linkCandidates.push(...specialEndLinkCandidates);
155+
this._logService.trace('terminalLocaLinkDetector#detect linkCandidates', linkCandidates);
150156

151157
// Validate the path and convert to the outgoing type
152158
const simpleLink = await this._validateAndGetLink(undefined, bufferRange, linkCandidates, trimRangeMap);
@@ -156,6 +162,7 @@ export class TerminalLocalLinkDetector implements ITerminalLinkDetector {
156162
parsedLink.prefix?.index ?? parsedLink.path.index,
157163
parsedLink.suffix ? parsedLink.suffix.suffix.index + parsedLink.suffix.suffix.text.length : parsedLink.path.index + parsedLink.path.text.length
158164
);
165+
this._logService.trace('terminalLocaLinkDetector#detect verified link', simpleLink);
159166
links.push(simpleLink);
160167
}
161168

0 commit comments

Comments
 (0)