MCPcopy
hub / github.com/codeaashu/claude-code / provideLinks

Method provideLinks

src/server/web/public/terminal.js:376–413  ·  view source on GitHub ↗
(e3, t3)

Source from the content-addressed store, hash-verified

374 this._bufferService = e3, this._optionsService = t3, this._oscLinkService = i3;
375 }
376 provideLinks(e3, t3) {
377 var _a;
378 const i3 = this._bufferService.buffer.lines.get(e3 - 1);
379 if (!i3) return void t3(void 0);
380 const s3 = [], r2 = this._optionsService.rawOptions.linkHandler, o2 = new n.CellData(), a2 = i3.getTrimmedLength();
381 let c = -1, l = -1, d = false;
382 for (let t4 = 0; t4 < a2; t4++) if (-1 !== l || i3.hasContent(t4)) {
383 if (i3.loadCell(t4, o2), o2.hasExtendedAttrs() && o2.extended.urlId) {
384 if (-1 === l) {
385 l = t4, c = o2.extended.urlId;
386 continue;
387 }
388 d = o2.extended.urlId !== c;
389 } else -1 !== l && (d = true);
390 if (d || -1 !== l && t4 === a2 - 1) {
391 const i4 = (_a = this._oscLinkService.getLinkData(c)) == null ? void 0 : _a.uri;
392 if (i4) {
393 const n2 = { start: { x: l + 1, y: e3 }, end: { x: t4 + (d || t4 !== a2 - 1 ? 0 : 1), y: e3 } };
394 let o3 = false;
395 if (!(r2 == null ? void 0 : r2.allowNonHttpProtocols)) try {
396 const e4 = new URL(i4);
397 ["http:", "https:"].includes(e4.protocol) || (o3 = true);
398 } catch (e4) {
399 o3 = true;
400 }
401 o3 || s3.push({ text: i4, range: n2, activate: (e4, t5) => r2 ? r2.activate(e4, t5, n2) : h(0, t5), hover: (e4, t5) => {
402 var _a2;
403 return (_a2 = r2 == null ? void 0 : r2.hover) == null ? void 0 : _a2.call(r2, e4, t5, n2);
404 }, leave: (e4, t5) => {
405 var _a2;
406 return (_a2 = r2 == null ? void 0 : r2.leave) == null ? void 0 : _a2.call(r2, e4, t5, n2);
407 } });
408 }
409 d = false, o2.hasExtendedAttrs() && o2.extended.urlId ? (l = t4, c = o2.extended.urlId) : (l = -1, c = -1);
410 }
411 }
412 t3(s3);
413 }
414 };
415 function h(e3, t3) {
416 if (confirm(`Do you want to navigate to ${t3}?

Callers 1

_askForLinkMethod · 0.80

Calls 12

t3Function · 0.85
getTrimmedLengthMethod · 0.80
hasContentMethod · 0.80
loadCellMethod · 0.80
hasExtendedAttrsMethod · 0.80
getLinkDataMethod · 0.80
computeLinkMethod · 0.80
_addCallbacksMethod · 0.80
hFunction · 0.70
getMethod · 0.65
pushMethod · 0.45
activateMethod · 0.45

Tested by

no test coverage detected