codemirror-languageserver
Advanced tools
+28
-15
@@ -90,2 +90,5 @@ import { insertCompletionText, autocompletion as autocompletion$1 } from '@codemirror/autocomplete'; | ||
| preselectSupport: false, | ||
| resolveSupport: { | ||
| properties: ['detail', 'documentation'], | ||
| }, | ||
| }, | ||
@@ -159,2 +162,5 @@ contextSupport: true, | ||
| } | ||
| async completionItemResolve(params) { | ||
| return await this.request('completionItem/resolve', params, timeout); | ||
| } | ||
| attachPlugin(plugin) { | ||
@@ -333,3 +339,4 @@ this.plugins.push(plugin); | ||
| } | ||
| const options = items.map(({ detail, label, kind, textEdit, documentation, additionalTextEdits, }) => { | ||
| const options = items.map((item) => { | ||
| const { detail, label, kind, textEdit, documentation, additionalTextEdits, } = item; | ||
| const completion = { | ||
@@ -372,16 +379,22 @@ label, | ||
| }; | ||
| if (documentation) { | ||
| completion.info = async () => { | ||
| const dom = document.createElement('div'); | ||
| dom.classList.add('documentation'); | ||
| if (this.allowHTMLContent) { | ||
| dom.innerHTML = await formatContents(documentation); | ||
| } | ||
| else { | ||
| dom.textContent = | ||
| await formatContents(documentation); | ||
| } | ||
| return dom; | ||
| }; | ||
| } | ||
| completion.info = async () => { | ||
| var _a; | ||
| let { documentation } = item; | ||
| if (!documentation && | ||
| ((_a = this.client.capabilities.completionProvider) === null || _a === void 0 ? void 0 : _a.resolveProvider)) { | ||
| const resolvedItem = await this.client.completionItemResolve(item); | ||
| documentation = resolvedItem.documentation; | ||
| } | ||
| if (!documentation) | ||
| return null; | ||
| const dom = document.createElement('div'); | ||
| dom.classList.add('documentation'); | ||
| if (this.allowHTMLContent) { | ||
| dom.innerHTML = await formatContents(documentation); | ||
| } | ||
| else { | ||
| dom.textContent = await formatContents(documentation); | ||
| } | ||
| return dom; | ||
| }; | ||
| return completion; | ||
@@ -388,0 +401,0 @@ }); |
+2
-0
@@ -27,2 +27,3 @@ import { EditorView, Tooltip, ViewPlugin } from '@codemirror/view'; | ||
| ]; | ||
| 'completionItem/resolve': [LSP.CompletionItem, LSP.CompletionItem]; | ||
| } | ||
@@ -73,2 +74,3 @@ interface LSPNotifyMap { | ||
| textDocumentTypeDefinition(params: LSP.TypeDefinitionParams): Promise<LSP.Location | LSP.Location[] | LSP.LocationLink[]>; | ||
| completionItemResolve(params: LSP.CompletionItem): Promise<LSP.CompletionItem>; | ||
| attachPlugin(plugin: LanguageServerPlugin): void; | ||
@@ -75,0 +77,0 @@ detachPlugin(plugin: LanguageServerPlugin): void; |
+1
-1
| { | ||
| "name": "codemirror-languageserver", | ||
| "version": "1.16.0", | ||
| "version": "1.17.0", | ||
| "description": "Language Server Plugin for CodeMirror 6", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
+1
-1
@@ -13,3 +13,3 @@ # Language Server Plugin for CodeMirror 6 | ||
| - ⌨️ Code Completion | ||
| - ⌨️ Code Completion (w/ Resolve Support) | ||
| - 📚 Hover Documentation | ||
@@ -16,0 +16,0 @@ - 🩺 Diagnostics |
Sorry, the diff of this file is too big to display
1417995
-10.34%39435
-5.57%