]> git.eshelyaron.com Git - emacs.git/commit
Eglot: careful when invoking code actions on no symbol at all
authorJoão Távora <joaotavora@gmail.com>
Sat, 6 Jan 2024 23:56:33 +0000 (17:56 -0600)
committerEshel Yaron <me@eshelyaron.com>
Sun, 7 Jan 2024 21:05:57 +0000 (22:05 +0100)
commitf27ed2f9aa138c8b7afda579e216efcc4dd99dbe
tree1a74f364013d3dd8f73e768886c04f39984f6f13
parentac31c61cbf6d06ec374f4330aba9c6e078681146
Eglot: careful when invoking code actions on no symbol at all

Invoking code actions without a marked region or over a symbol
will trip certain servers up since BEG and END in eglot-code-actions
will be nil, causing 'eglot--pos-to-lsp-position' to assume point (which
is OK) but the 'flymake-diagnostics' call to return all diagnostics.

This causes an absolutely undecipherable JavaScript backtrace to be
sent back to Eglot from typescript-language-server.

Github-reference: https://github.com/joaotavora/eglot/issues/847

* lisp/progmodes/eglot.el (eglot--code-action-bounds): Avoid returning
  (list nil nil)

(cherry picked from commit b5de9ae8010684a5ed0c6f2703077a61d325ccad)
lisp/progmodes/eglot.el