unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Explain a bit more on how to configure language server in Eglot's manual
@ 2023-03-05  4:45 Yuan Fu
  2023-03-05 22:36 ` [SPAM UNSURE] " Stephen Leake
  2023-03-06 10:34 ` Augusto Stoffel
  0 siblings, 2 replies; 52+ messages in thread
From: Yuan Fu @ 2023-03-05  4:45 UTC (permalink / raw)
  To: Emacs developers

Recently I was trying to use eglot with rust-analyzer and configure rust-analyzer. It turns out more confusing than it should be, and I think we can add a paragraph to eglot’s manual to help others like me.

LSP servers generally allow configuration through either LSP’s workspaceConfiguration protocol or their custom configuration file. For those who use workspaceConfiguration, it is common for the documentation to say something like this:

    This is the list of config options rust-analyzer supports:

    rust-analyzer.assist.emitMustUse (default: false) blah blah blah
    …

To pass this configuration to rust-analyzer through eglot, you need to set eglot-workspace-configuration to 

'(:rust-analyzer (:assist (:emitMustUse t)))

However, it is not obviously clear how to interpret “rust-analyzer.assist.emitMustUse”, not for someone inexperience with LSP, at least. (OTOH, the manual explains very clearly how to translate a JSON config to a plist, great job!)

I suggest we add a sentence or a paragraph to the eglot manual explaining that rust-analyzer.assist.emitMustUse translates to the JSON configuration

{
  "rust-analyzer": {
    "assist": {
      "emitMustUse": true
    }
  }
}

And the user should translate that to the plist format for eglot-workspace-configuration.

This is not something only rust-analyzer does. I surveyed a bunch of language servers, all the servers that support LSP’s workspaceConfiguration (typescript, rust, python, OCaml, Haskell, perl, Java) describe their configuration in the xxx.xx.xxx format. Because this is the format one can copy and paste into VSCode’s setting file.

We should probably also mention that the “root key” (the "rust-analyzer” part) isn’t always the name of the language server. Some server expects the language name rather than the server’s name, ie, haskell rather than haskell-language-server. Typescript expects “typescript” or “javascript”, perl, ocaml, java expects language names, python expects “pyls”, the name of the server.

Yuan


^ permalink raw reply	[flat|nested] 52+ messages in thread
* Re: Re: Explain a bit more on how to configure language server in Eglot's manual
@ 2023-03-12 12:09 Pedro Andres Aranda Gutierrez
  2023-03-12 19:52 ` João Távora
  0 siblings, 1 reply; 52+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2023-03-12 12:09 UTC (permalink / raw)
  To: João Távora; +Cc: emacs-devel

Hi Joao,

I've been looking at the write-eglot-manual-for-advanced-server-config
branch in savannah and it looks great.
 My .2 cents to it is that would be great if you included something in
the line of

----- cut here -------
You can create a basic eglot configuration to use (by default) in most
of your projects in your Emacs initialisation like below:

  (setq-default eglot-workspace-configuration
                '(:pylsp
                  (:configurationSources ["pycodestyle"]
                   :plugins
                   (:mccabe (:threshold 30)))
                  :gopls
                  (:usePlaceholders t)))

and then use .dir-locals.el for a project or directory that needs
specific settings.
----- cut here -------

That would cover sone newbie questions.

In addition to this, it would also be nice to document a 'canonical'
way to disable/customise the mouse code actions. If I use something,
it's just the import organiser in Python... Disabling it, moving it to
another binding would be great.

TIA, /PA

-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should
run a leader-deposed hook here, but we can't yet



^ permalink raw reply	[flat|nested] 52+ messages in thread

end of thread, other threads:[~2023-03-16  0:09 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-05  4:45 Explain a bit more on how to configure language server in Eglot's manual Yuan Fu
2023-03-05 22:36 ` [SPAM UNSURE] " Stephen Leake
2023-03-06  0:16   ` João Távora
2023-03-06 22:28     ` Yuan Fu
2023-03-07 11:59       ` João Távora
2023-03-08 13:27         ` Augusto Stoffel
2023-03-08 13:54           ` João Távora
2023-03-08 15:01             ` Augusto Stoffel
2023-03-08 19:43               ` João Távora
2023-03-08 20:43                 ` Augusto Stoffel
2023-03-09  9:43                   ` João Távora
2023-03-08 23:19                 ` Yuan Fu
2023-03-09  8:18                   ` Augusto Stoffel
2023-03-09 17:20                     ` Juri Linkov
2023-03-10  6:26                       ` Yuan Fu
2023-03-10  7:59                         ` João Távora
2023-03-09 17:40                     ` João Távora
2023-03-09 18:05                       ` Juri Linkov
2023-03-09 18:32                         ` Augusto Stoffel
2023-03-09  8:28                 ` Explain a bit more on how to configure language server in Eglot's manual' Augusto Stoffel
2023-03-08 15:24             ` Explain a bit more on how to configure language server in Eglot's manual Yuri Khan
2023-03-08 15:27               ` João Távora
2023-03-08 15:52                 ` Yuri Khan
2023-03-08 16:03                   ` João Távora
2023-03-09 11:18         ` [SPAM UNSURE] " João Távora
2023-03-10  6:23           ` Yuan Fu
2023-03-14 18:09             ` Michael Eliachevitch
2023-03-14 18:53               ` João Távora
2023-03-14 22:27                 ` [PATCH] " Michael Eliachevitch
2023-03-15 11:49                   ` Michael Eliachevitch
2023-03-15 12:35                   ` Eli Zaretskii
2023-03-15 12:52                     ` Michael Eliachevitch
2023-03-15 18:54                       ` João Távora
2023-03-15 19:26                         ` Michael Eliachevitch
2023-03-16  0:09                           ` João Távora
2023-03-06 10:34 ` Augusto Stoffel
2023-03-06 10:51   ` João Távora
2023-03-06 11:00     ` Augusto Stoffel
2023-03-06 11:13       ` João Távora
2023-03-06 11:30         ` Pedro Andres Aranda Gutierrez
2023-03-06 11:46           ` João Távora
2023-03-06 13:08             ` Augusto Stoffel
2023-03-06 13:50               ` João Távora
2023-03-06 16:10                 ` Augusto Stoffel
2023-03-06 16:25                   ` João Távora
2023-03-06 18:18                     ` Augusto Stoffel
2023-03-06 18:32                       ` João Távora
2023-03-06 20:16                         ` Pedro Andres Aranda Gutierrez
2023-03-06 21:13                         ` Augusto Stoffel
2023-03-06 21:38                           ` João Távora
2023-03-06 13:01         ` Augusto Stoffel
  -- strict thread matches above, loose matches on Subject: below --
2023-03-12 12:09 Pedro Andres Aranda Gutierrez
2023-03-12 19:52 ` João Távora

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).