[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot a62a388021 11/15: Fix README.md typos and rework
From: |
ELPA Syncer |
Subject: |
[elpa] externals/eglot a62a388021 11/15: Fix README.md typos and rework section about Workspace configuration |
Date: |
Sun, 24 Jul 2022 14:57:35 -0400 (EDT) |
branch: externals/eglot
commit a62a3880212daef7ac950596e8f425aacdaf9f16
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Fix README.md typos and rework section about Workspace configuration
* README.md (Workspace Configuration): Fix typos and rework
---
README.md | 67 ++++++++++++++++++++++++++++++++++++++++-----------------------
1 file changed, 43 insertions(+), 24 deletions(-)
diff --git a/README.md b/README.md
index 2314eb2d32..b0b54ad064 100644
--- a/README.md
+++ b/README.md
@@ -130,15 +130,29 @@ the ensuing TCP connection finds a listening server.
## Workspace configuration
-Most servers can guess good defaults and will operate nicely
-out-of-the-box, but some need to be configured specially via LSP
-interfaces. Additionally, in some situations, you may also want a
-particular server to operate differently across different projects.
+Many servers can guess good defaults and operate nicely
+out-of-the-box, but some need to be configured via a special LSP
+`workspace/configuration` RPC call to work at all. Additionally, you
+may also want a particular server to operate differently across
+different projects.
-Per-project settings are realized with Emacs's _directory variables
-and the Elisp variable `eglot-workspace-configuration`. To make a
-particular Python project always enable Pyls's snippet support, put a
-file named `.dir-locals.el` in the project's root:
+Per-project settings are realized with the Elisp variable
+`eglot-workspace-configuration`.
+
+Before considering what to set the variable to, one must understand
+_how_ to set it. `eglot-workspace-configuration` is a
+"directory-local" variable, and setting its variable globally or
+buffer-locally likely makes no sense. It should be set via
+`.dir-locals.el` or equivalent mechanisms.
+
+The variable's value is an _association list_ of _parameter sections_
+to _parameter objects_. Names and formats of section and parameter
+objects are server specific.
+
+#### Simple `eglot-workspace-configuration`
+
+To make a particular Python project always enable Pyls's snippet
+support, put a file named `.dir-locals.el` in the project's root:
```lisp
((python-mode
@@ -148,17 +162,16 @@ file named `.dir-locals.el` in the project's root:
This tells Emacs that any `python-mode` buffers in that directory
should have a particular value of `eglot-workspace-configuration`.
-That variable's value should be _association list_ of _parameter
-sections_ which are presumably understood by the server.
-In this above, we associated the _section_ `:pyls` with the parameters
-object `(:plugins (:jedi_completion (:include_params t)))`.
+Here, the value in question associates section `:pyls` with parameters
+`(:plugins (:jedi_completion (:include_params t)))`. The parameter
+object is a plist converted to JSON before being sent to the server.
-### Multiple workspace configuration for multiple servers
+#### Multiple servers in `eglot-workspace-configuration`
Suppose you also had some Go code in the very same project, you can
-configure the Gopls server in the same `.dir-locals.el' file. Adding
-a section for `go-mode`, the file's contents become:
+configure the Gopls server in the same `.dir-locals.el` file. Adding
+a section for `go-mode`, the file's contents now become:
```lisp
((python-mode
@@ -169,7 +182,9 @@ a section for `go-mode`, the file's contents become:
. ((:gopls . (:usePlaceholders t)))))))
```
-As a matter of taste, you might prefer this equivalent setup.
+Alternatively, as a matter of taste, you may choose this equivalent
+setup, which sets the variables value in all all major modes of all
+buffers of a given project.
```lisp
((nil
@@ -178,19 +193,22 @@ As a matter of taste, you might prefer this equivalent
setup.
(:gopls . (:usePlaceholders t)))))))
```
-### Setting up without `.dir-locals.el`
+#### `eglot-workspace-configuration` without `.dir-locals.el`
If you can't afford an actual `.dir-locals.el` file, or if managing
-this file becomes cumbersome, the Emacs manual (49.2.5 Per-Directory
-Local Variables) teaches you programmatic ways to leverage
-per-directory local variables. Look for the functions
+this file becomes cumbersome, the [Emacs
+manual][dir-locals-emacs-manual] teaches you programmatic ways to
+leverage per-directory local variables. Look for the functions
`dir-locals-set-directory-class` and `dir-locals-set-class-variables`.
-### Setting a dynamic `eglot-workspace-configuration` dynamically
+#### Dynamic `eglot-workspace-configuration` as a function
-If you need to decide `eglot-workspace-configuration` can be a function, too.
It is passed
-the `eglot-lsp-server` instance and runs with `default-directory` set
-to the root of your project.
+If you need to determine the workspace configuration base on some
+dynamic context, make `eglot-workspace-configuration` a function. It
+is passed the `eglot-lsp-server` instance and runs with
+`default-directory` set to the root of your project. The function
+should return a value of the same form as described in the previous
+paragraphs.
## Handling quirky servers
@@ -598,3 +616,4 @@ for the request form, and we'll send it to you.
[gospb]:
https://opensource.googleblog.com/2020/10/announcing-latest-google-open-source.html
[copyright-assignment]: https://www.fsf.org/licensing/contributor-faq
[legally-significant]:
https://www.gnu.org/prep/maintain/html_node/Legally-Significant.html#Legally-Significant
+[dir-locals-emacs-manual]:
https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html
- [elpa] externals/eglot updated (c558fd6a24 -> 6cc6fcc0fa), ELPA Syncer, 2022/07/24
- [elpa] externals/eglot ae7261c1fe 02/15: Per #131: Experiment with grouping in xref-backend-identifier-completion-table, ELPA Syncer, 2022/07/24
- [elpa] externals/eglot 25f6338741 04/15: Per #131: Tweak some details, fix some bugs, ELPA Syncer, 2022/07/24
- [elpa] externals/eglot 6cc6fcc0fa 15/15: Merge commit 'c558fd6a24' to fix fallout of force-push in GNU ELPA, ELPA Syncer, 2022/07/24
- [elpa] externals/eglot 33c464f658 06/15: Per #131, #314: Be more conservative with the LSP identifier guess, ELPA Syncer, 2022/07/24
- [elpa] externals/eglot 29690e88e3 13/15: Always default eglot-strict-mode to nil, ELPA Syncer, 2022/07/24
- [elpa] externals/eglot 1db95974a7 07/15: Per #967: eglot-workspace-configuration can be a function, ELPA Syncer, 2022/07/24
- [elpa] externals/eglot 87e6de3cdf 08/15: Appease byte-compiler warnings about wrong use of quotes, ELPA Syncer, 2022/07/24
- [elpa] externals/eglot a62a388021 11/15: Fix README.md typos and rework section about Workspace configuration,
ELPA Syncer <=
- [elpa] externals/eglot 2f71de72e3 01/15: Fix #131: Make C-u M-. work half decently, ELPA Syncer, 2022/07/24
- [elpa] externals/eglot c64fe76e86 03/15: Per #131: Cosmetic decisions guaranteed to tick off someone somewhere (tm), ELPA Syncer, 2022/07/24
- [elpa] externals/eglot a2d9e18945 09/15: Reply more reasonably to server's workspace/applyEdit, ELPA Syncer, 2022/07/24
- [elpa] externals/eglot c962f6e5f6 12/15: Rework table of contents in README.md again, ELPA Syncer, 2022/07/24
- [elpa] externals/eglot f62b641b5c 05/15: Per #131, #314: Guess the "LSP identifier at point", ELPA Syncer, 2022/07/24
- [elpa] externals/eglot eed9a65515 10/15: Fix embarrassing paren-matching blunder in eglot.el, ELPA Syncer, 2022/07/24
- [elpa] externals/eglot 2387026d67 14/15: Tweak bug-reporting templates yet again, ELPA Syncer, 2022/07/24