diff options
| author | João Távora | 2023-04-17 01:37:19 +0100 |
|---|---|---|
| committer | João Távora | 2023-04-17 01:37:19 +0100 |
| commit | 2d24eb69ed56b00f400066f4dfcf549d69036ce6 (patch) | |
| tree | c8f2027e8e309ec70eeae9a3c25f2af29c6aeae4 | |
| parent | 3c8167ec0f9647e6fc33e65b0a0324f96cb795ee (diff) | |
| download | emacs-2d24eb69ed56b00f400066f4dfcf549d69036ce6.tar.gz emacs-2d24eb69ed56b00f400066f4dfcf549d69036ce6.zip | |
Eglot: guard against empty 'textDocument/documentSymbol' response
* lisp/progmodes/eglot.el (eglot-imenu): Protect against missing response.
| -rw-r--r-- | lisp/progmodes/eglot.el | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 24f2fda5ae5..7ad33fa3786 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el | |||
| @@ -3295,10 +3295,11 @@ Returns a list as described in docstring of `imenu--index-alist'." | |||
| 3295 | `(:textDocument | 3295 | `(:textDocument |
| 3296 | ,(eglot--TextDocumentIdentifier)) | 3296 | ,(eglot--TextDocumentIdentifier)) |
| 3297 | :cancel-on-input non-essential)) | 3297 | :cancel-on-input non-essential)) |
| 3298 | (head (and res (elt res 0)))) | 3298 | (head (and (cl-plusp (length res)) (elt res 0)))) |
| 3299 | (eglot--dcase head | 3299 | (when head |
| 3300 | (((SymbolInformation)) (eglot--imenu-SymbolInformation res)) | 3300 | (eglot--dcase head |
| 3301 | (((DocumentSymbol)) (eglot--imenu-DocumentSymbol res))))) | 3301 | (((SymbolInformation)) (eglot--imenu-SymbolInformation res)) |
| 3302 | (((DocumentSymbol)) (eglot--imenu-DocumentSymbol res)))))) | ||
| 3302 | 3303 | ||
| 3303 | (cl-defun eglot--apply-text-edits (edits &optional version) | 3304 | (cl-defun eglot--apply-text-edits (edits &optional version) |
| 3304 | "Apply EDITS for current buffer if at VERSION, or if it's nil." | 3305 | "Apply EDITS for current buffer if at VERSION, or if it's nil." |