From 48ce8ecce7dddd1f8ee1fcac179982de8afdc974 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Wed, 24 Jun 2020 06:10:29 -0700 Subject: [PATCH] Convert TerminalLink.length to endIndex Aligns more with other APIs Part of #91290 --- src/vs/vscode.proposed.d.ts | 6 +++--- src/vs/workbench/api/common/extHostTerminalService.ts | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 4d9694b8293e1..e0bf0a26ca6f4 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -1089,14 +1089,14 @@ declare module 'vscode' { export interface TerminalLink { /** - * The start index of the link on [TerminalLinkContext.line](#TerminalLinkContext.line]. + * The 0-based start index of the link on [TerminalLinkContext.line](#TerminalLinkContext.line]. */ startIndex: number; /** - * The length of the link on [TerminalLinkContext.line](#TerminalLinkContext.line] + * The 0-based end index of the link on [TerminalLinkContext.line](#TerminalLinkContext.line]. */ - length: number; + endIndex: number; /** * The tooltip text when you hover over this link. diff --git a/src/vs/workbench/api/common/extHostTerminalService.ts b/src/vs/workbench/api/common/extHostTerminalService.ts index 4f73333c27a9c..fa5b30c76f99d 100644 --- a/src/vs/workbench/api/common/extHostTerminalService.ts +++ b/src/vs/workbench/api/common/extHostTerminalService.ts @@ -625,10 +625,11 @@ export abstract class BaseExtHostTerminalService implements IExtHostTerminalServ for (const provideResult of provideResults) { if (provideResult && provideResult.links.length > 0) { result.push(...provideResult.links.map(providerLink => { + const endIndex = Math.max(providerLink.endIndex, providerLink.startIndex + 1); const link = { id: nextLinkId++, startIndex: providerLink.startIndex, - length: providerLink.length, + length: endIndex - providerLink.startIndex, label: providerLink.tooltip }; cacheLinkMap.set(link.id, {