mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-13 22:59:15 +08:00
parent
4d3c680a93
commit
1c4627c212
6
bundle/nvim-lspconfig-latest/.github/CODEOWNERS
vendored
Normal file
6
bundle/nvim-lspconfig-latest/.github/CODEOWNERS
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
* @glepnir
|
||||
|
||||
/.github/ @dundargoc
|
||||
|
||||
/flake.lock @teto
|
||||
/flake.nix @teto
|
@ -5,73 +5,12 @@ body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Before reporting: search existing issues and ensure you are running the latest nightly of neovim and the latest version of nvim-lspconfig. Note that this repository implements configuration and initialization of language servers. Implementation of the language server spec itself is located in the neovim core repository.
|
||||
Do NOT file bugs in this repo. The configs in this repo are unsupported and provided only as a starting point. We depend on users (like you) to troubleshoot issues with their specific LSP setups and [send improvements](https://github.com/neovim/nvim-lspconfig/blob/master/CONTRIBUTING.md).
|
||||
|
||||
If you have a feature request or found a bug in the core Nvim `vim.lsp` module (not this repo), [report it to Nvim](https://github.com/neovim/neovim/issues/new?assignees=&labels=bug%2Clsp&projects=&template=lsp_bug_report.yml).
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Description"
|
||||
description: "A short description of the problem you are reporting."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Neovim version"
|
||||
description: "Output of `nvim --version`"
|
||||
placeholder: |
|
||||
NVIM v0.6.0-dev+209-g0603eba6e
|
||||
Build type: Release
|
||||
LuaJIT 2.1.0-beta3
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: "Nvim-lspconfig version"
|
||||
description: "Commit hash"
|
||||
placeholder: 1344a859864d4e6d23d3f3adf56d49e6386ec0d2
|
||||
- type: input
|
||||
attributes:
|
||||
label: "Operating system and version"
|
||||
placeholder: "macOS 11.5"
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: "Affected language servers"
|
||||
description: "If this issue is specific to one or more language servers, list them here. If not, write 'all'."
|
||||
placeholder: "clangd"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Steps to reproduce"
|
||||
description: "Steps to reproduce using the minimal config provided below."
|
||||
placeholder: |
|
||||
1. `nvim -nu minimal.lua`
|
||||
2. ...
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Actual behavior"
|
||||
description: "Observed behavior."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Expected behavior"
|
||||
description: "A description of the behavior you expected."
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Minimal config"
|
||||
render: Lua
|
||||
description: "You can download a minimal_init.lua via `curl -fLO https://raw.githubusercontent.com/neovim/nvim-lspconfig/master/test/minimal_init.lua`. Then edit it to include your language server and add necessary configuration and paste it here."
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: "LSP log"
|
||||
description: "If not using the `minimal_init.lua`, add `vim.lsp.set_log_level('debug')` to your LSP setup, upload the log file at `$HOME/.cache/nvim/lsp.log` to https://gist.github.com, and paste the link here."
|
||||
validations:
|
||||
required: true
|
||||
|
||||
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Question
|
||||
url: https://neovim.discourse.group/c/language-server-protocol-lsp/7
|
||||
about: Usage questions and support requests are answered in the Neovim Discourse
|
||||
|
||||
url: https://vi.stackexchange.com/
|
||||
about: Usage questions and support requests
|
||||
|
@ -1,24 +0,0 @@
|
||||
name: Feature request
|
||||
description: Request a feature in nvim-lspconfig
|
||||
labels: [enhancement]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Before requesting a new feature, search existing issues. Implementation of the language server protocol itself is located in the neovim core repository, and general feature requests may be better suited for core.
|
||||
- type: input
|
||||
attributes:
|
||||
label: "Language server"
|
||||
description: "Is the feature specific to a language server? If so, which one(s)?"
|
||||
placeholder: "clangd"
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Requested feature"
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: "Other clients which have this feature"
|
||||
description: "Is the feature already implemented in another LSP client for (Neo)Vim? If so, which one(s)?"
|
||||
placeholder: "vim-lsp"
|
||||
|
@ -4,7 +4,7 @@ jobs:
|
||||
codespell:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install codespell
|
||||
run: pip install codespell
|
||||
- name: Use codespell
|
||||
|
@ -1,7 +1,7 @@
|
||||
name: "Check changes to config"
|
||||
on: [pull_request_target]
|
||||
jobs:
|
||||
close-changes:
|
||||
check-config-changes:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
@ -9,12 +9,11 @@ jobs:
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- run: |
|
||||
if ! git diff origin/$GITHUB_BASE_REF...$(git branch --show-current) --exit-code -- doc/server_configurations.md doc/server_configurations.txt; then
|
||||
gh pr comment $PR_NUMBER --body 'Do not change `server_configurations.md` directly. Edit the lua source file instead. See https://github.com/neovim/nvim-lspconfig/blob/master/CONTRIBUTING.md#generating-docs'
|
||||
exit 1
|
||||
gh pr comment $PR_NUMBER --body 'Note that `server_configurations.md` or `server_configurations.txt` will be regenerated by the docgen CI process. Edit the Lua source file instead. For details on generating documentation, see: https://github.com/neovim/nvim-lspconfig/blob/master/CONTRIBUTING.md#generating-docs'
|
||||
fi
|
||||
|
@ -3,7 +3,7 @@ jobs:
|
||||
lint-commits:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- run: npm install --save-dev @commitlint/{cli,config-conventional}
|
||||
|
@ -11,7 +11,7 @@ jobs:
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: rhysd/action-setup-vim@v1
|
||||
with:
|
||||
neovim: true
|
||||
@ -25,8 +25,8 @@ jobs:
|
||||
docs: update server_configurations.md
|
||||
skip-checks: true
|
||||
run: |
|
||||
git config user.name github-actions
|
||||
git config user.email github-actions@github.com
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add doc/server_configurations.md doc/server_configurations.txt
|
||||
# Only commit and push if we have changes
|
||||
git diff --quiet && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push)
|
||||
|
@ -10,7 +10,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run luacheck
|
||||
uses: lunarmodules/luacheck@v1
|
||||
@ -27,10 +27,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Lint with stylua
|
||||
uses: JohnnyMorganz/stylua-action@v3
|
||||
uses: JohnnyMorganz/stylua-action@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
version: latest
|
||||
|
@ -7,7 +7,7 @@ jobs:
|
||||
luarocks-upload:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: LuaRocks Upload
|
||||
uses: nvim-neorocks/luarocks-tag-release@v5
|
||||
env:
|
||||
|
@ -3,12 +3,11 @@ on: [pull_request]
|
||||
jobs:
|
||||
disallowed-root-checker:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- run: |
|
||||
if ! bash .github/ci/run_sanitizer.sh ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}; then
|
||||
exit 1
|
||||
|
@ -13,7 +13,7 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: rhysd/action-setup-vim@v1
|
||||
id: vim
|
||||
with:
|
||||
|
@ -1,13 +1,12 @@
|
||||
## Requirements
|
||||
|
||||
- [Neovim](https://neovim.io/) 0.6 or later
|
||||
- Lint task requires [luacheck](https://github.com/luarocks/luacheck#installation) and [stylua](https://github.com/JohnnyMorganz/StyLua). If using nix, you can use `nix develop` to install these to a local nix shell.
|
||||
- [Link requirements](#Lint)
|
||||
- Documentation is generated by `scripts/docgen.lua`.
|
||||
- Only works on linux and macOS
|
||||
|
||||
## Scope of lspconfig
|
||||
|
||||
The point of lspconfig is to provide the minimal configuration necessary for a server to act in compliance with the language server protocol. In general, if a server requires custom client-side commands or off-spec handlers, then the server configuration should be added *without* those in lspconfig and receive a dedicated plugin such as nvim-jdtls, nvim-metals, etc.
|
||||
The point of lspconfig is to provide the minimal configuration necessary for a server to act in compliance with the language server protocol. In general, if a server requires custom client-side commands or off-spec handlers, then the server configuration should be added *without* those in lspconfig and receive a dedicated plugin such as nvim-jdtls, nvim-metals, etc.
|
||||
|
||||
## Pull requests (PRs)
|
||||
|
||||
@ -107,10 +106,17 @@ with the commit body containing additional details.
|
||||
|
||||
## Lint
|
||||
|
||||
PRs are checked with [luacheck](https://github.com/mpeterv/luacheck), [StyLua](https://github.com/JohnnyMorganz/StyLua) and [selene](https://github.com/Kampfkarren/selene). Please run the linter locally before submitting a PR:
|
||||
PRs are checked with the following software:
|
||||
- [luacheck](https://github.com/luarocks/luacheck#installation)
|
||||
- [stylua](https://github.com/JohnnyMorganz/StyLua).
|
||||
- [selene](https://github.com/Kampfkarren/selene)
|
||||
|
||||
Please run the linter locally before submitting a PR:
|
||||
|
||||
make lint
|
||||
|
||||
If using nix, you can use `nix develop` to install these to a local nix shell.
|
||||
|
||||
## Generating docs
|
||||
|
||||
GitHub Actions automatically generates `server_configurations.md`. Only modify `scripts/README_template.md` or the `docs` table in the server config Lua file. Do not modify `server_configurations.md` directly.
|
||||
|
@ -4,16 +4,21 @@
|
||||
|
||||
* **Do not file Nvim LSP client issues here.** The Nvim LSP client does not live here. This is only a collection of LSP configs.
|
||||
* If you found a bug in the Nvim LSP client, [report it at the Nvim core repo](https://github.com/neovim/neovim/issues/new?assignees=&labels=bug%2Clsp&template=lsp_bug_report.yml).
|
||||
* These configs are **best-effort and unsupported.** See [contributions](#contributions).
|
||||
* These configs are **best-effort and supported by the community.** See [contributions](#contributions).
|
||||
|
||||
See also `:help lsp-config`.
|
||||
See also `:help lspconfig`.
|
||||
|
||||
## Install
|
||||
|
||||
[](https://luarocks.org/modules/neovim/nvim-lspconfig)
|
||||
|
||||
* Requires neovim version 0.8 above. Update Nvim and nvim-lspconfig before reporting an issue.
|
||||
* Install nvim-lspconfig as a normal plugin through neovim builtin `packadd` or a plugin manager
|
||||
|
||||
* Install nvim-lspconfig using builtin packages:
|
||||
|
||||
git clone https://github.com/neovim/nvim-lspconfig ~/.config/nvim/pack/nvim/start/nvim-lspconfig
|
||||
|
||||
* Alternatively, nvim-lspconfig can be installed using a 3rd party plugin manager (consult the documentation for your plugin manager for details).
|
||||
|
||||
## Quickstart
|
||||
|
||||
@ -29,69 +34,58 @@ See also `:help lsp-config`.
|
||||
```
|
||||
nvim main.py
|
||||
```
|
||||
4. Run `:LspInfo` to see the status or to troubleshoot.
|
||||
5. See [Suggested configuration](#Suggested-configuration) to setup common mappings and omnifunc completion.
|
||||
4. Run `:checkhealth lsp` to see the status or to troubleshoot.
|
||||
|
||||
See [server_configurations.md](doc/server_configurations.md) (`:help lspconfig-all` from Nvim) for the full list of configs, including installation instructions and additional, optional, customization suggestions for each language server. For servers that are not on your system path (e.g., `jdtls`, `elixirls`), you must manually add `cmd` to the `setup` parameter. Most language servers can be installed in less than a minute.
|
||||
|
||||
## Suggested configuration
|
||||
## Configuration
|
||||
|
||||
nvim-lspconfig does not set keybindings or enable completion by default. 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\>).
|
||||
Nvim sets some default options whenever a buffer attaches to an LSP client. See [`:h lsp-config`][lsp-config] for more details. In particular, the following options are set:
|
||||
|
||||
* [`'tagfunc'`][tagfunc]
|
||||
- Enables "go to definition" capabilities using [`<C-]>`][tagjump] and other [tag commands][tag-commands].
|
||||
* [`'omnifunc'`][omnifunc]
|
||||
- Enables (manual) omni mode completion with `<C-X><C-O>` in Insert mode. For *auto*completion, an [autocompletion plugin](https://github.com/neovim/nvim-lspconfig/wiki/Autocompletion) is required.
|
||||
* [`'formatexpr'`][formatexpr]
|
||||
- Enables LSP formatting with [`gq`][gq].
|
||||
|
||||
Nvim also maps `K` to [`vim.lsp.buf.hover()`][vim.lsp.buf.hover] in Normal mode.
|
||||
|
||||
Nvim 0.10 and newer creates the following default maps unconditionally:
|
||||
|
||||
* `[d` and `]d` map to `vim.diagnostic.goto_prev()` and `vim.diagnostic.goto_next()` (respectively)
|
||||
* `<C-W>d` maps to `vim.diagnostic.open_float()`
|
||||
|
||||
[lsp-config]: https://neovim.io/doc/user/lsp.html#lsp-config
|
||||
[tagfunc]: https://neovim.io/doc/user/tagsrch.html#tag-function
|
||||
[omnifunc]: https://neovim.io/doc/user/options.html#'omnifunc'
|
||||
[formatexpr]: https://neovim.io/doc/user/options.html#'formatexpr'
|
||||
[gq]: https://neovim.io/doc/user/change.html#gq
|
||||
[vim.lsp.buf.hover]: https://neovim.io/doc/user/lsp.html#vim.lsp.buf.hover()
|
||||
[tagjump]: https://neovim.io/doc/user/tagsrch.html#CTRL-%5D
|
||||
[tag-commands]: https://neovim.io/doc/user/tagsrch.html#tag-commands
|
||||
|
||||
Further customization can be achieved using the [`LspAttach`][LspAttach] autocommand event.
|
||||
The [`LspDetach`][LspAttach] autocommand event can be used to "cleanup" mappings if a buffer becomes detached from an LSP server.
|
||||
See [`:h LspAttach`][LspAttach] and [`:h LspDetach`][LspDetach] for details and examples.
|
||||
See [`:h lsp-buf`][lsp-buf] for details on other LSP functions.
|
||||
|
||||
[LspAttach]: https://neovim.io/doc/user/lsp.html#LspAttach
|
||||
[LspDetach]: https://neovim.io/doc/user/lsp.html#LspDetach
|
||||
[lsp-buf]: https://neovim.io/doc/user/lsp.html#lsp-buf
|
||||
|
||||
Additional configuration options can be provided for each LSP server by passing arguments to the `setup` function. See `:h lspconfig-setup` for details. Example:
|
||||
|
||||
```lua
|
||||
-- Setup language servers.
|
||||
local lspconfig = require('lspconfig')
|
||||
lspconfig.pyright.setup {}
|
||||
lspconfig.tsserver.setup {}
|
||||
lspconfig.rust_analyzer.setup {
|
||||
-- Server-specific settings. See `:help lspconfig-setup`
|
||||
settings = {
|
||||
['rust-analyzer'] = {},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
-- Global mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
|
||||
|
||||
-- Use LspAttach autocommand to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||
callback = function(ev)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
|
||||
-- Buffer local mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local opts = { buffer = ev.buf }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, opts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||
vim.keymap.set('n', '<space>f', function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end, opts)
|
||||
end,
|
||||
})
|
||||
```
|
||||
|
||||
Manual, triggered completion is provided by Nvim's builtin omnifunc. For *auto*completion, a general purpose [autocompletion plugin](https://github.com/neovim/nvim-lspconfig/wiki/Autocompletion) is required.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you have an issue, the first step is to reproduce with a [minimal configuration](https://github.com/neovim/nvim-lspconfig/blob/master/test/minimal_init.lua).
|
||||
@ -143,7 +137,15 @@ a new configuration for it helps others, especially if the server requires speci
|
||||
- Copy an [existing config](https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/)
|
||||
to get started. Most configs are simple. For an extensive example see
|
||||
[texlab.lua](https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/texlab.lua).
|
||||
3. Ask questions on our [Discourse](https://neovim.discourse.group/c/7-category/7) or in the [Neovim Matrix room](https://app.element.io/#/room/#neovim:matrix.org).
|
||||
3. Ask questions on [GitHub Discussions](https://github.com/neovim/neovim/discussions) or in the [Neovim Matrix room](https://app.element.io/#/room/#neovim:matrix.org).
|
||||
|
||||
### Release process
|
||||
|
||||
To publish a release:
|
||||
|
||||
- Create and push a new [tag](https://github.com/neovim/nvim-lspconfig/tags).
|
||||
- After pushing the tag, a [GitHub action](./.github/workflows/release.yml)
|
||||
will automatically package the plugin and publish the release to LuaRocks.
|
||||
|
||||
## License
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
*lspconfig.txt* For Nvim version 0.7+
|
||||
*lspconfig.txt* For Nvim version 0.8+
|
||||
|
||||
nvim-lspconfig provides user-contributed configs for the Nvim |lsp| client.
|
||||
|
||||
@ -168,13 +168,13 @@ passed overrides to `setup {}` are:
|
||||
|
||||
Callback invoked by Nvim's built-in client when attaching a buffer to a
|
||||
language server. Often used to set Nvim (buffer or global) options or to
|
||||
override the Nvim client properties (`resolved_capabilities`) after a
|
||||
override the Nvim client properties (`server_capabilities`) after a
|
||||
language server attaches. Most commonly used for settings buffer
|
||||
local keybindings. See |lspconfig-keybindings| for a usage example.
|
||||
|
||||
- {settings} `table <string, string|table|bool>`
|
||||
|
||||
The `settings` table is sent in `on_init` via a
|
||||
The `settings` table is sent after initialization via a
|
||||
`workspace/didChangeConfiguration` notification from the Nvim client to
|
||||
the language server. These settings allow a user to change optional runtime
|
||||
settings of the language server.
|
||||
@ -371,7 +371,8 @@ below returns a function that takes as its argument the current buffer path.
|
||||
- `util.root_pattern`: function which takes multiple arguments, each
|
||||
corresponding to a different root pattern against which the contents of the
|
||||
current directory are matched using |vim.fn.glob()| while traversing up the
|
||||
filesystem.
|
||||
filesystem. Parent directories are traversed once per pattern, in the order
|
||||
the patterns are specified.
|
||||
>
|
||||
root_dir = util.root_pattern('pyproject.toml', 'requirements.txt')
|
||||
<
|
||||
@ -389,7 +390,7 @@ below returns a function that takes as its argument the current buffer path.
|
||||
- `util.find_package_json_ancestor`: a function that locates the first parent
|
||||
directory containing a `package.json`.
|
||||
>
|
||||
root_dir = util.find_json_ancestor
|
||||
root_dir = util.find_package_json_ancestor
|
||||
<
|
||||
Note: On Windows, `lspconfig` always assumes forward slash normalized paths with
|
||||
capitalized drive letters.
|
||||
@ -476,71 +477,65 @@ contained in `:LspInfo`:
|
||||
EXAMPLE KEYBINDINGS *lspconfig-keybindings*
|
||||
|
||||
`lspconfig`, and the core client, do not map any keybindings by default. The
|
||||
following is an example Lua block which demonstrates how to leverage
|
||||
`on-attach` to selectively apply keybindings after a language servers has
|
||||
attached to a given buffer.
|
||||
following is an example Lua block which demonstrates how to leverage the
|
||||
`LspAttach` (Nvim 0.8+) autocommand to apply keybindings after a language
|
||||
server has attached to a given buffer.
|
||||
>
|
||||
>
|
||||
-- Mappings.
|
||||
-- Setup language servers.
|
||||
local lspconfig = require('lspconfig')
|
||||
lspconfig.pyright.setup {}
|
||||
lspconfig.tsserver.setup {}
|
||||
lspconfig.rust_analyzer.setup {
|
||||
-- Server-specific settings. See `:help lspconfig-setup`
|
||||
settings = {
|
||||
['rust-analyzer'] = {},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
-- Global mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
local opts = { noremap=true, silent=true }
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- Use LspAttach autocommand to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||
callback = function(ev)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap=true, silent=true, buffer=bufnr }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<space>f', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
end
|
||||
|
||||
local lsp_flags = {
|
||||
-- This is the default in Nvim 0.7+
|
||||
debounce_text_changes = 150,
|
||||
}
|
||||
require('lspconfig')['pyright'].setup{
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
}
|
||||
require('lspconfig')['tsserver'].setup{
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
}
|
||||
require('lspconfig')['rust_analyzer'].setup{
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
-- Server-specific settings...
|
||||
settings = {
|
||||
["rust-analyzer"] = {}
|
||||
}
|
||||
}
|
||||
-- Buffer local mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local opts = { buffer = ev.buf }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, opts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||
vim.keymap.set('n', '<space>f', function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end, opts)
|
||||
end,
|
||||
})
|
||||
|
||||
==============================================================================
|
||||
COMPLETION SUPPORT *lspconfig-completion*
|
||||
|
||||
Manually triggered completion can be provided by Nvim's built-in omnifunc.
|
||||
See |lsp-config|.
|
||||
See |lspconfig|.
|
||||
|
||||
For autocompletion, Nvim does not provide built-in functionality. Consult the
|
||||
nvim-lspconfig wiki, which provides configuration examples for using
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
35
bundle/nvim-lspconfig-latest/flake.lock
generated
35
bundle/nvim-lspconfig-latest/flake.lock
generated
@ -1,12 +1,15 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1656928814,
|
||||
"narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
|
||||
"lastModified": 1694529238,
|
||||
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
|
||||
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -17,16 +20,17 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1659522808,
|
||||
"narHash": "sha256-HBcM19nGhI3IWwPNVlYb0MZ8VW6iKp4JbAVkeIHVykc=",
|
||||
"lastModified": 1699906975,
|
||||
"narHash": "sha256-tvLhyy1iQj3vdW8tYt2uPNoTWt6FB87tG2HaaErk6tk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "168d1c578909dc143ba52dbed661c36e76b12b36",
|
||||
"rev": "5c6e85ee472d37c904dd43f8f76b680602b9128f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
@ -34,6 +38,21 @@
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
description = "Quickstart configurations for the Nvim LSP client";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
@ -11,6 +12,7 @@
|
||||
buildInputs = [
|
||||
pkgs.stylua
|
||||
pkgs.luaPackages.luacheck
|
||||
pkgs.luajitPackages.vusted
|
||||
pkgs.selene
|
||||
];
|
||||
};
|
||||
|
@ -15,6 +15,10 @@ local function server_alias(name)
|
||||
to = 'fennel_ls',
|
||||
version = '0.2.0',
|
||||
},
|
||||
ruby_ls = {
|
||||
to = 'ruby_lsp',
|
||||
version = '0.2.0',
|
||||
},
|
||||
['starlark-rust'] = {
|
||||
to = 'starlark_rust',
|
||||
version = '0.2.0',
|
||||
|
70
bundle/nvim-lspconfig-latest/lua/lspconfig/async.lua
Normal file
70
bundle/nvim-lspconfig-latest/lua/lspconfig/async.lua
Normal file
@ -0,0 +1,70 @@
|
||||
local M = {}
|
||||
|
||||
function M.run(func)
|
||||
coroutine.resume(coroutine.create(function()
|
||||
local status, err = pcall(func)
|
||||
if not status then
|
||||
vim.notify(('[lspconfig] unhandled error: %s'):format(tostring(err)), vim.log.levels.WARN)
|
||||
end
|
||||
end))
|
||||
end
|
||||
|
||||
--- @param cmd string|string[]
|
||||
--- @return string[]?
|
||||
function M.run_command(cmd)
|
||||
local co = assert(coroutine.running())
|
||||
|
||||
local stdout = {}
|
||||
local stderr = {}
|
||||
local exit_code = nil
|
||||
|
||||
local jobid = vim.fn.jobstart(cmd, {
|
||||
on_stdout = function(_, data, _)
|
||||
data = table.concat(data, '\n')
|
||||
if #data > 0 then
|
||||
stdout[#stdout + 1] = data
|
||||
end
|
||||
end,
|
||||
on_stderr = function(_, data, _)
|
||||
stderr[#stderr + 1] = table.concat(data, '\n')
|
||||
end,
|
||||
on_exit = function(_, code, _)
|
||||
exit_code = code
|
||||
coroutine.resume(co)
|
||||
end,
|
||||
stdout_buffered = true,
|
||||
stderr_buffered = true,
|
||||
})
|
||||
|
||||
if jobid <= 0 then
|
||||
vim.notify(('[lspconfig] unable to run cmd: %s'):format(cmd), vim.log.levels.WARN)
|
||||
return nil
|
||||
end
|
||||
|
||||
coroutine.yield()
|
||||
|
||||
if exit_code ~= 0 then
|
||||
vim.notify(
|
||||
('[lspconfig] cmd failed with code %d: %s\n%s'):format(exit_code, cmd, table.concat(stderr, '')),
|
||||
vim.log.levels.WARN
|
||||
)
|
||||
return nil
|
||||
end
|
||||
|
||||
if next(stdout) == nil then
|
||||
return nil
|
||||
end
|
||||
return stdout and stdout or nil
|
||||
end
|
||||
|
||||
function M.reenter()
|
||||
if vim.in_fast_event() then
|
||||
local co = assert(coroutine.running())
|
||||
vim.schedule(function()
|
||||
coroutine.resume(co)
|
||||
end)
|
||||
coroutine.yield()
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
@ -1,26 +1,28 @@
|
||||
local util = require 'lspconfig.util'
|
||||
local async = require 'lspconfig.async'
|
||||
local api, validate, lsp, uv, fn = vim.api, vim.validate, vim.lsp, vim.loop, vim.fn
|
||||
local tbl_deep_extend = vim.tbl_deep_extend
|
||||
|
||||
local configs = {}
|
||||
|
||||
local function reenter()
|
||||
if vim.in_fast_event() then
|
||||
local co = assert(coroutine.running())
|
||||
vim.schedule(function()
|
||||
coroutine.resume(co)
|
||||
end)
|
||||
coroutine.yield()
|
||||
end
|
||||
end
|
||||
--- @class lspconfig.Config : vim.lsp.ClientConfig
|
||||
--- @field enabled? boolean
|
||||
--- @field single_file_support? boolean
|
||||
--- @field filetypes? string[]
|
||||
--- @field filetype? string
|
||||
--- @field on_new_config? function
|
||||
--- @field autostart? boolean
|
||||
--- @field package _on_attach? fun(client: vim.lsp.Client, bufnr: integer)
|
||||
|
||||
local function async_run(func)
|
||||
coroutine.resume(coroutine.create(function()
|
||||
local status, err = pcall(func)
|
||||
if not status then
|
||||
vim.notify(('[lspconfig] unhandled error: %s'):format(tostring(err)), vim.log.levels.WARN)
|
||||
--- @param cmd any
|
||||
local function sanitize_cmd(cmd)
|
||||
if cmd and type(cmd) == 'table' and not vim.tbl_isempty(cmd) then
|
||||
local original = cmd[1]
|
||||
cmd[1] = vim.fn.exepath(cmd[1])
|
||||
if #cmd[1] == 0 then
|
||||
cmd[1] = original
|
||||
end
|
||||
end))
|
||||
end
|
||||
end
|
||||
|
||||
function configs.__newindex(t, config_name, config_def)
|
||||
@ -60,6 +62,7 @@ function configs.__newindex(t, config_name, config_def)
|
||||
-- Force this part.
|
||||
default_config.name = config_name
|
||||
|
||||
--- @param user_config lspconfig.Config
|
||||
function M.setup(user_config)
|
||||
local lsp_group = api.nvim_create_augroup('lspconfig', { clear = false })
|
||||
|
||||
@ -86,13 +89,7 @@ function configs.__newindex(t, config_name, config_def)
|
||||
|
||||
local config = tbl_deep_extend('keep', user_config, default_config)
|
||||
|
||||
if config.cmd and type(config.cmd) == 'table' and not vim.tbl_isempty(config.cmd) then
|
||||
local original = config.cmd[1]
|
||||
config.cmd[1] = vim.fn.exepath(config.cmd[1])
|
||||
if #config.cmd[1] == 0 then
|
||||
config.cmd[1] = original
|
||||
end
|
||||
end
|
||||
sanitize_cmd(config.cmd)
|
||||
|
||||
if util.on_setup then
|
||||
pcall(util.on_setup, config, user_config)
|
||||
@ -104,7 +101,7 @@ function configs.__newindex(t, config_name, config_def)
|
||||
api.nvim_create_autocmd(event_conf.event, {
|
||||
pattern = event_conf.pattern or '*',
|
||||
callback = function(opt)
|
||||
M.manager.try_add(opt.buf)
|
||||
M.manager:try_add(opt.buf)
|
||||
end,
|
||||
group = lsp_group,
|
||||
desc = string.format(
|
||||
@ -118,6 +115,9 @@ function configs.__newindex(t, config_name, config_def)
|
||||
|
||||
function M.launch(bufnr)
|
||||
bufnr = bufnr or api.nvim_get_current_buf()
|
||||
if not api.nvim_buf_is_valid(bufnr) then
|
||||
return
|
||||
end
|
||||
local bufname = api.nvim_buf_get_name(bufnr)
|
||||
if (#bufname == 0 and not config.single_file_support) or (#bufname ~= 0 and not util.bufname_valid(bufname)) then
|
||||
return
|
||||
@ -125,11 +125,11 @@ function configs.__newindex(t, config_name, config_def)
|
||||
|
||||
local pwd = uv.cwd()
|
||||
|
||||
async_run(function()
|
||||
async.run(function()
|
||||
local root_dir
|
||||
if get_root_dir then
|
||||
root_dir = get_root_dir(util.path.sanitize(bufname), bufnr)
|
||||
reenter()
|
||||
async.reenter()
|
||||
if not api.nvim_buf_is_valid(bufnr) then
|
||||
return
|
||||
end
|
||||
@ -139,7 +139,10 @@ function configs.__newindex(t, config_name, config_def)
|
||||
api.nvim_create_autocmd('BufReadPost', {
|
||||
pattern = fn.fnameescape(root_dir) .. '/*',
|
||||
callback = function(arg)
|
||||
M.manager.try_add_wrapper(arg.buf, root_dir)
|
||||
if #M.manager:clients() == 0 then
|
||||
return true
|
||||
end
|
||||
M.manager:try_add_wrapper(arg.buf, root_dir)
|
||||
end,
|
||||
group = lsp_group,
|
||||
desc = string.format(
|
||||
@ -154,7 +157,7 @@ function configs.__newindex(t, config_name, config_def)
|
||||
if util.bufname_valid(buf_name) then
|
||||
local buf_dir = util.path.sanitize(buf_name)
|
||||
if buf_dir:sub(1, root_dir:len()) == root_dir then
|
||||
M.manager.try_add_wrapper(buf, root_dir)
|
||||
M.manager:try_add_wrapper(buf, root_dir)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -167,7 +170,7 @@ function configs.__newindex(t, config_name, config_def)
|
||||
return
|
||||
end
|
||||
local pseudo_root = #bufname == 0 and pwd or util.path.dirname(util.path.sanitize(bufname))
|
||||
M.manager.add(pseudo_root, true, bufnr)
|
||||
M.manager:add(pseudo_root, true, bufnr)
|
||||
end
|
||||
end)
|
||||
end
|
||||
@ -182,7 +185,7 @@ function configs.__newindex(t, config_name, config_def)
|
||||
-- In the case of a reload, close existing things.
|
||||
local reload = false
|
||||
if M.manager then
|
||||
for _, client in ipairs(M.manager.clients()) do
|
||||
for _, client in ipairs(M.manager:clients()) do
|
||||
client.stop(true)
|
||||
end
|
||||
reload = true
|
||||
@ -190,7 +193,7 @@ function configs.__newindex(t, config_name, config_def)
|
||||
end
|
||||
|
||||
local make_config = function(root_dir)
|
||||
local new_config = tbl_deep_extend('keep', vim.empty_dict(), config)
|
||||
local new_config = tbl_deep_extend('keep', vim.empty_dict(), config) --[[@as lspconfig.Config]]
|
||||
new_config.capabilities = tbl_deep_extend('keep', new_config.capabilities, {
|
||||
workspace = {
|
||||
configuration = true,
|
||||
@ -222,9 +225,6 @@ function configs.__newindex(t, config_name, config_def)
|
||||
settings = settings,
|
||||
})
|
||||
end
|
||||
if not vim.tbl_isempty(new_config.settings) then
|
||||
client.workspace_did_change_configuration(new_config.settings)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Save the old _on_attach so that we can reference it via the BufEnter.
|
||||
@ -257,69 +257,13 @@ function configs.__newindex(t, config_name, config_def)
|
||||
return new_config
|
||||
end
|
||||
|
||||
local manager = util.server_per_root_dir_manager(function(root_dir)
|
||||
return make_config(root_dir)
|
||||
end)
|
||||
|
||||
-- Try to attach the buffer `bufnr` to a client using this config, creating
|
||||
-- a new client if one doesn't already exist for `bufnr`.
|
||||
function manager.try_add(bufnr, project_root)
|
||||
bufnr = bufnr or api.nvim_get_current_buf()
|
||||
|
||||
if api.nvim_buf_get_option(bufnr, 'buftype') == 'nofile' then
|
||||
return
|
||||
end
|
||||
local pwd = uv.cwd()
|
||||
|
||||
local bufname = api.nvim_buf_get_name(bufnr)
|
||||
if #bufname == 0 and not config.single_file_support then
|
||||
return
|
||||
elseif #bufname ~= 0 then
|
||||
if not util.bufname_valid(bufname) then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if project_root then
|
||||
manager.add(project_root, false, bufnr)
|
||||
return
|
||||
end
|
||||
|
||||
local buf_path = util.path.sanitize(bufname)
|
||||
|
||||
async_run(function()
|
||||
local root_dir
|
||||
if get_root_dir then
|
||||
root_dir = get_root_dir(buf_path, bufnr)
|
||||
reenter()
|
||||
if not api.nvim_buf_is_valid(bufnr) then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if root_dir then
|
||||
manager.add(root_dir, false, bufnr)
|
||||
elseif config.single_file_support then
|
||||
local pseudo_root = #bufname == 0 and pwd or util.path.dirname(buf_path)
|
||||
manager.add(pseudo_root, true, bufnr)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- Check that the buffer `bufnr` has a valid filetype according to
|
||||
-- `config.filetypes`, then do `manager.try_add(bufnr)`.
|
||||
function manager.try_add_wrapper(bufnr, project_root)
|
||||
-- `config.filetypes = nil` means all filetypes are valid.
|
||||
if not config.filetypes or vim.tbl_contains(config.filetypes, vim.bo[bufnr].filetype) then
|
||||
manager.try_add(bufnr, project_root)
|
||||
end
|
||||
end
|
||||
local manager = require('lspconfig.manager').new(config, make_config)
|
||||
|
||||
M.manager = manager
|
||||
M.make_config = make_config
|
||||
if reload and config.autostart ~= false then
|
||||
for _, bufnr in ipairs(api.nvim_list_bufs()) do
|
||||
manager.try_add_wrapper(bufnr)
|
||||
manager:try_add_wrapper(bufnr)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -329,8 +273,9 @@ function configs.__newindex(t, config_name, config_def)
|
||||
if not client then
|
||||
return
|
||||
end
|
||||
if client.config._on_attach then
|
||||
client.config._on_attach(client, bufnr)
|
||||
local config = client.config --[[@as lspconfig.Config]]
|
||||
if config._on_attach then
|
||||
config._on_attach(client, bufnr)
|
||||
end
|
||||
if client.config.commands and not vim.tbl_isempty(client.config.commands) then
|
||||
M.commands = vim.tbl_deep_extend('force', M.commands, client.config.commands)
|
||||
|
302
bundle/nvim-lspconfig-latest/lua/lspconfig/manager.lua
Normal file
302
bundle/nvim-lspconfig-latest/lua/lspconfig/manager.lua
Normal file
@ -0,0 +1,302 @@
|
||||
local api = vim.api
|
||||
local lsp = vim.lsp
|
||||
local uv = vim.loop
|
||||
|
||||
local async = require 'lspconfig.async'
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
---@param client vim.lsp.Client
|
||||
---@param root_dir string
|
||||
---@return boolean
|
||||
local function check_in_workspace(client, root_dir)
|
||||
if not client.workspace_folders then
|
||||
return false
|
||||
end
|
||||
|
||||
for _, dir in ipairs(client.workspace_folders) do
|
||||
if (root_dir .. '/'):sub(1, #dir.name + 1) == dir.name .. '/' then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
--- @class lspconfig.Manager
|
||||
--- @field _clients table<string,integer[]>
|
||||
--- @field config lspconfig.Config
|
||||
--- @field make_config fun(root_dir: string): lspconfig.Config
|
||||
local M = {}
|
||||
|
||||
--- @param config lspconfig.Config
|
||||
--- @param make_config fun(root_dir: string): lspconfig.Config
|
||||
--- @return lspconfig.Manager
|
||||
function M.new(config, make_config)
|
||||
return setmetatable({
|
||||
_clients = {},
|
||||
config = config,
|
||||
make_config = make_config,
|
||||
}, {
|
||||
__index = M,
|
||||
})
|
||||
end
|
||||
|
||||
--- @private
|
||||
--- @param clients table<string,integer[]>
|
||||
--- @param root_dir string
|
||||
--- @param client_name string
|
||||
--- @return vim.lsp.Client?
|
||||
local function get_client(clients, root_dir, client_name)
|
||||
if vim.tbl_isempty(clients) then
|
||||
return
|
||||
end
|
||||
|
||||
if clients[root_dir] then
|
||||
for _, id in pairs(clients[root_dir]) do
|
||||
local client = lsp.get_client_by_id(id)
|
||||
if client and client.name == client_name then
|
||||
return client
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for _, ids in pairs(clients) do
|
||||
for _, id in ipairs(ids) do
|
||||
local client = lsp.get_client_by_id(id)
|
||||
if client and client.name == client_name then
|
||||
return client
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- @private
|
||||
--- @param bufnr integer
|
||||
--- @param root string
|
||||
--- @param client_id integer
|
||||
function M:_attach_and_cache(bufnr, root, client_id)
|
||||
local clients = self._clients
|
||||
lsp.buf_attach_client(bufnr, client_id)
|
||||
if not clients[root] then
|
||||
clients[root] = {}
|
||||
end
|
||||
if not vim.tbl_contains(clients[root], client_id) then
|
||||
clients[root][#clients[root] + 1] = client_id
|
||||
end
|
||||
end
|
||||
|
||||
--- @private
|
||||
--- @param bufnr integer
|
||||
--- @param root_dir string
|
||||
--- @param client vim.lsp.Client
|
||||
function M:_register_workspace_folders(bufnr, root_dir, client)
|
||||
local params = {
|
||||
event = {
|
||||
added = { { uri = vim.uri_from_fname(root_dir), name = root_dir } },
|
||||
removed = {},
|
||||
},
|
||||
}
|
||||
client.rpc.notify('workspace/didChangeWorkspaceFolders', params)
|
||||
if not client.workspace_folders then
|
||||
client.workspace_folders = {}
|
||||
end
|
||||
client.workspace_folders[#client.workspace_folders + 1] = params.event.added[1]
|
||||
self:_attach_and_cache(bufnr, root_dir, client.id)
|
||||
end
|
||||
|
||||
--- @private
|
||||
--- @param bufnr integer
|
||||
--- @param new_config lspconfig.Config
|
||||
--- @param root_dir string
|
||||
--- @param single_file boolean
|
||||
function M:_start_new_client(bufnr, new_config, root_dir, single_file)
|
||||
-- do nothing if the client is not enabled
|
||||
if new_config.enabled == false then
|
||||
return
|
||||
end
|
||||
if not new_config.cmd then
|
||||
vim.notify(
|
||||
string.format(
|
||||
'[lspconfig] cmd not defined for %q. Manually set cmd in the setup {} call according to server_configurations.md, see :help lspconfig-index.',
|
||||
new_config.name
|
||||
),
|
||||
vim.log.levels.ERROR
|
||||
)
|
||||
return
|
||||
end
|
||||
|
||||
local clients = self._clients
|
||||
|
||||
new_config.on_exit = util.add_hook_before(new_config.on_exit, function()
|
||||
for index, id in pairs(clients[root_dir]) do
|
||||
local exist = assert(lsp.get_client_by_id(id))
|
||||
if exist.name == new_config.name then
|
||||
table.remove(clients[root_dir], index)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Launch the server in the root directory used internally by lspconfig, if otherwise unset
|
||||
-- also check that the path exist
|
||||
if not new_config.cmd_cwd and uv.fs_realpath(root_dir) then
|
||||
new_config.cmd_cwd = root_dir
|
||||
end
|
||||
|
||||
-- Sending rootDirectory and workspaceFolders as null is not explicitly
|
||||
-- codified in the spec. Certain servers crash if initialized with a NULL
|
||||
-- root directory.
|
||||
if single_file then
|
||||
new_config.root_dir = nil
|
||||
new_config.workspace_folders = nil
|
||||
end
|
||||
|
||||
-- TODO: Replace lsp.start_client with lsp.start
|
||||
local client_id, err = lsp.start_client(new_config)
|
||||
if not client_id then
|
||||
if err then
|
||||
vim.notify(err, vim.log.levels.WARN)
|
||||
end
|
||||
return
|
||||
end
|
||||
self:_attach_and_cache(bufnr, root_dir, client_id)
|
||||
end
|
||||
|
||||
--- @private
|
||||
--- @param bufnr integer
|
||||
--- @param new_config lspconfig.Config
|
||||
--- @param root_dir string
|
||||
--- @param client vim.lsp.Client
|
||||
--- @param single_file boolean
|
||||
function M:_attach_or_spawn(bufnr, new_config, root_dir, client, single_file)
|
||||
if check_in_workspace(client, root_dir) then
|
||||
return self:_attach_and_cache(bufnr, root_dir, client.id)
|
||||
end
|
||||
|
||||
local supported = vim.tbl_get(client, 'server_capabilities', 'workspace', 'workspaceFolders', 'supported')
|
||||
if supported then
|
||||
return self:_register_workspace_folders(bufnr, root_dir, client)
|
||||
end
|
||||
self:_start_new_client(bufnr, new_config, root_dir, single_file)
|
||||
end
|
||||
|
||||
--- @private
|
||||
--- @param bufnr integer
|
||||
--- @param new_config lspconfig.Config
|
||||
--- @param root_dir string
|
||||
--- @param client vim.lsp.Client
|
||||
--- @param single_file boolean
|
||||
function M:_attach_after_client_initialized(bufnr, new_config, root_dir, client, single_file)
|
||||
local timer = assert(uv.new_timer())
|
||||
timer:start(
|
||||
0,
|
||||
10,
|
||||
vim.schedule_wrap(function()
|
||||
if client.initialized and client.server_capabilities and not timer:is_closing() then
|
||||
self:_attach_or_spawn(bufnr, new_config, root_dir, client, single_file)
|
||||
timer:stop()
|
||||
timer:close()
|
||||
end
|
||||
end)
|
||||
)
|
||||
end
|
||||
|
||||
---@param root_dir string
|
||||
---@param single_file boolean
|
||||
---@param bufnr integer
|
||||
function M:add(root_dir, single_file, bufnr)
|
||||
root_dir = util.path.sanitize(root_dir)
|
||||
local new_config = self.make_config(root_dir)
|
||||
local client = get_client(self._clients, root_dir, new_config.name)
|
||||
|
||||
if not client then
|
||||
return self:_start_new_client(bufnr, new_config, root_dir, single_file)
|
||||
end
|
||||
|
||||
if self._clients[root_dir] or single_file then
|
||||
lsp.buf_attach_client(bufnr, client.id)
|
||||
return
|
||||
end
|
||||
|
||||
-- make sure neovim had exchanged capabilities from language server
|
||||
-- it's useful to check server support workspaceFolders or not
|
||||
if client.initialized and client.server_capabilities then
|
||||
self:_attach_or_spawn(bufnr, new_config, root_dir, client, single_file)
|
||||
else
|
||||
self:_attach_after_client_initialized(bufnr, new_config, root_dir, client, single_file)
|
||||
end
|
||||
end
|
||||
|
||||
--- @return vim.lsp.Client[]
|
||||
function M:clients()
|
||||
local res = {}
|
||||
for _, client_ids in pairs(self._clients) do
|
||||
for _, id in ipairs(client_ids) do
|
||||
res[#res + 1] = lsp.get_client_by_id(id)
|
||||
end
|
||||
end
|
||||
return res
|
||||
end
|
||||
|
||||
--- Try to attach the buffer `bufnr` to a client using this config, creating
|
||||
--- a new client if one doesn't already exist for `bufnr`.
|
||||
--- @param bufnr integer
|
||||
--- @param project_root? string
|
||||
function M:try_add(bufnr, project_root)
|
||||
bufnr = bufnr or api.nvim_get_current_buf()
|
||||
|
||||
if vim.bo[bufnr].buftype == 'nofile' then
|
||||
return
|
||||
end
|
||||
|
||||
local bufname = api.nvim_buf_get_name(bufnr)
|
||||
if #bufname == 0 and not self.config.single_file_support then
|
||||
return
|
||||
end
|
||||
|
||||
if #bufname ~= 0 and not util.bufname_valid(bufname) then
|
||||
return
|
||||
end
|
||||
|
||||
if project_root then
|
||||
self:add(project_root, false, bufnr)
|
||||
return
|
||||
end
|
||||
|
||||
local buf_path = util.path.sanitize(bufname)
|
||||
|
||||
local get_root_dir = self.config.root_dir
|
||||
|
||||
local pwd = assert(uv.cwd())
|
||||
|
||||
async.run(function()
|
||||
local root_dir
|
||||
if get_root_dir then
|
||||
root_dir = get_root_dir(buf_path, bufnr)
|
||||
async.reenter()
|
||||
if not api.nvim_buf_is_valid(bufnr) then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if root_dir then
|
||||
self:add(root_dir, false, bufnr)
|
||||
elseif self.config.single_file_support then
|
||||
local pseudo_root = #bufname == 0 and pwd or util.path.dirname(buf_path)
|
||||
self:add(pseudo_root, true, bufnr)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
--- Check that the buffer `bufnr` has a valid filetype according to
|
||||
--- `config.filetypes`, then do `manager.try_add(bufnr)`.
|
||||
--- @param bufnr integer
|
||||
--- @param project_root? string
|
||||
function M:try_add_wrapper(bufnr, project_root)
|
||||
local config = self.config
|
||||
-- `config.filetypes = nil` means all filetypes are valid.
|
||||
if not config.filetypes or vim.tbl_contains(config.filetypes, vim.bo[bufnr].filetype) then
|
||||
self:try_add(bufnr, project_root)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
@ -0,0 +1,17 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'als' },
|
||||
filetypes = { 'agda' },
|
||||
root_dir = util.root_pattern('.git', '*.agda-lib'),
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/agda/agda-language-server
|
||||
|
||||
Language Server for Agda.
|
||||
]],
|
||||
},
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'aiken', 'lsp' },
|
||||
filetypes = { 'aiken' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern('aiken.toml', '.git')(fname)
|
||||
end,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/aiken-lang/aiken
|
||||
|
||||
A language server for Aiken Programming Language.
|
||||
[Installation](https://aiken-lang.org/installation-instructions)
|
||||
|
||||
It can be i
|
||||
]],
|
||||
default_config = {
|
||||
cmd = { 'aiken', 'lsp' },
|
||||
root_dir = [[root_pattern("aiken.toml", ".git")]],
|
||||
},
|
||||
},
|
||||
}
|
@ -29,7 +29,7 @@ return {
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/ansible/ansible-language-server
|
||||
https://github.com/ansible/vscode-ansible
|
||||
|
||||
Language server for the ansible configuration management tool.
|
||||
|
||||
|
@ -7,7 +7,7 @@ return {
|
||||
on_new_config = function(config)
|
||||
if not config.cmd and config.apex_jar_path then
|
||||
config.cmd = {
|
||||
'java',
|
||||
vim.env.JAVA_HOME and util.path.join(vim.env.JAVA_HOME, 'bin', 'java') or 'java',
|
||||
'-cp',
|
||||
config.apex_jar_path,
|
||||
'-Ddebug.internal.errors=true',
|
||||
|
@ -46,7 +46,7 @@ $ arduino-cli sketch new test
|
||||
$ cd test
|
||||
```
|
||||
|
||||
You will need a `sketch.json` file in order for the language server to understand your project. It will also save you passing options to `arduino-cli` each time you compile or upload a file. You can generate the file like using the following commands.
|
||||
You will need a `sketch.yaml` file in order for the language server to understand your project. It will also save you passing options to `arduino-cli` each time you compile or upload a file. You can generate the file like using the following commands.
|
||||
|
||||
|
||||
First gather some information about your board. Make sure your board is connected and run the following:
|
||||
@ -60,19 +60,14 @@ Port Protocol Type Board Name FQBN Core
|
||||
Then generate the file:
|
||||
|
||||
```sh
|
||||
arduino-cli board attach -p /dev/ttyACM0 test.ino
|
||||
arduino-cli board attach -p /dev/ttyACM0 -b arduino:avr:uno test.ino
|
||||
```
|
||||
|
||||
The resulting file should like like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"cpu": {
|
||||
"fqbn": "arduino:avr:uno",
|
||||
"name": "Arduino Uno",
|
||||
"port": "serial:///dev/ttyACM0"
|
||||
}
|
||||
}
|
||||
```yaml
|
||||
default_fqbn: arduino:avr:uno
|
||||
default_port: /dev/ttyACM0
|
||||
```
|
||||
|
||||
Your folder structure should look like this:
|
||||
@ -80,7 +75,7 @@ Your folder structure should look like this:
|
||||
```
|
||||
.
|
||||
├── test.ino
|
||||
└── sketch.json
|
||||
└── sketch.yaml
|
||||
```
|
||||
|
||||
For further instruction about configuration options, run `arduino-language-server --help`.
|
||||
|
@ -0,0 +1,37 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'ast-grep', 'lsp' },
|
||||
filetypes = { -- https://ast-grep.github.io/reference/languages.html
|
||||
'c',
|
||||
'cpp',
|
||||
'rust',
|
||||
'go',
|
||||
'java',
|
||||
'python',
|
||||
'javascript',
|
||||
'typescript',
|
||||
'html',
|
||||
'css',
|
||||
'kotlin',
|
||||
'dart',
|
||||
'lua',
|
||||
},
|
||||
root_dir = util.root_pattern('sgconfig.yaml', 'sgconfig.yml'),
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://ast-grep.github.io/
|
||||
|
||||
ast-grep(sg) is a fast and polyglot tool for code structural search, lint, rewriting at large scale.
|
||||
ast-grep LSP only works in projects that have `sgconfig.y[a]ml` in their root directories.
|
||||
```sh
|
||||
npm install [-g] @ast-grep/cli
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern('sgconfig.yaml', 'sgconfig.yml')]],
|
||||
},
|
||||
},
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local root_files = { 'configure.ac', 'Makefile', 'Makefile.am', '*.mk' }
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'autotools-language-server' },
|
||||
filetypes = { 'config', 'automake', 'make' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern(unpack(root_files))(fname)
|
||||
end,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/Freed-Wu/autotools-language-server
|
||||
|
||||
`autotools-language-server` can be installed via `pip`:
|
||||
```sh
|
||||
pip install autotools-language-server
|
||||
```
|
||||
|
||||
Language server for autoconf, automake and make using tree sitter in python.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = { 'configure.ac', 'Makefile', 'Makefile.am', '*.mk' },
|
||||
},
|
||||
},
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'bacon-ls' },
|
||||
filetypes = { 'rust' },
|
||||
root_dir = util.root_pattern('.bacon-locations', 'Cargo.toml'),
|
||||
single_file_support = true,
|
||||
settings = {},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/crisidev/bacon-ls
|
||||
|
||||
A Language Server Protocol wrapper for [bacon](https://dystroy.org/bacon/).
|
||||
It offers textDocument/diagnostic and workspace/diagnostic capabilities for Rust
|
||||
workspaces using the Bacon export locations file.
|
||||
|
||||
It requires `bacon` and `bacon-ls` to be installed on the system using
|
||||
[mason.nvim](https://github.com/williamboman/mason.nvim) or manually:util
|
||||
|
||||
```sh
|
||||
$ cargo install --locked bacon bacon-ls
|
||||
```
|
||||
|
||||
Settings can be changed using the `settings` dictionary:util
|
||||
|
||||
```lua
|
||||
settings = {
|
||||
-- Bacon export filename, default .bacon-locations
|
||||
locationsFile = ".bacon-locations",
|
||||
-- Maximum time in seconds the LSP server waits for Bacon to update the
|
||||
-- export file before loading the new diagnostics
|
||||
waitTimeSeconds = 10
|
||||
}
|
||||
```
|
||||
]],
|
||||
},
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local root_files = {
|
||||
'pyproject.toml',
|
||||
'setup.py',
|
||||
'setup.cfg',
|
||||
'requirements.txt',
|
||||
'Pipfile',
|
||||
'pyrightconfig.json',
|
||||
'.git',
|
||||
}
|
||||
|
||||
local function organize_imports()
|
||||
local params = {
|
||||
command = 'basedpyright.organizeimports',
|
||||
arguments = { vim.uri_from_bufnr(0) },
|
||||
}
|
||||
|
||||
local clients = util.get_lsp_clients {
|
||||
bufnr = vim.api.nvim_get_current_buf(),
|
||||
name = 'basedpyright',
|
||||
}
|
||||
for _, client in ipairs(clients) do
|
||||
client.request('workspace/executeCommand', params, nil, 0)
|
||||
end
|
||||
end
|
||||
|
||||
local function set_python_path(path)
|
||||
local clients = util.get_lsp_clients {
|
||||
bufnr = vim.api.nvim_get_current_buf(),
|
||||
name = 'basedpyright',
|
||||
}
|
||||
for _, client in ipairs(clients) do
|
||||
if client.settings then
|
||||
client.settings.python = vim.tbl_deep_extend('force', client.settings.python or {}, { pythonPath = path })
|
||||
else
|
||||
client.config.settings = vim.tbl_deep_extend('force', client.config.settings, { python = { pythonPath = path } })
|
||||
end
|
||||
client.notify('workspace/didChangeConfiguration', { settings = nil })
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'basedpyright-langserver', '--stdio' },
|
||||
filetypes = { 'python' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern(unpack(root_files))(fname)
|
||||
end,
|
||||
single_file_support = true,
|
||||
settings = {
|
||||
basedpyright = {
|
||||
analysis = {
|
||||
autoSearchPaths = true,
|
||||
useLibraryCodeForTypes = true,
|
||||
diagnosticMode = 'openFilesOnly',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
commands = {
|
||||
PyrightOrganizeImports = {
|
||||
organize_imports,
|
||||
description = 'Organize Imports',
|
||||
},
|
||||
PyrightSetPythonPath = {
|
||||
set_python_path,
|
||||
description = 'Reconfigure basedpyright with the provided python path',
|
||||
nargs = 1,
|
||||
complete = 'file',
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://detachhead.github.io/basedpyright
|
||||
|
||||
`basedpyright`, a static type checker and language server for python
|
||||
]],
|
||||
},
|
||||
}
|
@ -6,10 +6,7 @@ return {
|
||||
filetypes = { 'beancount', 'bean' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
init_options = {
|
||||
-- this is the path to the beancout journal file
|
||||
journalFile = '',
|
||||
},
|
||||
init_options = {},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
|
@ -0,0 +1,35 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'biome', 'lsp-proxy' },
|
||||
filetypes = {
|
||||
'javascript',
|
||||
'javascriptreact',
|
||||
'json',
|
||||
'jsonc',
|
||||
'typescript',
|
||||
'typescript.tsx',
|
||||
'typescriptreact',
|
||||
'astro',
|
||||
'svelte',
|
||||
'vue',
|
||||
},
|
||||
root_dir = util.root_pattern('biome.json', 'biome.jsonc'),
|
||||
single_file_support = false,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://biomejs.dev
|
||||
|
||||
Toolchain of the web. [Successor of Rome](https://biomejs.dev/blog/annoucing-biome).
|
||||
|
||||
```sh
|
||||
npm install [-g] @biomejs/biome
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern('biome.json', 'biome.jsonc')]],
|
||||
},
|
||||
},
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'bitbake-language-server' },
|
||||
filetypes = { 'bitbake' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
🛠️ bitbake language server
|
||||
]],
|
||||
},
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
-- set os dependent library path
|
||||
local function library_path(path, cmd_env)
|
||||
path = path or '/usr/local/lib'
|
||||
cmd_env = cmd_env or {}
|
||||
if vim.fn.has 'macunix' and not cmd_env.DYLD_LIBRARY_PATH then
|
||||
cmd_env.DYLD_LIBRARY_PATH = path
|
||||
elseif vim.fn.has 'linux' and not cmd_env.LD_LIBRARY_PATH then
|
||||
cmd_env.LD_LIBRARY_PATH = path
|
||||
end
|
||||
return cmd_env
|
||||
end
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'bqnlsp' },
|
||||
filetypes = { 'bqn' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
libcbqnPath = nil,
|
||||
on_new_config = function(new_config, _)
|
||||
if new_config.libcbqnPath then
|
||||
new_config.cmd_env = library_path(new_config.libcbqnPath, new_config.cmd_env)
|
||||
end
|
||||
end,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://git.sr.ht/~detegr/bqnlsp
|
||||
|
||||
|
||||
`bqnlsp`, a language server for BQN.
|
||||
|
||||
The binary depends on the shared library of [CBQN](https://github.com/dzaima/CBQN) `libcbqn.so`.
|
||||
If CBQN is installed system-wide (using `sudo make install` in its source directory) and `bqnlsp` errors that it can't find the shared library, update the linker cache by executing `sudo ldconfig`.
|
||||
If CBQN has been installed in a non-standard directory or can't be installed globally pass `libcbqnPath = '/path/to/CBQN'` to the setup function.
|
||||
This will set the environment variables `LD_LIBRARY_PATH` (Linux) or `DYLD_LIBRARY_PATH` (macOS) to the provided path.
|
||||
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[util.find_git_ancestor]],
|
||||
},
|
||||
},
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'bzl', 'lsp', 'serve' },
|
||||
filetypes = { 'bzl' },
|
||||
-- https://docs.bazel.build/versions/5.4.1/build-ref.html#workspace
|
||||
root_dir = util.root_pattern('WORKSPACE', 'WORKSPACE.bazel'),
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://bzl.io/
|
||||
|
||||
https://docs.stack.build/docs/cli/installation
|
||||
|
||||
https://docs.stack.build/docs/vscode/starlark-language-server
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern(".git")]],
|
||||
},
|
||||
},
|
||||
}
|
@ -8,10 +8,7 @@ return {
|
||||
init_options = { hostInfo = 'neovim' },
|
||||
cmd = cmd,
|
||||
filetypes = { 'cairo' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern 'Scarb.toml'(fname)
|
||||
or util.root_pattern('Scarb.toml', 'cairo_project.toml', '.git')(fname)
|
||||
end,
|
||||
root_dir = util.root_pattern('Scarb.toml', 'cairo_project.toml', '.git'),
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
@ -27,7 +24,7 @@ require'lspconfig'.cairo_ls.setup{}
|
||||
*cairo-language-server is still under active development, some features might not work yet !*
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git")]],
|
||||
root_dir = [[root_pattern("Scarb.toml", "cairo_project.toml", ".git")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ local root_files = {
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'ccls' },
|
||||
filetypes = { 'c', 'cpp', 'objc', 'objcpp' },
|
||||
filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern(unpack(root_files))(fname) or util.find_git_ancestor(fname)
|
||||
end,
|
||||
|
@ -0,0 +1,33 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local root_files = {
|
||||
'package.json',
|
||||
'db',
|
||||
'srv',
|
||||
}
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'cds-lsp', '--stdio' },
|
||||
filetypes = { 'cds' },
|
||||
-- init_options = { provideFormatter = true }, -- needed to enable formatting capabilities
|
||||
root_dir = util.root_pattern(unpack(root_files)),
|
||||
single_file_support = true,
|
||||
settings = {
|
||||
cds = { validate = true },
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
|
||||
https://cap.cloud.sap/docs/
|
||||
|
||||
`cds-lsp` can be installed via `npm`:
|
||||
|
||||
```sh
|
||||
npm i -g @sap/cds-lsp
|
||||
```
|
||||
|
||||
]],
|
||||
},
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
local util = require 'lspconfig/util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'circom-lsp' },
|
||||
filetypes = { 'circom' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
[Circom Language Server](https://github.com/rubydusa/circom-lsp)
|
||||
|
||||
`circom-lsp`, the language server for the Circom language.
|
||||
]],
|
||||
},
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'Contextive.LanguageServer' },
|
||||
root_dir = util.root_pattern('.contextive', '.git'),
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/dev-cycles/contextive
|
||||
|
||||
Language Server for Contextive.
|
||||
|
||||
Contextive allows you to define terms in a central file and provides auto-completion suggestions and hover panels for these terms wherever they're used.
|
||||
|
||||
To install the language server, you need to download the appropriate [GitHub release asset](https://github.com/dev-cycles/contextive/releases/) for your operating system and architecture.
|
||||
|
||||
After the download unzip the Contextive.LanguageServer binary and copy the file into a folder that is included in your system's PATH.
|
||||
]],
|
||||
},
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'coq-lsp' },
|
||||
filetypes = { 'coq' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern '_CoqProject'(fname) or util.find_git_ancestor(fname)
|
||||
end,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/ejgallego/coq-lsp/
|
||||
]],
|
||||
},
|
||||
}
|
@ -3,7 +3,9 @@ local util = require 'lspconfig.util'
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'csharp-ls' },
|
||||
root_dir = util.root_pattern('*.sln', '*.csproj', '*.fsproj', '.git'),
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern '*.sln'(fname) or util.root_pattern '*.csproj'(fname)
|
||||
end,
|
||||
filetypes = { 'cs' },
|
||||
init_options = {
|
||||
AutomaticWorkspaceInit = true,
|
||||
|
@ -0,0 +1,65 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'css-variables-language-server', '--stdio' },
|
||||
filetypes = { 'css', 'scss', 'less' },
|
||||
root_dir = util.root_pattern('package.json', '.git'),
|
||||
-- Same as inlined defaults that don't seem to work without hardcoding them in the lua config
|
||||
-- https://github.com/vunguyentuan/vscode-css-variables/blob/763a564df763f17aceb5f3d6070e0b444a2f47ff/packages/css-variables-language-server/src/CSSVariableManager.ts#L31-L50
|
||||
settings = {
|
||||
cssVariables = {
|
||||
lookupFiles = { '**/*.less', '**/*.scss', '**/*.sass', '**/*.css' },
|
||||
blacklistFolders = {
|
||||
'**/.cache',
|
||||
'**/.DS_Store',
|
||||
'**/.git',
|
||||
'**/.hg',
|
||||
'**/.next',
|
||||
'**/.svn',
|
||||
'**/bower_components',
|
||||
'**/CVS',
|
||||
'**/dist',
|
||||
'**/node_modules',
|
||||
'**/tests',
|
||||
'**/tmp',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/vunguyentuan/vscode-css-variables/tree/master/packages/css-variables-language-server
|
||||
|
||||
CSS variables autocompletion and go-to-definition
|
||||
|
||||
`css-variables-language-server` can be installed via `npm`:
|
||||
|
||||
```sh
|
||||
npm i -g css-variables-language-server
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("package.json", ".git") or bufdir]],
|
||||
settings = [[
|
||||
cssVariables = {
|
||||
lookupFiles = { '**/*.less', '**/*.scss', '**/*.sass', '**/*.css' },
|
||||
blacklistFolders = {
|
||||
'**/.cache',
|
||||
'**/.DS_Store',
|
||||
'**/.git',
|
||||
'**/.hg',
|
||||
'**/.next',
|
||||
'**/.svn',
|
||||
'**/bower_components',
|
||||
'**/CVS',
|
||||
'**/dist',
|
||||
'**/node_modules',
|
||||
'**/tests',
|
||||
'**/tmp',
|
||||
},
|
||||
},
|
||||
]],
|
||||
},
|
||||
},
|
||||
}
|
@ -4,6 +4,7 @@ return {
|
||||
default_config = {
|
||||
cmd = { 'vscode-css-language-server', '--stdio' },
|
||||
filetypes = { 'css', 'scss', 'less' },
|
||||
init_options = { provideFormatter = true }, -- needed to enable formatting capabilities
|
||||
root_dir = util.root_pattern('package.json', '.git'),
|
||||
single_file_support = true,
|
||||
settings = {
|
||||
|
@ -4,19 +4,7 @@ return {
|
||||
default_config = {
|
||||
init_options = { hostInfo = 'neovim' },
|
||||
cmd = { 'custom-elements-languageserver', '--stdio' },
|
||||
filetypes = {
|
||||
'javascript',
|
||||
'javascriptreact',
|
||||
'javascript.jsx',
|
||||
'typescript',
|
||||
'typescriptreact',
|
||||
'typescript.tsx',
|
||||
'html',
|
||||
},
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern 'tsconfig.json'(fname)
|
||||
or util.root_pattern('package.json', 'jsconfig.json', '.git')(fname)
|
||||
end,
|
||||
root_dir = util.root_pattern('tsconfig.json', 'package.json', 'jsconfig.json', '.git'),
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
@ -42,16 +30,10 @@ Here's an example that disables type checking in JavaScript files.
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
|
||||
The best way to utilize the Custom Elements Language Server is to enable the [Custom Elements Manifest](https://github.com/webcomponents/custom-elements-manifest)(CEM) in your project by installing
|
||||
a CEM generator like one provided by [The Open WC Team](https://github.com/open-wc/custom-elements-manifest/tree/master/packages/analyzer).
|
||||
|
||||
Generating a CEM in watch mode will provide you with the best user experience. If your dependencies ship with a Custom Elements Manifest, those will be utilized also.
|
||||
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git")]],
|
||||
root_dir = [[root_pattern("tsconfig.json", "package.json", "jsconfig.json", ".git")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'cypher-language-server', '--stdio' },
|
||||
filetypes = { 'cypher' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/neo4j/cypher-language-support/tree/main/packages/language-server
|
||||
|
||||
`cypher-language-server`, language server for Cypher query language.
|
||||
Part of the umbrella project cypher-language-support: https://github.com/neo4j/cypher-language-support
|
||||
|
||||
`cypher-language-server` can be installed via `npm`:
|
||||
```sh
|
||||
npm i -g @neo4j-cypher/language-server
|
||||
```
|
||||
]],
|
||||
},
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'dcm', 'start-server', '--client=neovim' },
|
||||
filetypes = { 'dart' },
|
||||
root_dir = util.root_pattern 'pubspec.yaml',
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://dcm.dev/
|
||||
|
||||
Language server for DCM analyzer.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("pubspec.yaml")]],
|
||||
},
|
||||
},
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'debputy', 'lsp', 'server' },
|
||||
filetypes = { 'debcontrol', 'debcopyright', 'debchangelog', 'make', 'yaml' },
|
||||
root_dir = util.root_pattern 'debian',
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://salsa.debian.org/debian/debputy
|
||||
|
||||
Language Server for Debian packages.
|
||||
]],
|
||||
},
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'DelphiLSP.exe' },
|
||||
filetypes = { 'pascal' },
|
||||
root_dir = util.root_pattern '*.dpr',
|
||||
single_file_support = false,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
Language server for Delphi from Embarcadero.
|
||||
https://marketplace.visualstudio.com/items?itemName=EmbarcaderoTechnologies.delphilsp
|
||||
|
||||
Note, the '*.delphilsp.json' file is required, more details at:
|
||||
https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Using_DelphiLSP_Code_Insight_with_Other_Editors
|
||||
|
||||
Below, you'll find a sample configuration for the lazy manager.
|
||||
When on_attach is triggered, it signals DelphiLSP to load settings from a configuration file.
|
||||
Without this step, DelphiLSP initializes but remains non-functional:
|
||||
|
||||
```lua
|
||||
"neovim/nvim-lspconfig",
|
||||
lazy = false,
|
||||
config = function()
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
lspconfig.delphi_ls.setup({
|
||||
capabilities = capabilities,
|
||||
|
||||
on_attach = function(client)
|
||||
local lsp_config = vim.fs.find(function(name)
|
||||
return name:match(".*%.delphilsp.json$")
|
||||
end, { type = "file", path = client.config.root_dir, upward = false })[1]
|
||||
|
||||
if lsp_config then
|
||||
client.config.settings = { settingsFile = lsp_config }
|
||||
client.notify("workspace/didChangeConfiguration", { settings = client.config.settings })
|
||||
else
|
||||
vim.notify_once("delphi_ls: '*.delphilsp.json' config file not found")
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
```
|
||||
]],
|
||||
},
|
||||
}
|
@ -2,12 +2,13 @@ local util = require 'lspconfig.util'
|
||||
local lsp = vim.lsp
|
||||
|
||||
local function buf_cache(bufnr, client)
|
||||
local params = {}
|
||||
params['referrer'] = { uri = vim.uri_from_bufnr(bufnr) }
|
||||
params['uris'] = {}
|
||||
client.request('deno/cache', params, function(err, _result, ctx)
|
||||
local params = {
|
||||
command = 'deno.cache',
|
||||
arguments = { {}, vim.uri_from_bufnr(bufnr) },
|
||||
}
|
||||
client.request('workspace/executeCommand', params, function(err, _result, ctx)
|
||||
if err then
|
||||
local uri = ctx.params.referrer.uri
|
||||
local uri = ctx.params.arguments[2]
|
||||
vim.api.nvim_err_writeln('cache command failed for ' .. vim.uri_to_fname(uri))
|
||||
end
|
||||
end, bufnr)
|
||||
@ -27,9 +28,9 @@ local function virtual_text_document_handler(uri, res, client)
|
||||
end
|
||||
|
||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
|
||||
vim.api.nvim_buf_set_option(bufnr, 'readonly', true)
|
||||
vim.api.nvim_buf_set_option(bufnr, 'modified', false)
|
||||
vim.api.nvim_buf_set_option(bufnr, 'modifiable', false)
|
||||
vim.api.nvim_set_option_value('readonly', true, { buf = bufnr })
|
||||
vim.api.nvim_set_option_value('modified', false, { buf = bufnr })
|
||||
vim.api.nvim_set_option_value('modifiable', false, { buf = bufnr })
|
||||
lsp.buf_attach_client(bufnr, client.id)
|
||||
end
|
||||
|
||||
@ -74,32 +75,30 @@ return {
|
||||
'typescript.tsx',
|
||||
},
|
||||
root_dir = util.root_pattern('deno.json', 'deno.jsonc', '.git'),
|
||||
init_options = {
|
||||
enable = true,
|
||||
unstable = false,
|
||||
settings = {
|
||||
deno = {
|
||||
enable = true,
|
||||
suggest = {
|
||||
imports = {
|
||||
hosts = {
|
||||
['https://deno.land'] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
handlers = {
|
||||
['textDocument/definition'] = denols_handler,
|
||||
['textDocument/typeDefinition'] = denols_handler,
|
||||
['textDocument/references'] = denols_handler,
|
||||
['workspace/executeCommand'] = function(err, result, context, config)
|
||||
if context.params.command == 'deno.cache' then
|
||||
buf_cache(context.bufnr, vim.lsp.get_client_by_id(context.client_id))
|
||||
else
|
||||
lsp.handlers[context.method](err, result, context, config)
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
commands = {
|
||||
DenolsCache = {
|
||||
function()
|
||||
local clients = vim.lsp.get_active_clients()
|
||||
for _, client in ipairs(clients) do
|
||||
if client.name == 'denols' then
|
||||
buf_cache(0, client)
|
||||
break
|
||||
end
|
||||
local clients = util.get_lsp_clients { bufnr = 0, name = 'denols' }
|
||||
if #clients > 0 then
|
||||
buf_cache(0, clients[#clients])
|
||||
end
|
||||
end,
|
||||
description = 'Cache a module and all of its dependencies.',
|
||||
|
@ -3,8 +3,8 @@ local util = require 'lspconfig.util'
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'docker-compose-langserver', '--stdio' },
|
||||
filetypes = { 'yaml' },
|
||||
root_dir = util.root_pattern 'docker-compose.yaml',
|
||||
filetypes = { 'yaml.docker-compose' },
|
||||
root_dir = util.root_pattern('docker-compose.yaml', 'docker-compose.yml', 'compose.yaml', 'compose.yml'),
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
@ -17,9 +17,11 @@ This project contains a language service for Docker Compose.
|
||||
```sh
|
||||
npm install @microsoft/compose-language-service
|
||||
```
|
||||
|
||||
Note: If the docker-compose-langserver doesn't startup when entering a `docker-compose.yaml` file, make sure that the filetype is `yaml.docker-compose`. You can set with: `:set filetype=yaml.docker-compose`.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("docker-compose.yaml")]],
|
||||
root_dir = [[root_pattern("docker-compose.yaml", "docker-compose.yml", "compose.yaml", "compose.yml")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -14,6 +14,21 @@ https://github.com/rcjsuen/dockerfile-language-server-nodejs
|
||||
`docker-langserver` can be installed via `npm`:
|
||||
```sh
|
||||
npm install -g dockerfile-language-server-nodejs
|
||||
```
|
||||
|
||||
Additional configuration can be applied in the following way:
|
||||
```lua
|
||||
require("lspconfig").dockerls.setup {
|
||||
settings = {
|
||||
docker = {
|
||||
languageserver = {
|
||||
formatter = {
|
||||
ignoreMultilineInstructions = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
|
@ -0,0 +1,33 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'dprint', 'lsp' },
|
||||
filetypes = {
|
||||
'javascript',
|
||||
'javascriptreact',
|
||||
'typescript',
|
||||
'typescriptreact',
|
||||
'json',
|
||||
'jsonc',
|
||||
'markdown',
|
||||
'python',
|
||||
'toml',
|
||||
'rust',
|
||||
'roslyn',
|
||||
},
|
||||
root_dir = util.root_pattern('dprint.json', '.dprint.json', 'dprint.jsonc', '.dprint.jsonc'),
|
||||
single_file_support = true,
|
||||
settings = {},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/dprint/dprint
|
||||
|
||||
Pluggable and configurable code formatting platform written in Rust.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = util.root_pattern('dprint.json', '.dprint.json', 'dprint.jsonc', '.dprint.jsonc'),
|
||||
},
|
||||
},
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
local util = require 'lspconfig/util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'earthlyls' },
|
||||
filetypes = { 'earthfile' },
|
||||
root_dir = util.root_pattern 'Earthfile',
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/glehmann/earthlyls
|
||||
|
||||
A fast language server for earthly.
|
||||
]],
|
||||
},
|
||||
}
|
@ -1,11 +1,14 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
filetypes = { 'elixir', 'eelixir', 'heex', 'surface' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern('mix.exs', '.git')(fname) or vim.loop.os_homedir()
|
||||
local matches = vim.fs.find({ 'mix.exs' }, { upward = true, limit = 2, path = fname })
|
||||
local child_or_root_path, maybe_umbrella_path = unpack(matches)
|
||||
local root_dir = vim.fs.dirname(maybe_umbrella_path or child_or_root_path)
|
||||
|
||||
return root_dir
|
||||
end,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
@ -31,9 +34,11 @@ require'lspconfig'.elixirls.setup{
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
'root_dir' is chosen like this: if two or more directories containing `mix.exs` were found when searching directories upward, the second one (higher up) is chosen, with the assumption that it is the root of an umbrella app. Otherwise the directory containing the single mix.exs that was found is chosen.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("mix.exs", ".git") or vim.loop.os_homedir()]],
|
||||
root_dir = '{{see description above}}',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -18,7 +18,10 @@ return {
|
||||
end
|
||||
end,
|
||||
init_options = {
|
||||
elmAnalyseTrigger = 'change',
|
||||
elmReviewDiagnostics = 'off', -- 'off' | 'warning' | 'error'
|
||||
skipInstallPackageConfirmation = false,
|
||||
disableElmLSDiagnostics = false,
|
||||
onlyUpdateDiagnosticsOnSave = false,
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
|
@ -0,0 +1,21 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'elp', 'server' },
|
||||
filetypes = { 'erlang' },
|
||||
root_dir = util.root_pattern('rebar.config', 'erlang.mk', '.git'),
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://whatsapp.github.io/erlang-language-platform
|
||||
|
||||
ELP integrates Erlang into modern IDEs via the language server protocol and was
|
||||
inspired by rust-analyzer.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern('rebar.config', 'erlang.mk', '.git')]],
|
||||
},
|
||||
},
|
||||
}
|
@ -3,17 +3,17 @@ local util = require 'lspconfig.util'
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'ember-language-server', '--stdio' },
|
||||
filetypes = { 'handlebars', 'typescript', 'javascript' },
|
||||
filetypes = { 'handlebars', 'typescript', 'javascript', 'typescript.glimmer', 'javascript.glimmer' },
|
||||
root_dir = util.root_pattern('ember-cli-build.js', '.git'),
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/lifeart/ember-language-server
|
||||
https://github.com/ember-tooling/ember-language-server
|
||||
|
||||
`ember-language-server` can be installed via `npm`:
|
||||
|
||||
```sh
|
||||
npm install -g @lifeart/ember-language-server
|
||||
npm install -g @ember-tooling/ember-language-server
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
|
@ -0,0 +1,35 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'emmet-language-server', '--stdio' },
|
||||
filetypes = {
|
||||
'css',
|
||||
'eruby',
|
||||
'html',
|
||||
'htmldjango',
|
||||
'javascriptreact',
|
||||
'less',
|
||||
'pug',
|
||||
'sass',
|
||||
'scss',
|
||||
'typescriptreact',
|
||||
},
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/olrtg/emmet-language-server
|
||||
|
||||
Package can be installed via `npm`:
|
||||
```sh
|
||||
npm install -g @olrtg/emmet-language-server
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = 'git root',
|
||||
single_file_support = true,
|
||||
},
|
||||
},
|
||||
}
|
@ -49,7 +49,7 @@ require'lspconfig'.esbonio.setup {
|
||||
}
|
||||
```
|
||||
|
||||
A full list and explanation of the available options can be found [here](https://swyddfa.github.io/esbonio/docs/latest/en/lsp/getting-started.html#configuration)
|
||||
A full list and explanation of the available options can be found [here](https://docs.esbon.io/en/esbonio-language-server-v0.16.4/lsp/getting-started.html?editor=neovim-lspconfig#configuration)
|
||||
]],
|
||||
},
|
||||
}
|
||||
|
@ -40,6 +40,11 @@ local root_file = {
|
||||
'.eslintrc.yml',
|
||||
'.eslintrc.json',
|
||||
'eslint.config.js',
|
||||
'eslint.config.mjs',
|
||||
'eslint.config.cjs',
|
||||
'eslint.config.ts',
|
||||
'eslint.config.mts',
|
||||
'eslint.config.cts',
|
||||
}
|
||||
|
||||
return {
|
||||
@ -64,7 +69,7 @@ return {
|
||||
-- Refer to https://github.com/Microsoft/vscode-eslint#settings-options for documentation.
|
||||
settings = {
|
||||
validate = 'on',
|
||||
packageManager = 'npm',
|
||||
packageManager = nil,
|
||||
useESLintClass = false,
|
||||
experimental = {
|
||||
useFlatConfig = false,
|
||||
@ -106,7 +111,14 @@ return {
|
||||
}
|
||||
|
||||
-- Support flat config
|
||||
if vim.fn.filereadable(new_root_dir .. '/eslint.config.js') == 1 then
|
||||
if
|
||||
vim.fn.filereadable(new_root_dir .. '/eslint.config.js') == 1
|
||||
or vim.fn.filereadable(new_root_dir .. '/eslint.config.mjs') == 1
|
||||
or vim.fn.filereadable(new_root_dir .. '/eslint.config.cjs') == 1
|
||||
or vim.fn.filereadable(new_root_dir .. '/eslint.config.ts') == 1
|
||||
or vim.fn.filereadable(new_root_dir .. '/eslint.config.mts') == 1
|
||||
or vim.fn.filereadable(new_root_dir .. '/eslint.config.cts') == 1
|
||||
then
|
||||
config.settings.experimental.useFlatConfig = true
|
||||
end
|
||||
|
||||
|
@ -0,0 +1,17 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'facility-language-server' },
|
||||
filetypes = { 'fsd' },
|
||||
single_file_support = true,
|
||||
root_dir = util.find_git_ancestor,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/FacilityApi/FacilityLanguageServer
|
||||
|
||||
Facility language server protocol (LSP) support.
|
||||
]],
|
||||
},
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local default_capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
default_capabilities.offsetEncoding = { 'utf-8', 'utf-16' }
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'fennel-ls' },
|
||||
@ -8,6 +11,7 @@ return {
|
||||
return util.find_git_ancestor(dir)
|
||||
end,
|
||||
settings = {},
|
||||
capabilities = default_capabilities,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
|
@ -0,0 +1,16 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'gdshader-lsp', '--stdio' },
|
||||
filetypes = { 'gdshader', 'gdshaderinc' },
|
||||
root_dir = util.root_pattern 'project.godot',
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/godofavacyn/gdshader-lsp
|
||||
|
||||
A language server for the Godot Shading language.
|
||||
]],
|
||||
},
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'ginko_ls' },
|
||||
filetypes = { 'dts' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
settings = {},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
`ginko_ls` is meant to be a feature-complete language server for device-trees.
|
||||
Language servers can be used in many editors, such as Visual Studio Code, Emacs
|
||||
or Vim
|
||||
|
||||
Install `ginko_ls` from https://github.com/Schottkyc137/ginko and add it to path
|
||||
|
||||
`ginko_ls` doesn't require any configuration.
|
||||
]],
|
||||
},
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local cache_dir = util.path.join(vim.loop.os_homedir(), '.cache/gitlab-ci-ls/')
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'gitlab-ci-ls' },
|
||||
filetypes = { 'yaml.gitlab' },
|
||||
root_dir = util.root_pattern('.gitlab*', '.git'),
|
||||
init_options = {
|
||||
cache_path = cache_dir,
|
||||
log_path = util.path.join(cache_dir, 'log/gitlab-ci-ls.log'),
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/alesbrelih/gitlab-ci-ls
|
||||
|
||||
Language Server for Gitlab CI
|
||||
|
||||
`gitlab-ci-ls` can be installed via cargo:
|
||||
cargo install gitlab-ci-ls
|
||||
]],
|
||||
default_config = {
|
||||
cmd = { 'gitlab-ci-ls' },
|
||||
filetypes = { 'yaml.gitlab' },
|
||||
root_dir = [[util.root_pattern('.gitlab*', '.git')]],
|
||||
init_options = {
|
||||
cache_path = [[util.path.join(vim.loop.os_homedir(), '.cache/gitlab-ci-ls/')]],
|
||||
log_path = [[util.path.join(util.path.join(vim.loop.os_homedir(), '.cache/gitlab-ci-ls/'), 'log/gitlab-ci-ls.log')]],
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'glsl_analyzer' },
|
||||
filetypes = { 'glsl', 'vert', 'tesc', 'tese', 'frag', 'geom', 'comp' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
capabilities = {},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/nolanderc/glsl_analyzer
|
||||
|
||||
Language server for GLSL
|
||||
]],
|
||||
},
|
||||
}
|
@ -3,7 +3,7 @@ local util = require 'lspconfig.util'
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'glslls', '--stdin' },
|
||||
filetypes = { 'glsl' },
|
||||
filetypes = { 'glsl', 'vert', 'tesc', 'tese', 'frag', 'geom', 'comp' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
capabilities = {
|
||||
|
@ -1,4 +1,5 @@
|
||||
local util = require 'lspconfig.util'
|
||||
local async = require 'lspconfig.async'
|
||||
local mod_cache = nil
|
||||
|
||||
return {
|
||||
@ -8,13 +9,13 @@ return {
|
||||
root_dir = function(fname)
|
||||
-- see: https://github.com/neovim/nvim-lspconfig/issues/804
|
||||
if not mod_cache then
|
||||
local result = util.async_run_command 'go env GOMODCACHE'
|
||||
local result = async.run_command { 'go', 'env', 'GOMODCACHE' }
|
||||
if result and result[1] then
|
||||
mod_cache = vim.trim(result[1])
|
||||
end
|
||||
end
|
||||
if fname:sub(1, #mod_cache) == mod_cache then
|
||||
local clients = vim.lsp.get_active_clients { name = 'gopls' }
|
||||
local clients = util.get_lsp_clients { name = 'gopls' }
|
||||
if #clients > 0 then
|
||||
return clients[#clients].config.root_dir
|
||||
end
|
||||
|
@ -7,18 +7,13 @@ end
|
||||
|
||||
local root_files = {
|
||||
'settings.gradle', -- Gradle (multi-project)
|
||||
}
|
||||
|
||||
local fallback_root_files = {
|
||||
'build.gradle', -- Gradle
|
||||
}
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
filetypes = { 'groovy' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern(unpack(root_files))(fname) or util.root_pattern(unpack(fallback_root_files))(fname)
|
||||
end,
|
||||
root_dir = util.root_pattern(unpack(root_files)),
|
||||
cmd = { bin_name },
|
||||
-- gradle-language-server expects init_options.settings to be defined
|
||||
init_options = {
|
||||
@ -36,7 +31,7 @@ Microsoft's lsp server for gradle files
|
||||
If you're setting this up manually, build vscode-gradle using `./gradlew installDist` and point `cmd` to the `gradle-language-server` generated in the build directory
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("settings.gradle")]],
|
||||
root_dir = [[root_pattern("settings.gradle", "build.gradle")]],
|
||||
cmd = { 'gradle-language-server' },
|
||||
init_options = {
|
||||
settings = {
|
||||
|
@ -0,0 +1,30 @@
|
||||
local util = require 'lspconfig.util'
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'guile-lsp-server' },
|
||||
filetypes = {
|
||||
'scheme.guile',
|
||||
},
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern 'guix.scm'(fname) or util.find_git_ancestor(fname)
|
||||
end,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://codeberg.org/rgherdt/scheme-lsp-server
|
||||
|
||||
The recommended way is to install guile-lsp-server is using Guix. Unfortunately it is still not available at the official Guix channels, but you can use the provided channel guix.scm in the repo:
|
||||
```sh
|
||||
guix package -f guix.scm
|
||||
```
|
||||
|
||||
Checkout the repo for more info.
|
||||
|
||||
Note: This LSP will start on `scheme.guile` filetype. You can set this file type using `:help modeline` or adding https://gitlab.com/HiPhish/guile.vim to your plugins to automatically set it.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("guix.scm", ".git")]],
|
||||
},
|
||||
},
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'harper-ls', '--stdio' },
|
||||
filetypes = {
|
||||
'markdown',
|
||||
'rust',
|
||||
'typescript',
|
||||
'typescriptreact',
|
||||
'javascript',
|
||||
'python',
|
||||
'go',
|
||||
'c',
|
||||
'cpp',
|
||||
'ruby',
|
||||
'swift',
|
||||
'csharp',
|
||||
'toml',
|
||||
'lua',
|
||||
},
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/chilipepperhott/harper
|
||||
|
||||
The language server for Harper, the slim, clean language checker for developers.
|
||||
|
||||
See [docs](https://github.com/chilipepperhott/harper/tree/master/harper-ls#configuration) for more information on settings.
|
||||
|
||||
In short, however, they should look something like this:
|
||||
```lua
|
||||
lspconfig.harper_ls.setup {
|
||||
settings = {
|
||||
["harper-ls"] = {
|
||||
userDictPath = "~/dict.txt"
|
||||
}
|
||||
},
|
||||
}
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[bufdir]],
|
||||
},
|
||||
},
|
||||
}
|
@ -1,11 +1,20 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local default_capabilities = {
|
||||
workspace = {
|
||||
didChangeWatchedFiles = {
|
||||
dynamicRegistration = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'helm_ls', 'serve' },
|
||||
filetypes = { 'helm' },
|
||||
root_dir = util.root_pattern 'Chart.yaml',
|
||||
single_file_support = true,
|
||||
capabilities = default_capabilities,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
@ -21,6 +30,7 @@ If need Helm file highlight use [vim-helm](https://github.com/towolf/vim-helm) p
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("Chart.yaml")]],
|
||||
capabilities = [[default capabilities, with dynamicRegistration for didChangeWatchedFiles true]],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'hlasm_language_server' },
|
||||
filetypes = { 'hlasm' },
|
||||
root_dir = util.root_pattern '.hlasmplugin',
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
`hlasm_language_server` is a language server for the High Level Assembler language used on IBM SystemZ mainframes.
|
||||
|
||||
To learn how to configure the HLASM language server, see the [HLASM Language Support documentation](https://github.com/eclipse-che4z/che-che4z-lsp-for-hlasm).
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern(".hlasmplugin")]],
|
||||
},
|
||||
},
|
||||
}
|
@ -4,12 +4,7 @@ return {
|
||||
default_config = {
|
||||
cmd = { 'haskell-language-server-wrapper', '--lsp' },
|
||||
filetypes = { 'haskell', 'lhaskell' },
|
||||
root_dir = function(filepath)
|
||||
return (
|
||||
util.root_pattern('hie.yaml', 'stack.yaml', 'cabal.project')(filepath)
|
||||
or util.root_pattern('*.cabal', 'package.yaml')(filepath)
|
||||
)
|
||||
end,
|
||||
root_dir = util.root_pattern('hie.yaml', 'stack.yaml', 'cabal.project', '*.cabal', 'package.yaml'),
|
||||
single_file_support = true,
|
||||
settings = {
|
||||
haskell = {
|
||||
@ -51,14 +46,7 @@ require('lspconfig')['hls'].setup{
|
||||
]],
|
||||
|
||||
default_config = {
|
||||
root_dir = [[
|
||||
function (filepath)
|
||||
return (
|
||||
util.root_pattern('hie.yaml', 'stack.yaml', 'cabal.project')(filepath)
|
||||
or util.root_pattern('*.cabal', 'package.yaml')(filepath)
|
||||
)
|
||||
end
|
||||
]],
|
||||
root_dir = [[root_pattern("hie.yaml", "stack.yaml", "cabal.project", "*.cabal", "package.yaml")]],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ local util = require 'lspconfig.util'
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'vscode-html-language-server', '--stdio' },
|
||||
filetypes = { 'html' },
|
||||
filetypes = { 'html', 'templ' },
|
||||
root_dir = util.root_pattern('package.json', '.git'),
|
||||
single_file_support = true,
|
||||
settings = {},
|
||||
|
@ -0,0 +1,24 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'htmx-lsp' },
|
||||
filetypes = { 'html', 'templ' },
|
||||
single_file_support = true,
|
||||
root_dir = function(fname)
|
||||
return util.find_git_ancestor(fname)
|
||||
end,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/ThePrimeagen/htmx-lsp
|
||||
|
||||
`htmx-lsp` can be installed via `cargo`:
|
||||
```sh
|
||||
cargo install htmx-lsp
|
||||
```
|
||||
|
||||
Lsp is still very much work in progress and experimental. Use at your own risk.
|
||||
]],
|
||||
},
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'hydra-lsp' },
|
||||
filetypes = { 'yaml' },
|
||||
root_dir = util.root_pattern '.git',
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/Retsediv/hydra-lsp
|
||||
|
||||
LSP for Hydra Python package config files.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[util.root_pattern '.git']],
|
||||
},
|
||||
},
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'hyprls', '--stdio' },
|
||||
filetypes = { '*.hl', 'hypr*.conf', '.config/hypr/*.conf' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/hyprland-community/hyprls
|
||||
|
||||
`hyprls` can be installed via `go`:
|
||||
```sh
|
||||
go install github.com/ewen-lbh/hyprls/cmd/hyprls@latest
|
||||
```
|
||||
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[util.find_git_ancestor]],
|
||||
},
|
||||
},
|
||||
}
|
@ -77,6 +77,8 @@ local function on_language_status(_, result)
|
||||
end
|
||||
|
||||
local root_files = {
|
||||
-- Multi-module projects
|
||||
{ '.git', 'build.gradle', 'build.gradle.kts' },
|
||||
-- Single-module projects
|
||||
{
|
||||
'build.xml', -- Ant
|
||||
@ -84,8 +86,6 @@ local root_files = {
|
||||
'settings.gradle', -- Gradle
|
||||
'settings.gradle.kts', -- Gradle
|
||||
},
|
||||
-- Multi-module projects
|
||||
{ 'build.gradle', 'build.gradle.kts' },
|
||||
}
|
||||
|
||||
return {
|
||||
@ -120,7 +120,6 @@ return {
|
||||
['textDocument/rename'] = on_textdocument_rename,
|
||||
['workspace/applyEdit'] = on_workspace_applyedit,
|
||||
['language/status'] = vim.schedule_wrap(on_language_status),
|
||||
['$/progress'] = vim.schedule_wrap(on_language_status),
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
|
@ -6,6 +6,7 @@ local root_files = {
|
||||
'setup.cfg',
|
||||
'requirements.txt',
|
||||
'Pipfile',
|
||||
'.git',
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -0,0 +1,28 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
name = 'jinja_lsp',
|
||||
cmd = { 'jinja-lsp' },
|
||||
filetypes = { 'jinja' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
jinja-lsp enhances minijinja development experience by providing Helix/Nvim users with advanced features such as autocomplete, syntax highlighting, hover, goto definition, code actions and linting.
|
||||
|
||||
The file types are not detected automatically, you can register them manually (see below) or override the filetypes:
|
||||
|
||||
```lua
|
||||
vim.filetype.add {
|
||||
extension = {
|
||||
jinja = 'jinja',
|
||||
jinja2 = 'jinja',
|
||||
j2 = 'jinja',
|
||||
},
|
||||
}
|
||||
```
|
||||
]],
|
||||
},
|
||||
}
|
@ -13,6 +13,7 @@ return {
|
||||
default_config = {
|
||||
cmd = { 'jsonnet-language-server' },
|
||||
filetypes = { 'jsonnet', 'libsonnet' },
|
||||
single_file_support = true,
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern 'jsonnetfile.json'(fname) or util.find_git_ancestor(fname)
|
||||
end,
|
||||
|
@ -0,0 +1,36 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local root_files = {}
|
||||
|
||||
local default_capabilities = {
|
||||
textDocument = {
|
||||
completion = {
|
||||
editsNearCursor = true,
|
||||
},
|
||||
},
|
||||
offsetEncoding = { 'utf-8' },
|
||||
}
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'koka', '--language-server' },
|
||||
filetypes = { 'kk' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern(unpack(root_files))(fname) or util.find_git_ancestor(fname)
|
||||
end,
|
||||
single_file_support = true,
|
||||
capabilities = default_capabilities,
|
||||
},
|
||||
commands = {},
|
||||
docs = {
|
||||
description = [[
|
||||
https://koka-lang.github.io/koka/doc/index.html
|
||||
Koka is a functional programming language with effect types and handlers.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[
|
||||
]],
|
||||
capabilities = [[default capabilities, with offsetEncoding utf-8]],
|
||||
},
|
||||
},
|
||||
}
|
@ -15,9 +15,6 @@ local root_files = {
|
||||
'settings.gradle.kts', -- Gradle (multi-project)
|
||||
'build.xml', -- Ant
|
||||
'pom.xml', -- Maven
|
||||
}
|
||||
|
||||
local fallback_root_files = {
|
||||
'build.gradle', -- Gradle
|
||||
'build.gradle.kts', -- Gradle
|
||||
}
|
||||
@ -25,10 +22,11 @@ local fallback_root_files = {
|
||||
return {
|
||||
default_config = {
|
||||
filetypes = { 'kotlin' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern(unpack(root_files))(fname) or util.root_pattern(unpack(fallback_root_files))(fname)
|
||||
end,
|
||||
root_dir = util.root_pattern(unpack(root_files)),
|
||||
cmd = { bin_name },
|
||||
init_options = {
|
||||
storagePath = util.root_pattern(unpack(root_files))(vim.fn.expand '%:p:h'),
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
@ -44,28 +42,16 @@ return {
|
||||
You could refer for this capability to:
|
||||
https://github.com/udalov/kotlin-vim (recommended)
|
||||
Note that there is no LICENSE specified yet.
|
||||
|
||||
For faster startup, you can setup caching by specifying a storagePath
|
||||
in the init_options. The default is your home directory.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("settings.gradle")]],
|
||||
root_dir = [[See source]],
|
||||
cmd = { 'kotlin-language-server' },
|
||||
capabilities = [[
|
||||
smart code completion,
|
||||
diagnostics,
|
||||
hover,
|
||||
document symbols,
|
||||
definition lookup,
|
||||
method signature help,
|
||||
dependency resolution,
|
||||
additional plugins from: https://github.com/fwcd
|
||||
|
||||
Snipped of License (refer to source for full License):
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 George Fraser
|
||||
Copyright (c) 2018 fwcd
|
||||
|
||||
]],
|
||||
init_options = {
|
||||
storagePath = [[Enables caching and use project root to store cache data. See source]],
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
filetypes = { 'elixir', 'eelixir', 'heex', 'surface' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern 'mix.exs'(fname) or util.find_git_ancestor(fname)
|
||||
end,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/lexical-lsp/lexical
|
||||
|
||||
Lexical is a next-generation language server for the Elixir programming language.
|
||||
|
||||
Follow the [Detailed Installation Instructions](https://github.com/lexical-lsp/lexical/blob/main/pages/installation.md)
|
||||
|
||||
**By default, `lexical` doesn't have a `cmd` set.**
|
||||
This is because nvim-lspconfig does not make assumptions about your path.
|
||||
]],
|
||||
},
|
||||
}
|
@ -3,11 +3,11 @@ local util = require 'lspconfig.util'
|
||||
local language_id_mapping = {
|
||||
bib = 'bibtex',
|
||||
plaintex = 'tex',
|
||||
rnoweb = 'sweave',
|
||||
rnoweb = 'rsweave',
|
||||
rst = 'restructuredtext',
|
||||
tex = 'latex',
|
||||
xhtml = 'xhtml',
|
||||
pandoc = 'markdown',
|
||||
text = 'plaintext',
|
||||
}
|
||||
|
||||
local bin_name = 'ltex-ls'
|
||||
@ -15,20 +15,57 @@ if vim.fn.has 'win32' == 1 then
|
||||
bin_name = bin_name .. '.bat'
|
||||
end
|
||||
|
||||
local filetypes = {
|
||||
'bib',
|
||||
'gitcommit',
|
||||
'markdown',
|
||||
'org',
|
||||
'plaintex',
|
||||
'rst',
|
||||
'rnoweb',
|
||||
'tex',
|
||||
'pandoc',
|
||||
'quarto',
|
||||
'rmd',
|
||||
'context',
|
||||
'html',
|
||||
'xhtml',
|
||||
'mail',
|
||||
'text',
|
||||
}
|
||||
|
||||
local function get_language_id(_, filetype)
|
||||
local language_id = language_id_mapping[filetype]
|
||||
if language_id then
|
||||
return language_id
|
||||
else
|
||||
return filetype
|
||||
end
|
||||
end
|
||||
local enabled_ids = {}
|
||||
do
|
||||
local enabled_keys = {}
|
||||
for _, ft in ipairs(filetypes) do
|
||||
local id = get_language_id({}, ft)
|
||||
if not enabled_keys[id] then
|
||||
enabled_keys[id] = true
|
||||
table.insert(enabled_ids, id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { bin_name },
|
||||
filetypes = { 'bib', 'gitcommit', 'markdown', 'org', 'plaintex', 'rst', 'rnoweb', 'tex', 'pandoc' },
|
||||
filetypes = filetypes,
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
get_language_id = function(_, filetype)
|
||||
local language_id = language_id_mapping[filetype]
|
||||
if language_id then
|
||||
return language_id
|
||||
else
|
||||
return filetype
|
||||
end
|
||||
end,
|
||||
get_language_id = get_language_id,
|
||||
settings = {
|
||||
ltex = {
|
||||
enabled = enabled_ids,
|
||||
},
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [=[
|
||||
|
@ -21,13 +21,12 @@ return {
|
||||
end
|
||||
root = util.root_pattern 'lua/'(fname)
|
||||
if root then
|
||||
return root .. '/lua/'
|
||||
return root
|
||||
end
|
||||
return util.find_git_ancestor(fname)
|
||||
end,
|
||||
single_file_support = true,
|
||||
log_level = vim.lsp.protocol.MessageType.Warning,
|
||||
settings = { Lua = { telemetry = { enable = false } } },
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
@ -35,7 +34,7 @@ https://github.com/luals/lua-language-server
|
||||
|
||||
Lua language server.
|
||||
|
||||
`lua-language-server` can be installed by following the instructions [here](https://github.com/luals/lua-language-server/wiki/Getting-Started#command-line).
|
||||
`lua-language-server` can be installed by following the instructions [here](https://luals.github.io/#neovim-install).
|
||||
|
||||
The default `cmd` assumes that the `lua-language-server` binary can be found in `$PATH`.
|
||||
|
||||
@ -43,38 +42,43 @@ If you primarily use `lua-language-server` for Neovim, and want to provide compl
|
||||
analysis, and location handling for plugins on runtime path, you can use the following
|
||||
settings.
|
||||
|
||||
Note: that these settings will meaningfully increase the time until `lua-language-server` can service
|
||||
initial requests (completion, location) upon starting as well as time to first diagnostics.
|
||||
Completion results will include a workspace indexing progress message until the server has finished indexing.
|
||||
|
||||
```lua
|
||||
require'lspconfig'.lua_ls.setup {
|
||||
settings = {
|
||||
Lua = {
|
||||
on_init = function(client)
|
||||
local path = client.workspace_folders[1].name
|
||||
if vim.loop.fs_stat(path..'/.luarc.json') or vim.loop.fs_stat(path..'/.luarc.jsonc') then
|
||||
return
|
||||
end
|
||||
|
||||
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT',
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = {'vim'},
|
||||
-- Tell the language server which version of Lua you're using
|
||||
-- (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT'
|
||||
},
|
||||
-- Make the server aware of Neovim runtime files
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME
|
||||
-- Depending on the usage, you might want to add additional paths here.
|
||||
-- "${3rd}/luv/library"
|
||||
-- "${3rd}/busted/library",
|
||||
}
|
||||
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower
|
||||
-- library = vim.api.nvim_get_runtime_file("", true)
|
||||
}
|
||||
})
|
||||
end,
|
||||
settings = {
|
||||
Lua = {}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
See `lua-language-server`'s [documentation](https://github.com/luals/lua-language-server/blob/master/locale/en-us/setting.lua) for an explanation of the above fields:
|
||||
* [Lua.runtime.path](https://github.com/luals/lua-language-server/blob/076dd3e5c4e03f9cef0c5757dfa09a010c0ec6bf/locale/en-us/setting.lua#L5-L13)
|
||||
* [Lua.workspace.library](https://github.com/luals/lua-language-server/blob/076dd3e5c4e03f9cef0c5757dfa09a010c0ec6bf/locale/en-us/setting.lua#L77-L78)
|
||||
See `lua-language-server`'s [documentation](https://luals.github.io/wiki/settings/) for an explanation of the above fields:
|
||||
* [Lua.runtime.path](https://luals.github.io/wiki/settings/#runtimepath)
|
||||
* [Lua.workspace.library](https://luals.github.io/wiki/settings/#workspacelibrary)
|
||||
|
||||
]],
|
||||
default_config = {
|
||||
|
@ -0,0 +1,37 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'lwc-language-server', '--stdio' },
|
||||
filetypes = { 'javascript', 'html' },
|
||||
root_dir = util.root_pattern 'sfdx-project.json',
|
||||
init_options = {
|
||||
embeddedLanguages = {
|
||||
javascript = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/forcedotcom/lightning-language-server/
|
||||
|
||||
Language server for Lightning Web Components.
|
||||
|
||||
For manual installation, utilize the official [NPM package](https://www.npmjs.com/package/@salesforce/lwc-language-server).
|
||||
Then, configure `cmd` to run the Node script at the unpacked location:
|
||||
|
||||
```lua
|
||||
require'lspconfig'.lwc_ls.setup {
|
||||
cmd = {
|
||||
'node',
|
||||
'/path/to/node_modules/@salesforce/lwc-language-server/bin/lwc-language-server.js',
|
||||
'--stdio'
|
||||
}
|
||||
}
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern('sfdx-project.json')]],
|
||||
},
|
||||
},
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
return {
|
||||
default_config = {
|
||||
root_dir = function(fname, _)
|
||||
return require('lspconfig').util.root_pattern('.git', '.obsidian', '.moxide.toml')(fname)
|
||||
end,
|
||||
filetypes = { 'markdown' },
|
||||
single_file_support = true,
|
||||
cmd = { 'markdown-oxide' },
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/Feel-ix-343/markdown-oxide
|
||||
|
||||
Editor Agnostic PKM: you bring the text editor and we
|
||||
bring the PKM.
|
||||
|
||||
Inspired by and compatible with Obsidian.
|
||||
|
||||
Check the readme to see how to properly setup.
|
||||
]],
|
||||
},
|
||||
commands = {
|
||||
Today = {
|
||||
function()
|
||||
vim.lsp.buf.execute_command { command = 'jump', arguments = { 'today' } }
|
||||
end,
|
||||
description = "Open today's daily note",
|
||||
},
|
||||
Tomorrow = {
|
||||
function()
|
||||
vim.lsp.buf.execute_command { command = 'jump', arguments = { 'tomorrow' } }
|
||||
end,
|
||||
description = "Open tomorrow's daily note",
|
||||
},
|
||||
Yesterday = {
|
||||
function()
|
||||
vim.lsp.buf.execute_command { command = 'jump', arguments = { 'yesterday' } }
|
||||
end,
|
||||
description = "Open yesterday's daily note",
|
||||
},
|
||||
},
|
||||
}
|
@ -6,7 +6,7 @@ local cmd = { bin_name, 'server' }
|
||||
return {
|
||||
default_config = {
|
||||
cmd = cmd,
|
||||
filetypes = { 'markdown' },
|
||||
filetypes = { 'markdown', 'markdown.mdx' },
|
||||
root_dir = function(fname)
|
||||
local root_files = { '.marksman.toml' }
|
||||
return util.root_pattern(unpack(root_files))(fname) or util.find_git_ancestor(fname)
|
||||
|
@ -7,19 +7,13 @@ return {
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = false,
|
||||
settings = {
|
||||
matlab = {
|
||||
MATLAB = {
|
||||
indexWorkspace = false,
|
||||
installPath = '',
|
||||
matlabConnectionTiming = 'onStart',
|
||||
telemetry = true,
|
||||
},
|
||||
},
|
||||
handlers = {
|
||||
['workspace/configuration'] = function(_, _, ctx)
|
||||
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
||||
return { client.config.settings.matlab }
|
||||
end,
|
||||
},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
|
@ -0,0 +1,32 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local function get_typescript_server_path(root_dir)
|
||||
local project_root = util.find_node_modules_ancestor(root_dir)
|
||||
return project_root and (util.path.join(project_root, 'node_modules', 'typescript', 'lib')) or ''
|
||||
end
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'mdx-language-server', '--stdio' },
|
||||
filetypes = { 'markdown.mdx' },
|
||||
root_dir = util.root_pattern 'package.json',
|
||||
single_file_support = true,
|
||||
settings = {},
|
||||
init_options = {
|
||||
typescript = {},
|
||||
},
|
||||
on_new_config = function(new_config, new_root_dir)
|
||||
if vim.tbl_get(new_config.init_options, 'typescript') and not new_config.init_options.typescript.tsdk then
|
||||
new_config.init_options.typescript.tsdk = get_typescript_server_path(new_root_dir)
|
||||
end
|
||||
end,
|
||||
},
|
||||
commands = {},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/mdx-js/mdx-analyzer
|
||||
|
||||
`mdx-analyzer`, a language server for MDX
|
||||
]],
|
||||
},
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'mesonlsp', '--lsp' },
|
||||
filetypes = { 'meson' },
|
||||
root_dir = util.root_pattern('meson_options.txt', 'meson.options', '.git'),
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/JCWasmx86/mesonlsp
|
||||
|
||||
An unofficial, unendorsed language server for meson written in C++
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[util.root_pattern("meson_options.txt", "meson.options", ".git")]],
|
||||
},
|
||||
},
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'mojo-lsp-server' },
|
||||
filetypes = { 'mojo' },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/modularml/mojo
|
||||
|
||||
`mojo-lsp-server` can be installed [via Modular](https://developer.modular.com/download)
|
||||
|
||||
Mojo is a new programming language that bridges the gap between research and production by combining Python syntax and ecosystem with systems programming and metaprogramming features.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[util.find_git_ancestor]],
|
||||
},
|
||||
},
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'motoko-lsp', '--stdio' },
|
||||
filetypes = { 'motoko' },
|
||||
root_dir = util.root_pattern('dfx.json', '.git'),
|
||||
init_options = {
|
||||
formatter = 'auto',
|
||||
},
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/dfinity/vscode-motoko
|
||||
|
||||
Language server for the Motoko programming language.
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[root_pattern("dfx.json", ".git")]],
|
||||
},
|
||||
},
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'mutt-language-server' },
|
||||
filetypes = { 'muttrc', 'neomuttrc' },
|
||||
root_dir = util.find_git_ancestor(),
|
||||
single_file_support = true,
|
||||
settings = {},
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/neomutt/mutt-language-server
|
||||
|
||||
A language server for (neo)mutt's muttrc. It can be installed via pip.
|
||||
|
||||
```sh
|
||||
pip install mutt-language-server
|
||||
```
|
||||
]],
|
||||
default_config = {
|
||||
root_dir = [[util.find_git_ancestor]],
|
||||
},
|
||||
},
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
filetypes = { 'elixir', 'eelixir', 'heex', 'surface' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern 'mix.exs'(fname) or util.find_git_ancestor(fname)
|
||||
end,
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/elixir-tools/next-ls
|
||||
|
||||
**By default, next-ls does not set its `cmd`. Please see the following [detailed instructions](https://www.elixir-tools.dev/docs/next-ls/installation/) for possible installation methods.**
|
||||
]],
|
||||
},
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user