1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-24 05:22:04 -08:00
emacs/test/lisp/progmodes
João Távora a74403adda Eglot: fix LSP "languageId" detection
This sweeping fix has been planned for a while, but a user recently
hit this bug as described in
https://github.com/joaotavora/eglot/discussions/1206.

More and more servers today are "multi-language", meaning can handle
more than one file type.  This relies on the ':languageId' string
being set to the correct value for every buffer managed by Eglot
(TextDocumentItem in LSP parlance).

Previously this string was calculated based on an imperfect heuristic
and was wrong quite often.  Many servers don't even care but some
others do, so we have to fix it.

* lisp/progmodes/eglot.el (eglot-lsp-server): Remove slots
'major-modes' and 'language-id'.  Add slot 'languages'.
(eglot--major-modes, eglot--language-ids): New helpers.
(eglot--lookup-mode): Simplify or maybe complicate.
(eglot--guess-contact): Use new eglot--looup-mode.  Change return
value.
(eglot): Rework docstring.
(eglot-reconnect): Use eglot--language-ids, not id.
(eglot--connect): Setup eglot--languages slot in server.
(eglot--TextDocumentItem): Finally, get correct language id.

* test/lisp/progmodes/eglot-tests.el (eglot--guessing-contact):
Enhance macro.
(eglot-test-server-programs-guess-lang): Update test.
2023-04-13 17:42:37 +01:00
..
c-ts-mode-resources Add missing indent rule for c-ts-mode 2023-03-21 16:24:29 -07:00
cperl-mode-resources ; Fix typos 2022-12-26 10:42:02 +01:00
elisp-mode-resources
elixir-ts-mode-resources Improve list indentation for elixir-ts-mode 2023-04-04 23:01:21 -07:00
flymake-resources
go-ts-mode-resources Fix switch statement indentation for go-ts-mode (bug#61238) 2023-02-04 19:26:05 +01:00
heex-ts-mode-resources Add heex-ts-mode (Bug#61996) 2023-03-12 17:40:06 +02:00
java-ts-mode-resources Add more java indentation tests 2023-02-10 20:22:31 +01:00
js-resources
project-resources Bring back the project--value-in-dir logic 2022-12-09 18:19:36 +02:00
ruby-mode-resources ruby-mode: Fix method call indentation in rhs of multiple assignment 2023-02-28 23:01:04 +02:00
sh-script-resources
typescript-ts-mode-resources Add some basic tests for java-ts-mode and typescript-ts-mode 2023-01-16 14:33:27 +01:00
xref-resources
asm-mode-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
autoconf-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
bat-mode-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
bug-reference-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
c-ts-mode-tests.el Cleanup preproc indent for c-ts-mode (bug#61558) 2023-02-19 20:47:05 +01:00
cc-mode-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
compile-tests.el Add tests for compilation support for TypeScript (bug#61104) 2023-02-04 09:19:40 +01:00
cperl-mode-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
eglot-tests.el Eglot: fix LSP "languageId" detection 2023-04-13 17:42:37 +01:00
elisp-mode-tests.el Help Elisp xref recognize defclass parent classes 2023-02-20 03:01:41 +02:00
elixir-ts-mode-tests.el ; Fix source file headers for some test files (bug#62227) 2023-03-17 09:05:50 +02:00
etags-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
executable-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
f90-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
flymake-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
gdb-mi-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
glasses-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
go-ts-mode-tests.el Fix switch statement indentation for go-ts-mode (bug#61238) 2023-02-04 19:26:05 +01:00
grep-tests.el New user option 'grep-use-headings' 2023-02-27 21:14:47 +02:00
heex-ts-mode-tests.el ; Fix source file headers for some test files (bug#62227) 2023-03-17 09:05:50 +02:00
hideshow-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
java-ts-mode-tests.el Add some basic tests for java-ts-mode and typescript-ts-mode 2023-01-16 14:33:27 +01:00
js-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
octave-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
opascal-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
pascal-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
perl-mode-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
project-tests.el Make project-current not error out inside non-existent dirs 2023-01-28 03:20:29 +02:00
ps-mode-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
python-tests.el Improve indenting "case" in Python 2023-03-26 05:03:07 +03:00
ruby-mode-tests.el (ruby-ts-add-log-current-function): Fix when between two methods 2023-01-04 00:38:01 +02:00
ruby-ts-mode-tests.el Skip ruby-ts-imenu-index test if needed 2023-03-28 13:04:09 +02:00
scheme-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
sh-script-tests.el Use 'sh-indent-for-continuation' for continued lines in 'sh-script-mode' 2023-03-02 12:37:58 +02:00
sql-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
subword-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
tcl-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
typescript-ts-mode-tests.el Add some basic tests for java-ts-mode and typescript-ts-mode 2023-01-16 14:33:27 +01:00
xref-tests.el ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00