MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / lspTooltipSource

Function lspTooltipSource

src/cm/lsp/tooltipExtensions.ts:367–392  ·  view source on GitHub ↗
(
	view: EditorView,
	pos: number,
)

Source from the content-addressed store, hash-verified

365}
366
367function lspTooltipSource(
368 view: EditorView,
369 pos: number,
370): Promise<Tooltip | null> {
371 const plugin = LSPPlugin.get(view);
372 if (!plugin) return Promise.resolve(null);
373
374 return hoverRequest(plugin, pos).then(async (result) => {
375 if (!result) return null;
376 await loadHoverContentLanguages(result.contents);
377
378 return {
379 pos: result.range
380 ? fromPosition(view.state.doc, result.range.start)
381 : pos,
382 end: result.range ? fromPosition(view.state.doc, result.range.end) : pos,
383 create() {
384 const dom = document.createElement("div");
385 dom.className = "cm-lsp-hover-tooltip cm-lsp-documentation";
386 dom.innerHTML = renderTooltipContent(plugin, result.contents);
387 return { dom };
388 },
389 above: true,
390 };
391 });
392}
393
394const closeHoverOnInteraction = ViewPlugin.fromClass(
395 class {

Callers

nothing calls this directly

Calls 4

hoverRequestFunction · 0.85
fromPositionFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected