( view: EditorView, pos: number, )
| 365 | } |
| 366 | |
| 367 | function 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 | |
| 394 | const closeHoverOnInteraction = ViewPlugin.fromClass( |
| 395 | class { |
nothing calls this directly
no test coverage detected