Skip to content

Commit 6feb19b

Browse files
committed
refactor: remove unused link validation logic
1 parent 746f4ab commit 6feb19b

1 file changed

Lines changed: 7 additions & 49 deletions

File tree

packages/terminal-next/src/browser/links/validated-local-link-provider.ts

Lines changed: 7 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -184,59 +184,17 @@ export class TerminalValidatedLocalLinkProvider extends TerminalBaseLinkProvider
184184
stringIndex += 2;
185185
}
186186

187-
// Convert the link text's string index into a wrapped buffer range
188-
const bufferRange = convertLinkRangeToBuffer(
189-
lines,
190-
this._xterm.cols,
191-
{
192-
startColumn: stringIndex + 1,
193-
startLineNumber: 1,
194-
endColumn: stringIndex + link.length + 1,
195-
endLineNumber: 1,
196-
},
197-
startLine,
198-
);
199-
const validatedLink = await new Promise<TerminalLink | undefined>((r) => {
200-
this._validationCallback(link, async (result) => {
201-
if (result) {
202-
const label = result.isDirectory
203-
? (await this._isDirectoryInsideWorkspace(result.uri))
204-
? FOLDER_IN_WORKSPACE_LABEL
205-
: FOLDER_NOT_IN_WORKSPACE_LABEL
206-
: OPEN_FILE_LABEL;
207-
const activateCallback = this._wrapLinkHandler((event: MouseEvent | undefined, text: string) => {
208-
if (result.isDirectory) {
209-
this._handleLocalFolderLink(result.uri);
210-
} else {
211-
this._activateFileCallback(event, text);
212-
}
213-
});
214-
r(
215-
this.injector.get(TerminalLink, [
216-
this._xterm,
217-
bufferRange,
218-
link,
219-
this._xterm.buffer.active.viewportY,
220-
activateCallback,
221-
this._tooltipCallback,
222-
true,
223-
label,
224-
]),
225-
);
226-
} else {
227-
r(undefined);
228-
}
229-
});
230-
});
231-
if (validatedLink) {
232-
result.push(validatedLink);
187+
const validatedLinks = await this.detectedLocalLinks(link, lines, startLine, stringIndex);
188+
189+
if (validatedLinks.length > 0) {
190+
result.push(...validatedLinks);
233191
}
234192
}
235193

236194
if (result.length === 0) {
237-
const folderLinks = await this.detectedLocalLinks(text, lines, startLine, stringIndex);
238-
if (folderLinks.length > 0) {
239-
result.push(...folderLinks);
195+
const validatedLinks = await this.detectedLocalLinks(text, lines, startLine, stringIndex);
196+
if (validatedLinks.length > 0) {
197+
result.push(...validatedLinks);
240198
}
241199
}
242200

0 commit comments

Comments
 (0)