GNU bug report logs -
#67463
30.0.50; Eglot may manage js-json-mode buffers with wrong server
Previous Next
Reported by: Pengji Zhang <kunhtkun <at> gmail.com>
Date: Sun, 26 Nov 2023 21:17:02 UTC
Severity: normal
Found in version 30.0.50
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
Message #17 received at 67463 <at> debbugs.gnu.org (full text, mbox):
Hi João,
On Sun, Dec 3, 2023 at 3:51 PM João Távora <joaotavora <at> gmail.com> wrote:
>
> Nope this doesn't work. Even the slightly more involved patch after
> my sig doesn't work, and it correctly reports the :languageId as "json"
>
> So I think the best courses of action are 3 and 4, in that order.
>
I also think option 3 could be the best. JSON is indeed a subset of
JavaScript but that does not mean valid JSON files are also valid
JavaScript files. For instance, a bare object literal '{"a": 10}' is
not accepted by perhaps all JavaScript runtimes because it is parsed
as a block of statements. That is also why we get those invalid errors
in the example.
> Another workaround is to first start M-x eglot in some json file
> in your project. If you have one of:
>
> . ,(eglot-alternatives '(("vscode-json-language-server" "--stdio")
> ("vscode-json-languageserver" "--stdio")
> ("json-languageserver" "--stdio"))))
>
> installed, then these json-specific servers should start to manage
> js-json-mode files in your project. If afterwards you start M-x
> eglot in a plain js file, that server won't be (erroneously) used
> to manage JSON files.
>
Thanks! This workaround indeed works, even though it is a bit tedious
(and I honestly do not quite need a language server for JSON).
Pengji
This bug report was last modified 1 year and 184 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.