diff options
| author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-11-09 10:26:37 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-09 10:26:37 -0800 |
| commit | d1dd1a6675b18d8e863bae425314fcf54f0616f3 (patch) | |
| tree | df97404fe088673792916f7c1e0dd743abba8a05 | |
| parent | docs: documentation overhaul (#1384) (diff) | |
| download | nvim-lspconfig-d1dd1a6675b18d8e863bae425314fcf54f0616f3.tar nvim-lspconfig-d1dd1a6675b18d8e863bae425314fcf54f0616f3.tar.gz nvim-lspconfig-d1dd1a6675b18d8e863bae425314fcf54f0616f3.tar.bz2 nvim-lspconfig-d1dd1a6675b18d8e863bae425314fcf54f0616f3.tar.lz nvim-lspconfig-d1dd1a6675b18d8e863bae425314fcf54f0616f3.tar.xz nvim-lspconfig-d1dd1a6675b18d8e863bae425314fcf54f0616f3.tar.zst nvim-lspconfig-d1dd1a6675b18d8e863bae425314fcf54f0616f3.zip | |
docs: follow-up fixes from overhaul (#1389)
| -rw-r--r-- | .github/workflows/codespell.yml | 2 | ||||
| -rw-r--r-- | .github/workflows/docgen.yml | 4 | ||||
| -rw-r--r-- | .mergify.yml | 14 | ||||
| -rw-r--r-- | README.md | 16 | ||||
| -rw-r--r-- | doc/lspconfig.txt | 19 |
5 files changed, 29 insertions, 26 deletions
diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml index 0cf18520..7a6cfe13 100644 --- a/.github/workflows/codespell.yml +++ b/.github/workflows/codespell.yml @@ -18,4 +18,4 @@ jobs: pip install codespell - name: Use codespell run: | - codespell --quiet-level=2 --check-hidden --skip=CONFIG.md --ignore-words=.codespellignorewords || exit + codespell --quiet-level=2 --check-hidden --skip=./doc/server_configurations.md --ignore-words=.codespellignorewords || exit diff --git a/.github/workflows/docgen.yml b/.github/workflows/docgen.yml index a6c3bd55..b7c123a2 100644 --- a/.github/workflows/docgen.yml +++ b/.github/workflows/docgen.yml @@ -22,11 +22,11 @@ jobs: - name: Commit changes env: COMMIT_MSG: | - docs: update CONFIG.md + docs: update server_configurations.md skip-checks: true run: | git config user.name github-actions git config user.email github-actions@github.com - git add CONFIG.md + git add doc/server_configurations.md # Only commit and push if we have changes git diff --quiet && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push) diff --git a/.mergify.yml b/.mergify.yml index 1a89453f..a02fd15e 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -1,8 +1,8 @@ pull_request_rules: - # - name: disallow changing a file - # conditions: - # - files=CONFIG.md - # actions: - # close: - # comment: - # message: "CONFIG.md is auto-generated: edit the lua source file instead (and re-read the PR template)." + - name: disallow changing a file + conditions: + - files=doc/server_configurations.md + actions: + close: + comment: + message: "server_configurations.md is auto-generated: edit the lua source file instead (and re-read the PR template)." @@ -1,9 +1,11 @@ -# nvim-lspconfig +# lspconfig A [collection of common configurations](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md) for Neovim's built-in [language server client](https://neovim.io/doc/user/lsp.html). This plugin allows for declaratively configuring, launching, and initializing language servers you have installed on your system. Language server configurations are community-maintained. +`lspconfig` has extensive help documentation, see `:help lspconfig`. + # LSP overview Neovim supports the Language Server Protocol (LSP), which means it acts as a client to language servers and includes a Lua framework `vim.lsp` for building enhanced LSP tools. LSP facilitates features like: @@ -22,9 +24,9 @@ These features are not implemented in this repo, but in Neovim core. See `:help ## Install -* Requires [Neovim v0.5.0](https://github.com/neovim/neovim/releases/tag/v0.5.0) or [Nightly](https://github.com/neovim/neovim/releases/tag/nightly). Update Neovim and nvim-lspconfig before reporting an issue. +* Requires [Neovim v0.5.0](https://github.com/neovim/neovim/releases/tag/v0.5.0) or [Nightly](https://github.com/neovim/neovim/releases/tag/nightly). Update Neovim and 'lspconfig' before reporting an issue. -* Install nvim-lspconfig like any other Vim plugin, e.g. with [vim-plug](https://github.com/junegunn/vim-plug): +* Install 'lspconfig' like any other Vim plugin, e.g. with [vim-plug](https://github.com/junegunn/vim-plug): ```vim Plug 'neovim/nvim-lspconfig' @@ -65,7 +67,7 @@ These features are not implemented in this repo, but in Neovim core. See `:help ## Automatically launching language servers -In order to automatically launch a language server, lspconfig searches up the directory tree from your current buffer to find a file matching the `root_dir` pattern defined in each server's configuration. For [pyright](doc/server_configurations.md#pyright), this is any directory containing ".git", "setup.py", "setup.cfg", "pyproject.toml", or "requirements.txt"). +In order to automatically launch a language server, 'lspconfig' searches up the directory tree from your current buffer to find a file matching the `root_dir` pattern defined in each server's configuration. For [pyright](doc/server_configurations.md#pyright), this is any directory containing ".git", "setup.py", "setup.cfg", "pyproject.toml", or "requirements.txt"). Language servers require each project to have a `root` in order to provide completion and search across symbols that may not be defined in your current file, and to avoid having to index your entire filesystem on each startup. @@ -83,7 +85,7 @@ For a full list of servers, see [server_configurations.md](doc/server_configurat ## Keybindings and completion -nvim-lspconfig does not map keybindings or enable completion by default. Manual, triggered completion can be provided by neovim's built-in omnifunc. For autocompletion, a general purpose [autocompletion plugin](https://github.com/neovim/nvim-lspconfig/wiki/Autocompletion) is required. The following example configuration provides suggested keymaps for the most commonly used language server functions, and manually triggered completion with omnifunc (\<c-x\>\<c-o\>). +'lspconfig' does not map keybindings or enable completion by default. Manual, triggered completion can be provided by neovim's built-in omnifunc. For autocompletion, a general purpose [autocompletion plugin](https://github.com/neovim/nvim-lspconfig/wiki/Autocompletion) is required. The following example configuration provides suggested keymaps for the most commonly used language server functions, and manually triggered completion with omnifunc (\<c-x\>\<c-o\>). Note: **you must pass the defined `on_attach` as an argument to every `setup {}` call** and **the keybindings in `on_attach` only take effect after the language server has started (attached to the current buffer)**. ```lua @@ -141,11 +143,11 @@ The `on_attach` hook is used to only activate the bindings after the language se ## Debugging -If you have an issue with lspconfig, the first step is to reproduce with a [minimal configuration](https://github.com/neovim/nvim-lspconfig/blob/master/test/minimal_init.lua). +If you have an issue with 'lspconfig', the first step is to reproduce with a [minimal configuration](https://github.com/neovim/nvim-lspconfig/blob/master/test/minimal_init.lua). The most common reasons a language server does not start or attach are: -1. The language server is not installed. nvim-lspconfig does not install language servers for you. You should be able to run the `cmd` defined in each server's lua module from the command line and see that the language server starts. If the `cmd` is an executable name, ensure it is on your path. +1. The language server is not installed. 'lspconfig' does not install language servers for you. You should be able to run the `cmd` defined in each server's lua module from the command line and see that the language server starts. If the `cmd` is an executable name, ensure it is on your path. 2. Not triggering root detection. The language server will only start if it is opened in a directory, or child directory, containing a file which signals the *root* of the project. Most of the time, this is a `.git` folder, but each server defines the root config in the lua file. See [server_configurations.md](server_configurations.md) or the source for the list of root directories. diff --git a/doc/lspconfig.txt b/doc/lspconfig.txt index dc017817..1a52010f 100644 --- a/doc/lspconfig.txt +++ b/doc/lspconfig.txt @@ -8,11 +8,11 @@ TABLE OF CONTENTS *lspconfig-toc* 4. Setup {} (|lspconfig-setup|) 5. Global defaults (|lspconfig-global-defaults|) 6. Server configurations (|lspconfig-configurations|) - 6a. Adding Servers (|lspconfig-adding-servers|) + 6a. Adding servers (|lspconfig-adding-servers|) 6b. Index (|lspconfig-index|) -7. Root directories (|lspconfig-root-directories|) - 6a. Root composition (|lspconfig-root-composition|) - 6b. Single file support (|lspconfig-single-file-support|) +7. Root directories (|lspconfig-root-detection|) + 7a. Advanced detection (|lspconfig-root-advanced|) + 7b. Single file support (|lspconfig-single-file-support|) 8. Commands (|lspconfig-commands|) 9. Keybindings (|lspconfig-keybindings|) 10. Completion (|lspconfig-completion|) @@ -100,7 +100,7 @@ language server. This autocommand calls `start_client()` or `vim.lsp.buf_attach_client()` depending on whether the current file belongs to a project with a currently -running client. See |lspconfig-root-directory| for more details. +running client. See |lspconfig-root-detection| for more details. The `setup{}` function takes a table which contains a superset of the keys listed in `:help vim.lsp.start_client()` with the following unique entries: @@ -114,7 +114,7 @@ listed in `:help vim.lsp.start_client()` with the following unique entries: If a root directory (string) is returned which is unique from any previously returned root_dir, a new server will be spawned with that - root directory. See |lspconfig-root-directory| for more details + root directory. See |lspconfig-root-detection| for more details - {name} @@ -137,7 +137,7 @@ listed in `:help vim.lsp.start_client()` with the following unique entries: Controls if the `FileType` autocommand that launches a language server is created. If `false`, allows for deferring language servers until manually launched with `:LspStart` (|lspconfig-commands|). - +Heyward - {on_new_config} `function(new_config, new_root_dir)` @@ -405,7 +405,8 @@ below returns a function that takes as its argument the current buffer path. root_dir = util.find_json_ancestor < ============================================================================== -ADVANCED ROOT DIRECTORY DETECTION *lspconfig-root-composition* +ADVANCED ROOT DIRECTORY DETECTION *lspconfig-root-advanced* + *lspconfig-root-composition* The `root_dir` key in `config` and `setup` can hold any function of the form > @@ -586,7 +587,7 @@ For debugging `lspconfig` issues, the most common hurdles users face are: line. If the absolute path to the binary is not supplied in `cmd`, ensure it is on your PATH. - No root detected. `lspconfig` is built around the concept of projects. See - |lspconfig-root-directory| for more details. Most of the time, + |lspconfig-root-detection| for more details. Most of the time, initializing a git repo will suffice. - Misconfiguration. Often users will override `cmd`, `on_init`, or `handlers`. Ensure that you debug by using a stock configuration to ensure |
