Move lsp config to local file structure
This commit is contained in:
parent
e5c3bb2492
commit
20801272fc
383 changed files with 11829 additions and 114 deletions
|
|
@ -7,6 +7,77 @@ vim.g.maplocalleader = " "
|
||||||
-- Disable mouse input
|
-- Disable mouse input
|
||||||
vim.o.mouse = ""
|
vim.o.mouse = ""
|
||||||
|
|
||||||
|
-- Minimal number of screen lines to keep above and below the cursor.
|
||||||
|
vim.o.scrolloff = 10
|
||||||
|
|
||||||
|
-- Highlight the line where the cursor is on
|
||||||
|
vim.o.cursorline = true
|
||||||
|
|
||||||
|
-- Column at 80 characters
|
||||||
|
vim.o.colorcolumn = "80"
|
||||||
|
|
||||||
|
-- Set default tabstop and shiftwidth
|
||||||
|
vim.o.tabstop = 4
|
||||||
|
vim.o.shiftwidth = 4
|
||||||
|
|
||||||
|
-- Show <tab> and trailing spaces
|
||||||
|
vim.o.list = true
|
||||||
|
vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
|
||||||
|
|
||||||
|
-- Configure line wrap
|
||||||
|
vim.o.linebreak = true
|
||||||
|
vim.o.breakindent = true
|
||||||
|
vim.o.showbreak = "↪ "
|
||||||
|
|
||||||
|
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
||||||
|
vim.o.ignorecase = true
|
||||||
|
vim.o.smartcase = true
|
||||||
|
|
||||||
|
-- Use undofile to preserve actions over restarts
|
||||||
|
vim.o.undofile = true
|
||||||
|
|
||||||
|
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
|
||||||
|
-- instead raise a dialog asking if you wish to save the current file(s) See `:help 'confirm'`
|
||||||
|
vim.o.confirm = true
|
||||||
|
|
||||||
|
vim.o.termguicolors = true
|
||||||
|
vim.cmd.colorscheme("gruvbox")
|
||||||
|
|
||||||
|
-- [[ Set up keymaps ]] See `:h vim.keymap.set()`, `:h mapping`, `:h keycodes`
|
||||||
|
|
||||||
|
-- Use <Esc> to exit terminal mode
|
||||||
|
vim.keymap.set("t", "<Esc>", "<C-\\><C-n>")
|
||||||
|
|
||||||
|
-- Map <A-j>, <A-k>, <A-h>, <A-l> to navigate between windows in any modes
|
||||||
|
vim.keymap.set({ "t", "i" }, "<A-h>", "<C-\\><C-n><C-w>h")
|
||||||
|
vim.keymap.set({ "t", "i" }, "<A-j>", "<C-\\><C-n><C-w>j")
|
||||||
|
vim.keymap.set({ "t", "i" }, "<A-k>", "<C-\\><C-n><C-w>k")
|
||||||
|
vim.keymap.set({ "t", "i" }, "<A-l>", "<C-\\><C-n><C-w>l")
|
||||||
|
vim.keymap.set({ "n" }, "<A-h>", "<C-w>h")
|
||||||
|
vim.keymap.set({ "n" }, "<A-j>", "<C-w>j")
|
||||||
|
vim.keymap.set({ "n" }, "<A-k>", "<C-w>k")
|
||||||
|
vim.keymap.set({ "n" }, "<A-l>", "<C-w>l")
|
||||||
|
|
||||||
|
-- [[ Basic Autocommands ]].
|
||||||
|
-- See `:h lua-guide-autocommands`, `:h autocmd`, `:h nvim_create_autocmd()`
|
||||||
|
-- Highlight when yanking (copying) text.
|
||||||
|
-- Try it with `yap` in normal mode. See `:h vim.hl.on_yank()`
|
||||||
|
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||||
|
desc = "Highlight when yanking (copying) text",
|
||||||
|
callback = function()
|
||||||
|
vim.hl.on_yank()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Sync clipboard between OS and Neovim. Schedule the setting after `UiEnter` because it can
|
||||||
|
-- increase startup-time. Remove this option if you want your OS clipboard to remain independent.
|
||||||
|
-- See `:help 'clipboard'`
|
||||||
|
vim.api.nvim_create_autocmd("UIEnter", {
|
||||||
|
callback = function()
|
||||||
|
vim.o.clipboard = "unnamedplus"
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- Print the line number in front of each line
|
-- Print the line number in front of each line
|
||||||
vim.o.number = true
|
vim.o.number = true
|
||||||
|
|
||||||
|
|
@ -37,77 +108,6 @@ vim.api.nvim_create_autocmd({ "BufLeave", "FocusLost", "InsertEnter", "CmdlineEn
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Sync clipboard between OS and Neovim. Schedule the setting after `UiEnter` because it can
|
|
||||||
-- increase startup-time. Remove this option if you want your OS clipboard to remain independent.
|
|
||||||
-- See `:help 'clipboard'`
|
|
||||||
vim.api.nvim_create_autocmd("UIEnter", {
|
|
||||||
callback = function()
|
|
||||||
vim.o.clipboard = "unnamedplus"
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.o.termguicolors = true
|
|
||||||
vim.cmd.colorscheme("gruvbox")
|
|
||||||
|
|
||||||
-- Highlight the line where the cursor is on
|
|
||||||
vim.o.cursorline = true
|
|
||||||
|
|
||||||
-- Column at 80 characters
|
|
||||||
vim.o.colorcolumn = "80"
|
|
||||||
|
|
||||||
-- Minimal number of screen lines to keep above and below the cursor.
|
|
||||||
vim.o.scrolloff = 10
|
|
||||||
|
|
||||||
-- Set default tabstop and shiftwidth
|
|
||||||
vim.o.tabstop = 4
|
|
||||||
vim.o.shiftwidth = 4
|
|
||||||
|
|
||||||
-- Show <tab> and trailing spaces
|
|
||||||
vim.o.list = true
|
|
||||||
vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
|
|
||||||
|
|
||||||
-- Configure line wrap
|
|
||||||
vim.o.linebreak = true
|
|
||||||
vim.o.breakindent = true
|
|
||||||
vim.o.showbreak = "↪ "
|
|
||||||
|
|
||||||
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
|
||||||
vim.o.ignorecase = true
|
|
||||||
vim.o.smartcase = true
|
|
||||||
|
|
||||||
-- Use undofile to preserve actions over restarts
|
|
||||||
vim.o.undofile = true
|
|
||||||
|
|
||||||
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
|
|
||||||
-- instead raise a dialog asking if you wish to save the current file(s) See `:help 'confirm'`
|
|
||||||
vim.o.confirm = true
|
|
||||||
|
|
||||||
-- [[ Set up keymaps ]] See `:h vim.keymap.set()`, `:h mapping`, `:h keycodes`
|
|
||||||
|
|
||||||
-- Use <Esc> to exit terminal mode
|
|
||||||
vim.keymap.set("t", "<Esc>", "<C-\\><C-n>")
|
|
||||||
|
|
||||||
-- Map <A-j>, <A-k>, <A-h>, <A-l> to navigate between windows in any modes
|
|
||||||
vim.keymap.set({ "t", "i" }, "<A-h>", "<C-\\><C-n><C-w>h")
|
|
||||||
vim.keymap.set({ "t", "i" }, "<A-j>", "<C-\\><C-n><C-w>j")
|
|
||||||
vim.keymap.set({ "t", "i" }, "<A-k>", "<C-\\><C-n><C-w>k")
|
|
||||||
vim.keymap.set({ "t", "i" }, "<A-l>", "<C-\\><C-n><C-w>l")
|
|
||||||
vim.keymap.set({ "n" }, "<A-h>", "<C-w>h")
|
|
||||||
vim.keymap.set({ "n" }, "<A-j>", "<C-w>j")
|
|
||||||
vim.keymap.set({ "n" }, "<A-k>", "<C-w>k")
|
|
||||||
vim.keymap.set({ "n" }, "<A-l>", "<C-w>l")
|
|
||||||
|
|
||||||
-- [[ Basic Autocommands ]].
|
|
||||||
-- See `:h lua-guide-autocommands`, `:h autocmd`, `:h nvim_create_autocmd()`
|
|
||||||
-- Highlight when yanking (copying) text.
|
|
||||||
-- Try it with `yap` in normal mode. See `:h vim.hl.on_yank()`
|
|
||||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
|
||||||
desc = "Highlight when yanking (copying) text",
|
|
||||||
callback = function()
|
|
||||||
vim.hl.on_yank()
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- [[ Create user commands ]]
|
-- [[ Create user commands ]]
|
||||||
-- See `:h nvim_create_user_command()` and `:h user-commands`
|
-- See `:h nvim_create_user_command()` and `:h user-commands`
|
||||||
|
|
||||||
|
|
@ -126,9 +126,6 @@ end, { desc = "Print the git blame for the current line" })
|
||||||
-- 'updatetime' and when going to insert mode
|
-- 'updatetime' and when going to insert mode
|
||||||
vim.cmd("packadd! nohlsearch")
|
vim.cmd("packadd! nohlsearch")
|
||||||
|
|
||||||
vim.pack.add({"https://github.com/nvim-treesitter/nvim-treesitter"})
|
|
||||||
require("nvim-treesitter").install('latex', 'lua', 'c', 'ocaml')
|
|
||||||
|
|
||||||
-- Treat Ipe stylesheets as xml code
|
-- Treat Ipe stylesheets as xml code
|
||||||
vim.filetype.add({
|
vim.filetype.add({
|
||||||
extension = {
|
extension = {
|
||||||
|
|
@ -136,50 +133,16 @@ vim.filetype.add({
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- See `:h lspconfig-all` for available servers and their settings
|
-- Install nvim-treesitter
|
||||||
local lsp_servers = {
|
vim.pack.add({"https://github.com/nvim-treesitter/nvim-treesitter"})
|
||||||
lua_ls = {
|
require("nvim-treesitter").install('latex', 'lua', 'c', 'ocaml')
|
||||||
-- https://luals.github.io/wiki/settings/ | `:h nvim_get_runtime_file`
|
|
||||||
Lua = { workspace = { library = vim.api.nvim_get_runtime_file("lua", true) } },
|
|
||||||
},
|
|
||||||
clangd = {},
|
|
||||||
rust_analyzer = {},
|
|
||||||
texlab = {},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- See `:h lsp-quickstart` for more details.
|
-- See `:h lsp-quickstart` for more details.
|
||||||
vim.pack.add({
|
vim.pack.add({"https://github.com/mason-org/mason.nvim"})
|
||||||
"https://github.com/neovim/nvim-lspconfig", -- default configs for lsps
|
|
||||||
"https://github.com/mason-org/mason.nvim", -- package manager
|
|
||||||
"https://github.com/mason-org/mason-lspconfig.nvim", -- lspconfig bridge
|
|
||||||
"https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim", -- auto installer
|
|
||||||
})
|
|
||||||
|
|
||||||
require("mason").setup()
|
require("mason").setup()
|
||||||
require("mason-lspconfig").setup()
|
|
||||||
require("mason-tool-installer").setup({
|
|
||||||
ensure_installed = vim.tbl_keys(lsp_servers),
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Configure each lsp server on the table
|
vim.lsp.enable({'lua_ls', 'texlab', 'clangd', 'ocaml-lsp'})
|
||||||
-- To check what clients are attached to the current buffer, use `:checkhealth vim.lsp`.
|
|
||||||
-- To view default lsp keybindings, use `:h lsp-defaults`.
|
|
||||||
for server, config in pairs(lsp_servers) do
|
|
||||||
vim.lsp.config(server, {
|
|
||||||
settings = config,
|
|
||||||
-- only create the keymaps if the server attaches successfully
|
|
||||||
on_attach = function(_, bufnr)
|
|
||||||
-- Put mappings here
|
|
||||||
vim.keymap.set(
|
|
||||||
"n",
|
|
||||||
"<leader>ld",
|
|
||||||
vim.lsp.buf.definition,
|
|
||||||
{ buffer = bufnr, desc = "vim.lsp.buf.definition()" }
|
|
||||||
)
|
|
||||||
vim.keymap.set("n", "<leader>lf", vim.lsp.buf.format, { buffer = bufnr, desc = "vim.lsp.buf.format()" })
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
signs = {
|
signs = {
|
||||||
|
|
@ -302,3 +265,4 @@ hipatterns.setup({
|
||||||
|
|
||||||
-- Use mini.notify
|
-- Use mini.notify
|
||||||
require("mini.notify").setup()
|
require("mini.notify").setup()
|
||||||
|
|
||||||
|
|
|
||||||
31
.config/nvim/lsp/ada_ls.lua
Normal file
31
.config/nvim/lsp/ada_ls.lua
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/AdaCore/ada_language_server
|
||||||
|
---
|
||||||
|
--- Installation instructions can be found [here](https://github.com/AdaCore/ada_language_server#Install).
|
||||||
|
---
|
||||||
|
--- Workspace-specific [settings](https://github.com/AdaCore/ada_language_server/blob/master/doc/settings.md) such as `projectFile` can be provided in a `.als.json` file at the root of the workspace.
|
||||||
|
--- Alternatively, configuration may be passed as a "settings" object to `vim.lsp.config('ada_ls', {})`:
|
||||||
|
---
|
||||||
|
--- ```lua
|
||||||
|
--- vim.lsp.config('ada_ls', {
|
||||||
|
--- settings = {
|
||||||
|
--- ada = {
|
||||||
|
--- projectFile = "project.gpr";
|
||||||
|
--- scenarioVariables = { ... };
|
||||||
|
--- }
|
||||||
|
--- }
|
||||||
|
--- })
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
local util = require 'lspconfig.util'
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'ada_language_server' },
|
||||||
|
filetypes = { 'ada' },
|
||||||
|
root_dir = function(bufnr, on_dir)
|
||||||
|
local fname = vim.api.nvim_buf_get_name(bufnr)
|
||||||
|
on_dir(util.root_pattern('Makefile', '.git', 'alire.toml', '*.gpr', '*.adc')(fname))
|
||||||
|
end,
|
||||||
|
}
|
||||||
17
.config/nvim/lsp/agda_ls.lua
Normal file
17
.config/nvim/lsp/agda_ls.lua
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/agda/agda-language-server
|
||||||
|
---
|
||||||
|
--- Language Server for Agda.
|
||||||
|
|
||||||
|
local util = require 'lspconfig.util'
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'als' },
|
||||||
|
filetypes = { 'agda' },
|
||||||
|
root_dir = function(bufnr, on_dir)
|
||||||
|
local fname = vim.api.nvim_buf_get_name(bufnr)
|
||||||
|
on_dir(util.root_pattern('.git', '*.agda-lib')(fname))
|
||||||
|
end,
|
||||||
|
}
|
||||||
15
.config/nvim/lsp/aiken.lua
Normal file
15
.config/nvim/lsp/aiken.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/aiken-lang/aiken
|
||||||
|
---
|
||||||
|
--- A language server for Aiken Programming Language.
|
||||||
|
--- [Installation](https://aiken-lang.org/installation-instructions)
|
||||||
|
---
|
||||||
|
--- It can be i
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'aiken', 'lsp' },
|
||||||
|
filetypes = { 'aiken' },
|
||||||
|
root_markers = { 'aiken.toml', '.git' },
|
||||||
|
}
|
||||||
14
.config/nvim/lsp/air.lua
Normal file
14
.config/nvim/lsp/air.lua
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/posit-dev/air
|
||||||
|
---
|
||||||
|
--- Air is an R formatter and language server, written in Rust.
|
||||||
|
---
|
||||||
|
--- Refer to the [documentation](https://posit-dev.github.io/air/editors.html) for more details.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'air', 'language-server' },
|
||||||
|
filetypes = { 'r' },
|
||||||
|
root_markers = { 'air.toml', '.air.toml', '.git' },
|
||||||
|
}
|
||||||
30
.config/nvim/lsp/alloy_ls.lua
Normal file
30
.config/nvim/lsp/alloy_ls.lua
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/AlloyTools/org.alloytools.alloy
|
||||||
|
---
|
||||||
|
--- Alloy is a formal specification language for describing structures and a tool for exploring them.
|
||||||
|
---
|
||||||
|
--- You may also need to configure the filetype for Alloy (*.als) files:
|
||||||
|
---
|
||||||
|
--- ```
|
||||||
|
--- autocmd BufNewFile,BufRead *.als set filetype=alloy
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- or
|
||||||
|
---
|
||||||
|
--- ```lua
|
||||||
|
--- vim.filetype.add({
|
||||||
|
--- pattern = {
|
||||||
|
--- ['.*/*.als'] = 'alloy',
|
||||||
|
--- },
|
||||||
|
--- })
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- Alternatively, you may use a syntax plugin like https://github.com/runoshun/vim-alloy.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'alloy', 'lsp' },
|
||||||
|
filetypes = { 'alloy' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
71
.config/nvim/lsp/anakin_language_server.lua
Normal file
71
.config/nvim/lsp/anakin_language_server.lua
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://pypi.org/project/anakin-language-server/
|
||||||
|
---
|
||||||
|
--- `anakin-language-server` is yet another Jedi Python language server.
|
||||||
|
---
|
||||||
|
--- Available options:
|
||||||
|
---
|
||||||
|
--- * Initialization: https://github.com/muffinmad/anakin-language-server#initialization-option
|
||||||
|
--- * Configuration: https://github.com/muffinmad/anakin-language-server#configuration-options
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'anakinls' },
|
||||||
|
filetypes = { 'python' },
|
||||||
|
root_markers = {
|
||||||
|
'pyproject.toml',
|
||||||
|
'setup.py',
|
||||||
|
'setup.cfg',
|
||||||
|
'requirements.txt',
|
||||||
|
'Pipfile',
|
||||||
|
'.git',
|
||||||
|
},
|
||||||
|
settings = {
|
||||||
|
anakinls = {
|
||||||
|
pyflakes_errors = {
|
||||||
|
-- Full list: https://github.com/PyCQA/pyflakes/blob/master/pyflakes/messages.py
|
||||||
|
|
||||||
|
'ImportStarNotPermitted',
|
||||||
|
|
||||||
|
'UndefinedExport',
|
||||||
|
'UndefinedLocal',
|
||||||
|
'UndefinedName',
|
||||||
|
|
||||||
|
'DuplicateArgument',
|
||||||
|
'MultiValueRepeatedKeyLiteral',
|
||||||
|
'MultiValueRepeatedKeyVariable',
|
||||||
|
|
||||||
|
'FutureFeatureNotDefined',
|
||||||
|
'LateFutureImport',
|
||||||
|
|
||||||
|
'ReturnOutsideFunction',
|
||||||
|
'YieldOutsideFunction',
|
||||||
|
'ContinueOutsideLoop',
|
||||||
|
'BreakOutsideLoop',
|
||||||
|
|
||||||
|
'TwoStarredExpressions',
|
||||||
|
'TooManyExpressionsInStarredAssignment',
|
||||||
|
|
||||||
|
'ForwardAnnotationSyntaxError',
|
||||||
|
'RaiseNotImplemented',
|
||||||
|
|
||||||
|
'StringDotFormatExtraPositionalArguments',
|
||||||
|
'StringDotFormatExtraNamedArguments',
|
||||||
|
'StringDotFormatMissingArgument',
|
||||||
|
'StringDotFormatMixingAutomatic',
|
||||||
|
'StringDotFormatInvalidFormat',
|
||||||
|
|
||||||
|
'PercentFormatInvalidFormat',
|
||||||
|
'PercentFormatMixedPositionalAndNamed',
|
||||||
|
'PercentFormatUnsupportedFormat',
|
||||||
|
'PercentFormatPositionalCountMismatch',
|
||||||
|
'PercentFormatExtraNamedArguments',
|
||||||
|
'PercentFormatMissingArgument',
|
||||||
|
'PercentFormatExpectedMapping',
|
||||||
|
'PercentFormatExpectedSequence',
|
||||||
|
'PercentFormatStarRequiresSequence',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
123
.config/nvim/lsp/angularls.lua
Normal file
123
.config/nvim/lsp/angularls.lua
Normal file
|
|
@ -0,0 +1,123 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/angular/vscode-ng-language-service
|
||||||
|
--- `angular-language-server` can be installed via npm `npm install -g @angular/language-server`.
|
||||||
|
---
|
||||||
|
--- ```lua
|
||||||
|
--- local project_library_path = "/path/to/project/lib"
|
||||||
|
--- local cmd = {"ngserver", "--stdio", "--tsProbeLocations", project_library_path , "--ngProbeLocations", project_library_path}
|
||||||
|
---
|
||||||
|
--- vim.lsp.config('angularls', {
|
||||||
|
--- cmd = cmd,
|
||||||
|
--- })
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
-- Angular requires a node_modules directory to probe for @angular/language-service and typescript
|
||||||
|
-- in order to use your projects configured versions.
|
||||||
|
local fs, fn, uv = vim.fs, vim.fn, vim.uv
|
||||||
|
|
||||||
|
--- Recursively solve for the original ngserver path on Windows
|
||||||
|
-- For a given ngserver path:
|
||||||
|
-- - If it is not a CMD wrapper, return the path;
|
||||||
|
-- - Or else, extract the path from the CMD wrapper.
|
||||||
|
--
|
||||||
|
-- @param cmd_path (string) path for the ngserver executable or its CMD wrapper.
|
||||||
|
-- @return (string) the original executable path for ngserver
|
||||||
|
-- @usage
|
||||||
|
-- -- Base case: cmd_path already points to ngserver (expected behavior on Linux)
|
||||||
|
-- resolve_cmd_shim('/home/user/project/node_modules/@angular/language-server/bin/ngserver')
|
||||||
|
-- => '/home/user/project/node_modules/@angular/language-server/bin/ngserver'
|
||||||
|
--
|
||||||
|
-- -- Recursive case: cmd_path points to a CMD wrapper (Windows)
|
||||||
|
-- resolve_cmd_shim('C:/Users/user/project/node_modules/.bin/ngserver.cmd')
|
||||||
|
-- => 'C:/Users/user/project/node_modules/@angular/language-server/bin/ngserver'
|
||||||
|
local function resolve_cmd_shim(cmd_path)
|
||||||
|
if not cmd_path:lower():match('%ngserver.cmd$') then
|
||||||
|
return cmd_path
|
||||||
|
end
|
||||||
|
|
||||||
|
local ok, content = pcall(fn.readblob, cmd_path)
|
||||||
|
if not ok or not content then
|
||||||
|
return cmd_path
|
||||||
|
end
|
||||||
|
|
||||||
|
local target = content:match('%s%"%%dp0%%\\([^\r\n]-ngserver[^\r\n]-)%"')
|
||||||
|
if not target then
|
||||||
|
return cmd_path
|
||||||
|
end
|
||||||
|
|
||||||
|
local full = fs.normalize(fs.joinpath(fs.dirname(cmd_path), target))
|
||||||
|
|
||||||
|
return resolve_cmd_shim(full)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function collect_node_modules(root_dir)
|
||||||
|
local results = {}
|
||||||
|
|
||||||
|
local project_node = fs.joinpath(root_dir, 'node_modules')
|
||||||
|
if uv.fs_stat(project_node) then
|
||||||
|
table.insert(results, project_node)
|
||||||
|
end
|
||||||
|
|
||||||
|
local ngserver_exe = fn.exepath('ngserver')
|
||||||
|
if ngserver_exe and #ngserver_exe > 0 then
|
||||||
|
local realpath = uv.fs_realpath(ngserver_exe) or ngserver_exe
|
||||||
|
realpath = resolve_cmd_shim(realpath)
|
||||||
|
local candidate = fs.normalize(fs.joinpath(fs.dirname(realpath), '../../..'))
|
||||||
|
if uv.fs_stat(candidate) then
|
||||||
|
table.insert(results, candidate)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return results
|
||||||
|
end
|
||||||
|
|
||||||
|
local function get_angular_core_version(root_dir)
|
||||||
|
local package_json = fs.joinpath(root_dir, 'package.json')
|
||||||
|
if not uv.fs_stat(package_json) then
|
||||||
|
return ''
|
||||||
|
end
|
||||||
|
|
||||||
|
local ok, content = pcall(fn.readblob, package_json)
|
||||||
|
if not ok or not content then
|
||||||
|
return ''
|
||||||
|
end
|
||||||
|
|
||||||
|
local json = vim.json.decode(content) or {}
|
||||||
|
|
||||||
|
local version = (json.dependencies or {})['@angular/core'] or ''
|
||||||
|
return version:match('%d+%.%d+%.%d+') or ''
|
||||||
|
end
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = function(dispatchers, config)
|
||||||
|
local root_dir = (config and config.root_dir) or fn.getcwd()
|
||||||
|
local node_paths = collect_node_modules(root_dir)
|
||||||
|
|
||||||
|
local ts_probe = table.concat(node_paths, ',')
|
||||||
|
local ng_probe = table.concat(
|
||||||
|
vim
|
||||||
|
.iter(node_paths)
|
||||||
|
:map(function(p)
|
||||||
|
return fs.joinpath(p, '@angular/language-server/node_modules')
|
||||||
|
end)
|
||||||
|
:totable(),
|
||||||
|
','
|
||||||
|
)
|
||||||
|
local cmd = {
|
||||||
|
'ngserver',
|
||||||
|
'--stdio',
|
||||||
|
'--tsProbeLocations',
|
||||||
|
ts_probe,
|
||||||
|
'--ngProbeLocations',
|
||||||
|
ng_probe,
|
||||||
|
'--angularCoreVersion',
|
||||||
|
get_angular_core_version(root_dir),
|
||||||
|
}
|
||||||
|
return vim.lsp.rpc.start(cmd, dispatchers)
|
||||||
|
end,
|
||||||
|
|
||||||
|
filetypes = { 'typescript', 'html', 'typescriptreact', 'typescript.tsx', 'htmlangular' },
|
||||||
|
root_markers = { 'angular.json', 'nx.json' },
|
||||||
|
}
|
||||||
38
.config/nvim/lsp/ansiblels.lua
Normal file
38
.config/nvim/lsp/ansiblels.lua
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/ansible/vscode-ansible
|
||||||
|
---
|
||||||
|
--- Language server for the ansible configuration management tool.
|
||||||
|
---
|
||||||
|
--- `ansible-language-server` can be installed via `npm`:
|
||||||
|
---
|
||||||
|
--- ```sh
|
||||||
|
--- npm install -g @ansible/ansible-language-server
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'ansible-language-server', '--stdio' },
|
||||||
|
settings = {
|
||||||
|
ansible = {
|
||||||
|
python = {
|
||||||
|
interpreterPath = 'python',
|
||||||
|
},
|
||||||
|
ansible = {
|
||||||
|
path = 'ansible',
|
||||||
|
},
|
||||||
|
executionEnvironment = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
|
validation = {
|
||||||
|
enabled = true,
|
||||||
|
lint = {
|
||||||
|
enabled = true,
|
||||||
|
path = 'ansible-lint',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
filetypes = { 'yaml.ansible' },
|
||||||
|
root_markers = { 'ansible.cfg', '.ansible-lint' },
|
||||||
|
}
|
||||||
15
.config/nvim/lsp/antlersls.lua
Normal file
15
.config/nvim/lsp/antlersls.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://www.npmjs.com/package/antlers-language-server
|
||||||
|
---
|
||||||
|
--- `antlersls` can be installed via `npm`:
|
||||||
|
--- ```sh
|
||||||
|
--- npm install -g antlers-language-server
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'antlersls', '--stdio' },
|
||||||
|
filetypes = { 'html', 'antlers' },
|
||||||
|
root_markers = { 'composer.json' },
|
||||||
|
}
|
||||||
61
.config/nvim/lsp/apex_ls.lua
Normal file
61
.config/nvim/lsp/apex_ls.lua
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
--- @brief
|
||||||
|
---
|
||||||
|
--- https://github.com/forcedotcom/salesforcedx-vscode
|
||||||
|
---
|
||||||
|
--- Language server for Apex.
|
||||||
|
---
|
||||||
|
--- For manual installation, download the JAR file from the [VSCode
|
||||||
|
--- extension](https://github.com/forcedotcom/salesforcedx-vscode/tree/develop/packages/salesforcedx-vscode-apex) and adjust the `apex_jar_path` appropriately.
|
||||||
|
---
|
||||||
|
--- ```lua
|
||||||
|
--- vim.lsp.config('apex_ls', {
|
||||||
|
--- apex_jar_path = '/path/to/apex-jorje-lsp.jar',
|
||||||
|
--- apex_enable_semantic_errors = false, -- Whether to allow Apex Language Server to surface semantic errors
|
||||||
|
--- apex_enable_completion_statistics = false, -- Whether to allow Apex Language Server to collect telemetry on code completion usage
|
||||||
|
--- }
|
||||||
|
---```
|
||||||
|
---
|
||||||
|
--- Example configuration using Mason:
|
||||||
|
---
|
||||||
|
---```lua
|
||||||
|
--- vim.lsp.config('apex_ls', {
|
||||||
|
--- apex_jar_path = vim.fn.stdpath('data') .. '/mason/share/apex-language-server/apex-jorje-lsp.jar',
|
||||||
|
--- }
|
||||||
|
---```
|
||||||
|
---
|
||||||
|
--- For a complete experience, you may need to ensure the treesitter parsers for 'apex' are installed (:TSInstall apex) as well as configure the filetype for apex (*.cls) files:
|
||||||
|
---
|
||||||
|
--- ```lua
|
||||||
|
--- vim.filetype.add({
|
||||||
|
--- pattern = {
|
||||||
|
--- ['.*/*.cls'] = 'apex',
|
||||||
|
--- },
|
||||||
|
--- })
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = function(dispatchers, config)
|
||||||
|
---@diagnostic disable: undefined-field
|
||||||
|
local local_cmd = {
|
||||||
|
vim.env.JAVA_HOME and (vim.env.JAVA_HOME .. '/bin/java') or 'java',
|
||||||
|
'-cp',
|
||||||
|
config.apex_jar_path,
|
||||||
|
'-Ddebug.internal.errors=true',
|
||||||
|
'-Ddebug.semantic.errors=' .. tostring(config.apex_enable_semantic_errors or false),
|
||||||
|
'-Ddebug.completion.statistics=' .. tostring(config.apex_enable_completion_statistics or false),
|
||||||
|
'-Dlwc.typegeneration.disabled=true',
|
||||||
|
}
|
||||||
|
if config.apex_jvm_max_heap then
|
||||||
|
table.insert(local_cmd, '-Xmx' .. config.apex_jvm_max_heap)
|
||||||
|
end
|
||||||
|
---@diagnostic enable: undefined-field
|
||||||
|
table.insert(local_cmd, 'apex.jorje.lsp.ApexLanguageServerLauncher')
|
||||||
|
|
||||||
|
return vim.lsp.rpc.start(local_cmd, dispatchers)
|
||||||
|
end,
|
||||||
|
filetypes = { 'apex', 'apexcode' },
|
||||||
|
root_markers = {
|
||||||
|
'sfdx-project.json',
|
||||||
|
},
|
||||||
|
}
|
||||||
93
.config/nvim/lsp/arduino_language_server.lua
Normal file
93
.config/nvim/lsp/arduino_language_server.lua
Normal file
|
|
@ -0,0 +1,93 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/arduino/arduino-language-server
|
||||||
|
---
|
||||||
|
--- Language server for Arduino
|
||||||
|
---
|
||||||
|
--- The `arduino-language-server` can be installed by running:
|
||||||
|
---
|
||||||
|
--- ```
|
||||||
|
--- go install github.com/arduino/arduino-language-server@latest
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- The `arduino-cli` tool must also be installed. Follow [these
|
||||||
|
--- installation instructions](https://arduino.github.io/arduino-cli/latest/installation/) for
|
||||||
|
--- your platform.
|
||||||
|
---
|
||||||
|
--- After installing `arduino-cli`, follow [these
|
||||||
|
--- instructions](https://arduino.github.io/arduino-cli/latest/getting-started/#create-a-configuration-file)
|
||||||
|
--- for generating a configuration file if you haven't done so already, and make
|
||||||
|
--- sure you [install any relevant platforms
|
||||||
|
--- libraries](https://arduino.github.io/arduino-cli/latest/getting-started/#install-the-core-for-your-board).
|
||||||
|
---
|
||||||
|
--- The language server also requires `clangd` to be installed. Follow [these
|
||||||
|
--- installation instructions](https://clangd.llvm.org/installation) for your
|
||||||
|
--- platform.
|
||||||
|
---
|
||||||
|
--- If you don't have a sketch yet create one.
|
||||||
|
---
|
||||||
|
--- ```sh
|
||||||
|
--- $ arduino-cli sketch new test
|
||||||
|
--- $ cd test
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- 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 by using the following commands.
|
||||||
|
---
|
||||||
|
---
|
||||||
|
--- First gather some information about your board. Make sure your board is connected and run the following:
|
||||||
|
---
|
||||||
|
--- ```sh
|
||||||
|
--- $ arduino-cli board list
|
||||||
|
--- Port Protocol Type Board Name FQBN Core
|
||||||
|
--- /dev/ttyACM0 serial Serial Port (USB) Arduino Uno arduino:avr:uno arduino:avr
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- Then generate the file:
|
||||||
|
---
|
||||||
|
--- ```sh
|
||||||
|
--- arduino-cli board attach -p /dev/ttyACM0 -b arduino:avr:uno test.ino
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- The resulting file should look like this:
|
||||||
|
---
|
||||||
|
--- ```yaml
|
||||||
|
--- default_fqbn: arduino:avr:uno
|
||||||
|
--- default_port: /dev/ttyACM0
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- Your folder structure should look like this:
|
||||||
|
---
|
||||||
|
--- ```
|
||||||
|
--- .
|
||||||
|
--- ├── test.ino
|
||||||
|
--- └── sketch.yaml
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- For further instructions about configuration options, run `arduino-language-server --help`.
|
||||||
|
---
|
||||||
|
--- Note that an upstream bug makes keywords in some cases become undefined by the language server.
|
||||||
|
--- Ref: https://github.com/arduino/arduino-ide/issues/159
|
||||||
|
|
||||||
|
local util = require 'lspconfig.util'
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
filetypes = { 'arduino' },
|
||||||
|
root_dir = function(bufnr, on_dir)
|
||||||
|
local fname = vim.api.nvim_buf_get_name(bufnr)
|
||||||
|
on_dir(util.root_pattern('*.ino')(fname))
|
||||||
|
end,
|
||||||
|
cmd = {
|
||||||
|
'arduino-language-server',
|
||||||
|
},
|
||||||
|
capabilities = {
|
||||||
|
textDocument = {
|
||||||
|
---@diagnostic disable-next-line: assign-type-mismatch
|
||||||
|
semanticTokens = vim.NIL,
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
---@diagnostic disable-next-line: assign-type-mismatch
|
||||||
|
semanticTokens = vim.NIL,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
15
.config/nvim/lsp/asm_lsp.lua
Normal file
15
.config/nvim/lsp/asm_lsp.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/bergercookie/asm-lsp
|
||||||
|
---
|
||||||
|
--- Language Server for NASM/GAS/GO Assembly
|
||||||
|
---
|
||||||
|
--- `asm-lsp` can be installed via cargo:
|
||||||
|
--- cargo install asm-lsp
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'asm-lsp' },
|
||||||
|
filetypes = { 'asm', 'vmasm' },
|
||||||
|
root_markers = { '.asm-lsp.toml', '.git' },
|
||||||
|
}
|
||||||
48
.config/nvim/lsp/ast_grep.lua
Normal file
48
.config/nvim/lsp/ast_grep.lua
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- 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
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'ast-grep', 'lsp' },
|
||||||
|
workspace_required = true,
|
||||||
|
reuse_client = function(client, config)
|
||||||
|
config.cmd_cwd = config.root_dir
|
||||||
|
return client.config.cmd_cwd == config.cmd_cwd
|
||||||
|
end,
|
||||||
|
filetypes = { -- https://ast-grep.github.io/reference/languages.html
|
||||||
|
'bash',
|
||||||
|
'c',
|
||||||
|
'cpp',
|
||||||
|
'cs',
|
||||||
|
'css',
|
||||||
|
'elixir',
|
||||||
|
'go',
|
||||||
|
'haskell',
|
||||||
|
'html',
|
||||||
|
'java',
|
||||||
|
'javascript',
|
||||||
|
'javascriptreact',
|
||||||
|
'json',
|
||||||
|
'kotlin',
|
||||||
|
'lua',
|
||||||
|
'nix',
|
||||||
|
'php',
|
||||||
|
'python',
|
||||||
|
'ruby',
|
||||||
|
'rust',
|
||||||
|
'scala',
|
||||||
|
'solidity',
|
||||||
|
'swift',
|
||||||
|
'typescript',
|
||||||
|
'typescriptreact',
|
||||||
|
'yaml',
|
||||||
|
},
|
||||||
|
root_markers = { 'sgconfig.yaml', 'sgconfig.yml' },
|
||||||
|
}
|
||||||
25
.config/nvim/lsp/astro.lua
Normal file
25
.config/nvim/lsp/astro.lua
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/withastro/language-tools/tree/main/packages/language-server
|
||||||
|
---
|
||||||
|
--- `astro-ls` can be installed via `npm`:
|
||||||
|
--- ```sh
|
||||||
|
--- npm install -g @astrojs/language-server
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
local util = require 'lspconfig.util'
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'astro-ls', '--stdio' },
|
||||||
|
filetypes = { 'astro' },
|
||||||
|
root_markers = { 'package.json', 'tsconfig.json', 'jsconfig.json', '.git' },
|
||||||
|
init_options = {
|
||||||
|
typescript = {},
|
||||||
|
},
|
||||||
|
before_init = function(_, config)
|
||||||
|
if config.init_options and config.init_options.typescript and not config.init_options.typescript.tsdk then
|
||||||
|
config.init_options.typescript.tsdk = util.get_typescript_server_path(config.root_dir)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
66
.config/nvim/lsp/atlas.lua
Normal file
66
.config/nvim/lsp/atlas.lua
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/ariga/atlas
|
||||||
|
---
|
||||||
|
--- Language server for Atlas config and schema files.
|
||||||
|
---
|
||||||
|
--- You may also need to configure the filetype for *.hcl files:
|
||||||
|
---
|
||||||
|
--- ```vim
|
||||||
|
--- autocmd BufNewFile,BufRead atlas.hcl set filetype=atlas-config
|
||||||
|
--- autocmd BufNewFile,BufRead *.my.hcl set filetype=atlas-schema-mysql
|
||||||
|
--- autocmd BufNewFile,BufRead *.pg.hcl set filetype=atlas-schema-postgresql
|
||||||
|
--- autocmd BufNewFile,BufRead *.lt.hcl set filetype=atlas-schema-sqlite
|
||||||
|
--- autocmd BufNewFile,BufRead *.ch.hcl set filetype=atlas-schema-clickhouse
|
||||||
|
--- autocmd BufNewFile,BufRead *.ms.hcl set filetype=atlas-schema-mssql
|
||||||
|
--- autocmd BufNewFile,BufRead *.rs.hcl set filetype=atlas-schema-redshift
|
||||||
|
--- autocmd BufNewFile,BufRead *.test.hcl set filetype=atlas-test
|
||||||
|
--- autocmd BufNewFile,BufRead *.plan.hcl set filetype=atlas-plan
|
||||||
|
--- autocmd BufNewFile,BufRead *.rule.hcl set filetype=atlas-rule
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- or
|
||||||
|
---
|
||||||
|
--- ```lua
|
||||||
|
--- vim.filetype.add({
|
||||||
|
--- filename = {
|
||||||
|
--- ['atlas.hcl'] = 'atlas-config',
|
||||||
|
--- },
|
||||||
|
--- pattern = {
|
||||||
|
--- ['.*/*.my.hcl'] = 'atlas-schema-mysql',
|
||||||
|
--- ['.*/*.pg.hcl'] = 'atlas-schema-postgresql',
|
||||||
|
--- ['.*/*.lt.hcl'] = 'atlas-schema-sqlite',
|
||||||
|
--- ['.*/*.ch.hcl'] = 'atlas-schema-clickhouse',
|
||||||
|
--- ['.*/*.ms.hcl'] = 'atlas-schema-mssql',
|
||||||
|
--- ['.*/*.rs.hcl'] = 'atlas-schema-redshift',
|
||||||
|
--- ['.*/*.test.hcl'] = 'atlas-test',
|
||||||
|
--- ['.*/*.plan.hcl'] = 'atlas-plan',
|
||||||
|
--- ['.*/*.rule.hcl'] = 'atlas-rule',
|
||||||
|
--- },
|
||||||
|
--- })
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- Optionally, tell treesitter to treat Atlas filetypes as HCL for better syntax highlighting:
|
||||||
|
---
|
||||||
|
--- ```lua
|
||||||
|
--- vim.treesitter.language.register('hcl', 'atlas-config')
|
||||||
|
--- vim.treesitter.language.register('hcl', 'atlas-schema-mysql')
|
||||||
|
--- vim.treesitter.language.register('hcl', 'atlas-schema-postgresql')
|
||||||
|
--- vim.treesitter.language.register('hcl', 'atlas-schema-sqlite')
|
||||||
|
--- vim.treesitter.language.register('hcl', 'atlas-schema-clickhouse')
|
||||||
|
--- vim.treesitter.language.register('hcl', 'atlas-schema-mssql')
|
||||||
|
--- vim.treesitter.language.register('hcl', 'atlas-schema-redshift')
|
||||||
|
--- vim.treesitter.language.register('hcl', 'atlas-test')
|
||||||
|
--- vim.treesitter.language.register('hcl', 'atlas-plan')
|
||||||
|
--- vim.treesitter.language.register('hcl', 'atlas-rule')
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'atlas', 'tool', 'lsp', '--stdio' },
|
||||||
|
filetypes = {
|
||||||
|
'atlas-*',
|
||||||
|
},
|
||||||
|
root_markers = { 'atlas.hcl' },
|
||||||
|
}
|
||||||
14
.config/nvim/lsp/atopile.lua
Normal file
14
.config/nvim/lsp/atopile.lua
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://atopile.io/
|
||||||
|
---
|
||||||
|
--- A language server for atopile Programming Language.
|
||||||
|
---
|
||||||
|
--- It comes with the atopile compiler, for installation see: [Installing atopile](https://docs.atopile.io/atopile/guides/install)
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'ato', 'lsp', 'start' },
|
||||||
|
filetypes = { 'ato' },
|
||||||
|
root_markers = { 'ato.yaml', '.ato', '.git' },
|
||||||
|
}
|
||||||
52
.config/nvim/lsp/autohotkey_lsp.lua
Normal file
52
.config/nvim/lsp/autohotkey_lsp.lua
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/thqby/vscode-autohotkey2-lsp
|
||||||
|
---
|
||||||
|
--- AutoHotkey v2.0 LSP implementation
|
||||||
|
---
|
||||||
|
--- NOTE: AutoHotkey is Windows-only.
|
||||||
|
|
||||||
|
local function get_autohotkey_path()
|
||||||
|
local path = vim.fn.exepath('autohotkey.exe')
|
||||||
|
return #path > 0 and path or ''
|
||||||
|
end
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'autohotkey_lsp', '--stdio' },
|
||||||
|
filetypes = { 'autohotkey' },
|
||||||
|
root_markers = { 'package.json' },
|
||||||
|
---@diagnostic disable-next-line: missing-fields
|
||||||
|
flags = { debounce_text_changes = 500 },
|
||||||
|
--capabilities = capabilities,
|
||||||
|
--on_attach = custom_attach,
|
||||||
|
init_options = {
|
||||||
|
locale = 'en-us',
|
||||||
|
InterpreterPath = get_autohotkey_path(),
|
||||||
|
AutoLibInclude = 'All',
|
||||||
|
CommentTags = '^;;\\s*(?<tag>.+)',
|
||||||
|
CompleteFunctionParens = false,
|
||||||
|
SymbolFoldinFromOpenBrace = false,
|
||||||
|
Diagnostics = {
|
||||||
|
ClassStaticMemberCheck = true,
|
||||||
|
ParamsCheck = true,
|
||||||
|
},
|
||||||
|
ActionWhenV1IsDetected = 'Continue',
|
||||||
|
FormatOptions = {
|
||||||
|
array_style = 'expand',
|
||||||
|
break_chained_methods = false,
|
||||||
|
ignore_comment = false,
|
||||||
|
indent_string = '\t',
|
||||||
|
max_preserve_newlines = 2,
|
||||||
|
brace_style = 'One True Brace',
|
||||||
|
object_style = 'none',
|
||||||
|
preserve_newlines = true,
|
||||||
|
space_after_double_colon = true,
|
||||||
|
space_before_conditional = true,
|
||||||
|
space_in_empty_paren = false,
|
||||||
|
space_in_other = true,
|
||||||
|
space_in_paren = false,
|
||||||
|
wrap_line_length = 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
24
.config/nvim/lsp/autotools_ls.lua
Normal file
24
.config/nvim/lsp/autotools_ls.lua
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- 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.
|
||||||
|
|
||||||
|
local util = require 'lspconfig.util'
|
||||||
|
|
||||||
|
local root_files = { 'configure.ac', 'Makefile', 'Makefile.am', '*.mk' }
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'autotools-language-server' },
|
||||||
|
filetypes = { 'config', 'automake', 'make' },
|
||||||
|
root_dir = function(bufnr, on_dir)
|
||||||
|
local fname = vim.api.nvim_buf_get_name(bufnr)
|
||||||
|
on_dir(util.root_pattern(unpack(root_files))(fname))
|
||||||
|
end,
|
||||||
|
}
|
||||||
14
.config/nvim/lsp/awk_ls.lua
Normal file
14
.config/nvim/lsp/awk_ls.lua
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/Beaglefoot/awk-language-server/
|
||||||
|
---
|
||||||
|
--- `awk-language-server` can be installed via `npm`:
|
||||||
|
--- ```sh
|
||||||
|
--- npm install -g awk-language-server
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'awk-language-server' },
|
||||||
|
filetypes = { 'awk' },
|
||||||
|
}
|
||||||
39
.config/nvim/lsp/azure_pipelines_ls.lua
Normal file
39
.config/nvim/lsp/azure_pipelines_ls.lua
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/microsoft/azure-pipelines-language-server
|
||||||
|
---
|
||||||
|
--- An Azure Pipelines language server
|
||||||
|
---
|
||||||
|
--- `azure-pipelines-ls` can be installed via `npm`:
|
||||||
|
---
|
||||||
|
--- ```sh
|
||||||
|
--- npm install -g azure-pipelines-language-server
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- By default `azure-pipelines-ls` will only work in files named `azure-pipelines.yml`, this can be changed by providing additional settings like so:
|
||||||
|
--- ```lua
|
||||||
|
--- vim.lsp.config('azure_pipelines_ls', {
|
||||||
|
--- ... -- other configuration
|
||||||
|
--- settings = {
|
||||||
|
--- yaml = {
|
||||||
|
--- schemas = {
|
||||||
|
--- ["https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/master/service-schema.json"] = {
|
||||||
|
--- "/azure-pipeline*.y*l",
|
||||||
|
--- "/*.azure*",
|
||||||
|
--- "Azure-Pipelines/**/*.y*l",
|
||||||
|
--- "Pipelines/*.y*l",
|
||||||
|
--- },
|
||||||
|
--- },
|
||||||
|
--- },
|
||||||
|
--- },
|
||||||
|
--- })
|
||||||
|
--- ```
|
||||||
|
--- The Azure Pipelines LSP is a fork of `yaml-language-server` and as such the same settings can be passed to it as `yaml-language-server`.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'azure-pipelines-language-server', '--stdio' },
|
||||||
|
filetypes = { 'yaml' },
|
||||||
|
root_markers = { 'azure-pipelines.yml' },
|
||||||
|
settings = {},
|
||||||
|
}
|
||||||
47
.config/nvim/lsp/bacon_ls.lua
Normal file
47
.config/nvim/lsp/bacon_ls.lua
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- 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
|
||||||
|
---
|
||||||
|
--- ```sh
|
||||||
|
--- $ cargo install --locked bacon bacon-ls
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- Settings can be changed using the `init_options` dictionary:util
|
||||||
|
---
|
||||||
|
--- ```lua
|
||||||
|
--- init_options = {
|
||||||
|
--- -- Bacon export filename (default: .bacon-locations).
|
||||||
|
--- locationsFile = ".bacon-locations",
|
||||||
|
--- -- Try to update diagnostics every time the file is saved (default: true).
|
||||||
|
--- updateOnSave = true,
|
||||||
|
--- -- How many milliseconds to wait before updating diagnostics after a save (default: 1000).
|
||||||
|
--- updateOnSaveWaitMillis = 1000,
|
||||||
|
--- -- Try to update diagnostics every time the file changes (default: true).
|
||||||
|
--- updateOnChange = true,
|
||||||
|
--- -- Try to validate that bacon preferences are setup correctly to work with bacon-ls (default: true).
|
||||||
|
--- validateBaconPreferences = true,
|
||||||
|
--- -- f no bacon preferences file is found, create a new preferences file with the bacon-ls job definition (default: true).
|
||||||
|
--- createBaconPreferencesFile = true,
|
||||||
|
--- -- Run bacon in background for the bacon-ls job (default: true)
|
||||||
|
--- runBaconInBackground = true,
|
||||||
|
--- -- Command line arguments to pass to bacon running in background (default "--headless -j bacon-ls")
|
||||||
|
--- runBaconInBackgroundCommandArguments = "--headless -j bacon-ls",
|
||||||
|
--- -- How many milliseconds to wait between background diagnostics check to synchronize all open files (default: 2000).
|
||||||
|
--- synchronizeAllOpenFilesWaitMillis = 2000,
|
||||||
|
--- }
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'bacon-ls' },
|
||||||
|
filetypes = { 'rust' },
|
||||||
|
root_markers = { '.bacon-locations', 'Cargo.toml' },
|
||||||
|
init_options = {},
|
||||||
|
}
|
||||||
13
.config/nvim/lsp/ballerina.lua
Normal file
13
.config/nvim/lsp/ballerina.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- Ballerina language server
|
||||||
|
---
|
||||||
|
--- The Ballerina language's CLI tool comes with its own language server implementation.
|
||||||
|
--- The `bal` command line tool must be installed and available in your system's PATH.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'bal', 'start-language-server' },
|
||||||
|
filetypes = { 'ballerina' },
|
||||||
|
root_markers = { 'Ballerina.toml' },
|
||||||
|
}
|
||||||
68
.config/nvim/lsp/basedpyright.lua
Normal file
68
.config/nvim/lsp/basedpyright.lua
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://detachhead.github.io/basedpyright
|
||||||
|
---
|
||||||
|
--- `basedpyright`, a static type checker and language server for python
|
||||||
|
|
||||||
|
local function set_python_path(command)
|
||||||
|
local path = command.args
|
||||||
|
local clients = vim.lsp.get_clients {
|
||||||
|
bufnr = vim.api.nvim_get_current_buf(),
|
||||||
|
name = 'basedpyright',
|
||||||
|
}
|
||||||
|
for _, client in ipairs(clients) do
|
||||||
|
if client.settings then
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
|
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
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'basedpyright-langserver', '--stdio' },
|
||||||
|
filetypes = { 'python' },
|
||||||
|
root_markers = {
|
||||||
|
'pyrightconfig.json',
|
||||||
|
'pyproject.toml',
|
||||||
|
'setup.py',
|
||||||
|
'setup.cfg',
|
||||||
|
'requirements.txt',
|
||||||
|
'Pipfile',
|
||||||
|
'.git',
|
||||||
|
},
|
||||||
|
settings = {
|
||||||
|
basedpyright = {
|
||||||
|
analysis = {
|
||||||
|
autoSearchPaths = true,
|
||||||
|
useLibraryCodeForTypes = true,
|
||||||
|
diagnosticMode = 'openFilesOnly',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightOrganizeImports', function()
|
||||||
|
local params = {
|
||||||
|
command = 'basedpyright.organizeimports',
|
||||||
|
arguments = { vim.uri_from_bufnr(bufnr) },
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Using client.request() directly because "basedpyright.organizeimports" is private
|
||||||
|
-- (not advertised via capabilities), which client:exec_cmd() refuses to call.
|
||||||
|
-- https://github.com/neovim/neovim/blob/c333d64663d3b6e0dd9aa440e433d346af4a3d81/runtime/lua/vim/lsp/client.lua#L1024-L1030
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
|
client.request('workspace/executeCommand', params, nil, bufnr)
|
||||||
|
end, {
|
||||||
|
desc = 'Organize Imports',
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightSetPythonPath', set_python_path, {
|
||||||
|
desc = 'Reconfigure basedpyright with the provided python path',
|
||||||
|
nargs = 1,
|
||||||
|
complete = 'file',
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
29
.config/nvim/lsp/bashls.lua
Normal file
29
.config/nvim/lsp/bashls.lua
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/bash-lsp/bash-language-server
|
||||||
|
---
|
||||||
|
--- `bash-language-server` can be installed via `npm`:
|
||||||
|
--- ```sh
|
||||||
|
--- npm i -g bash-language-server
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- Language server for bash, written using tree sitter in typescript.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'bash-language-server', 'start' },
|
||||||
|
settings = {
|
||||||
|
bashIde = {
|
||||||
|
-- Glob pattern for finding and parsing shell script files in the workspace.
|
||||||
|
-- Used by the background analysis features across files.
|
||||||
|
|
||||||
|
-- Prevent recursive scanning which will cause issues when opening a file
|
||||||
|
-- directly in the home directory (e.g. ~/foo.sh).
|
||||||
|
--
|
||||||
|
-- Default upstream pattern is "**/*@(.sh|.inc|.bash|.command)".
|
||||||
|
globPattern = vim.env.GLOB_PATTERN or '*@(.sh|.inc|.bash|.command)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
filetypes = { 'bash', 'sh' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
27
.config/nvim/lsp/basics_ls.lua
Normal file
27
.config/nvim/lsp/basics_ls.lua
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/antonk52/basics-language-server/
|
||||||
|
---
|
||||||
|
--- Buffer, path, and snippet completion
|
||||||
|
---
|
||||||
|
--- ```sh
|
||||||
|
--- npm install -g basics-language-server
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'basics-language-server' },
|
||||||
|
settings = {
|
||||||
|
buffer = {
|
||||||
|
enable = true,
|
||||||
|
minCompletionLength = 4,
|
||||||
|
},
|
||||||
|
path = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
snippet = {
|
||||||
|
enable = false,
|
||||||
|
sources = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
22
.config/nvim/lsp/bazelrc_lsp.lua
Normal file
22
.config/nvim/lsp/bazelrc_lsp.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/salesforce-misc/bazelrc-lsp
|
||||||
|
---
|
||||||
|
--- `bazelrc-lsp` is a LSP for `.bazelrc` configuration files.
|
||||||
|
---
|
||||||
|
--- The `.bazelrc` file type is not detected automatically, you can register it manually (see below) or override the filetypes:
|
||||||
|
---
|
||||||
|
--- ```lua
|
||||||
|
--- vim.filetype.add {
|
||||||
|
--- pattern = {
|
||||||
|
--- ['.*.bazelrc'] = 'bazelrc',
|
||||||
|
--- },
|
||||||
|
--- }
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'bazelrc-lsp', 'lsp' },
|
||||||
|
filetypes = { 'bazelrc' },
|
||||||
|
root_markers = { 'WORKSPACE', 'WORKSPACE.bazel', 'MODULE.bazel' },
|
||||||
|
}
|
||||||
13
.config/nvim/lsp/beancount.lua
Normal file
13
.config/nvim/lsp/beancount.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/polarmutex/beancount-language-server#installation
|
||||||
|
---
|
||||||
|
--- See https://github.com/polarmutex/beancount-language-server#configuration for configuration options
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'beancount-language-server', '--stdio' },
|
||||||
|
filetypes = { 'beancount', 'bean' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
init_options = {},
|
||||||
|
}
|
||||||
40
.config/nvim/lsp/bicep.lua
Normal file
40
.config/nvim/lsp/bicep.lua
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/azure/bicep
|
||||||
|
--- Bicep language server
|
||||||
|
---
|
||||||
|
--- Bicep language server can be installed by downloading and extracting a release of bicep-langserver.zip from [Bicep GitHub releases](https://github.com/Azure/bicep/releases).
|
||||||
|
---
|
||||||
|
--- Bicep language server requires the [dotnet-sdk](https://dotnet.microsoft.com/download) to be installed.
|
||||||
|
---
|
||||||
|
--- Neovim does not have built-in support for the bicep filetype which is required for lspconfig to automatically launch the language server.
|
||||||
|
---
|
||||||
|
--- Filetype detection can be added via an autocmd:
|
||||||
|
--- ```lua
|
||||||
|
--- vim.cmd [[ autocmd BufNewFile,BufRead *.bicep set filetype=bicep ]]
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- **By default, bicep language server does not have a `cmd` set.** This is because nvim-lspconfig does not make assumptions about your path. You must add the following to your init.vim or init.lua to set `cmd` to the absolute path ($HOME and ~ are not expanded) of the unzipped run script or binary.
|
||||||
|
---
|
||||||
|
--- ```lua
|
||||||
|
--- local bicep_lsp_bin = "/path/to/bicep-langserver/Bicep.LangServer.dll"
|
||||||
|
--- vim.lsp.config('bicep', {
|
||||||
|
--- cmd = { "dotnet", bicep_lsp_bin };
|
||||||
|
--- ...
|
||||||
|
--- })
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- To download the latest release and place in /usr/local/bin/bicep-langserver:
|
||||||
|
--- ```bash
|
||||||
|
--- (cd $(mktemp -d) \
|
||||||
|
--- && curl -fLO https://github.com/Azure/bicep/releases/latest/download/bicep-langserver.zip \
|
||||||
|
--- && rm -rf /usr/local/bin/bicep-langserver \
|
||||||
|
--- && unzip -d /usr/local/bin/bicep-langserver bicep-langserver.zip)
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
filetypes = { 'bicep', 'bicep-params' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
init_options = {},
|
||||||
|
}
|
||||||
78
.config/nvim/lsp/biome.lua
Normal file
78
.config/nvim/lsp/biome.lua
Normal file
|
|
@ -0,0 +1,78 @@
|
||||||
|
---@brief
|
||||||
|
--- https://biomejs.dev
|
||||||
|
---
|
||||||
|
--- Toolchain of the web. [Successor of Rome](https://biomejs.dev/blog/annoucing-biome).
|
||||||
|
---
|
||||||
|
--- ```sh
|
||||||
|
--- npm install [-g] @biomejs/biome
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- ### Monorepo support
|
||||||
|
---
|
||||||
|
--- `biome` supports monorepos by default. It will automatically find the `biome.json` corresponding to the package you are working on, as described in the [documentation](https://biomejs.dev/guides/big-projects/#monorepo). This works without the need of spawning multiple instances of `biome`, saving memory.
|
||||||
|
|
||||||
|
local util = require 'lspconfig.util'
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = function(dispatchers, config)
|
||||||
|
local cmd = 'biome'
|
||||||
|
local local_cmd = (config or {}).root_dir and config.root_dir .. '/node_modules/.bin/biome'
|
||||||
|
if local_cmd and vim.fn.executable(local_cmd) == 1 then
|
||||||
|
cmd = local_cmd
|
||||||
|
end
|
||||||
|
return vim.lsp.rpc.start({ cmd, 'lsp-proxy' }, dispatchers)
|
||||||
|
end,
|
||||||
|
filetypes = {
|
||||||
|
'astro',
|
||||||
|
'css',
|
||||||
|
'graphql',
|
||||||
|
'html',
|
||||||
|
'javascript',
|
||||||
|
'javascriptreact',
|
||||||
|
'json',
|
||||||
|
'jsonc',
|
||||||
|
'svelte',
|
||||||
|
'typescript',
|
||||||
|
'typescript.tsx',
|
||||||
|
'typescriptreact',
|
||||||
|
'vue',
|
||||||
|
},
|
||||||
|
workspace_required = true,
|
||||||
|
root_dir = function(bufnr, on_dir)
|
||||||
|
-- The project root is where the LSP can be started from
|
||||||
|
-- As stated in the documentation above, this LSP supports monorepos and simple projects.
|
||||||
|
-- We select then from the project root, which is identified by the presence of a package
|
||||||
|
-- manager lock file.
|
||||||
|
local root_markers = { 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock' }
|
||||||
|
-- Give the root markers equal priority by wrapping them in a table
|
||||||
|
root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } }
|
||||||
|
or vim.list_extend(root_markers, { '.git' })
|
||||||
|
|
||||||
|
-- exclude deno
|
||||||
|
if vim.fs.root(bufnr, { 'deno.json', 'deno.jsonc', 'deno.lock' }) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- We fallback to the current working directory if no project root is found
|
||||||
|
local project_root = vim.fs.root(bufnr, root_markers) or vim.fn.getcwd()
|
||||||
|
|
||||||
|
-- We know that the buffer is using Biome if it has a config file
|
||||||
|
-- in its directory tree.
|
||||||
|
local filename = vim.api.nvim_buf_get_name(bufnr)
|
||||||
|
local biome_config_files = { 'biome.json', 'biome.jsonc' }
|
||||||
|
biome_config_files = util.insert_package_json(biome_config_files, 'biomejs', filename)
|
||||||
|
local is_buffer_using_biome = vim.fs.find(biome_config_files, {
|
||||||
|
path = filename,
|
||||||
|
type = 'file',
|
||||||
|
limit = 1,
|
||||||
|
upward = true,
|
||||||
|
stop = vim.fs.dirname(project_root),
|
||||||
|
})[1]
|
||||||
|
if not is_buffer_using_biome then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
on_dir(project_root)
|
||||||
|
end,
|
||||||
|
}
|
||||||
17
.config/nvim/lsp/bitbake_language_server.lua
Normal file
17
.config/nvim/lsp/bitbake_language_server.lua
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/Freed-Wu/bitbake-language-server
|
||||||
|
---
|
||||||
|
--- `bitbake-language-server` can be installed via `pip`:
|
||||||
|
--- ```sh
|
||||||
|
--- pip install bitbake-language-server
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- Language server for bitbake.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'bitbake-language-server' },
|
||||||
|
filetypes = { 'bitbake' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
22
.config/nvim/lsp/blueprint_ls.lua
Normal file
22
.config/nvim/lsp/blueprint_ls.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://gitlab.gnome.org/jwestman/blueprint-compiler
|
||||||
|
---
|
||||||
|
--- `blueprint-compiler` can be installed via your system package manager.
|
||||||
|
---
|
||||||
|
--- Language server for the blueprint markup language, written in python and part
|
||||||
|
--- of the blueprint-compiler.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'blueprint-compiler', 'lsp' },
|
||||||
|
cmd_env = {
|
||||||
|
-- Prevent recursive scanning which will cause issues when opening a file
|
||||||
|
-- directly in the home directory (e.g. ~/foo.sh).
|
||||||
|
--
|
||||||
|
-- Default upstream pattern is "**/*@(.sh|.inc|.bash|.command)".
|
||||||
|
GLOB_PATTERN = vim.env.GLOB_PATTERN or '*@(.blp)',
|
||||||
|
},
|
||||||
|
filetypes = { 'blueprint' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
17
.config/nvim/lsp/bqls.lua
Normal file
17
.config/nvim/lsp/bqls.lua
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/kitagry/bqls
|
||||||
|
---
|
||||||
|
--- The `bqls` BigQuery language server can be installed by running:
|
||||||
|
---
|
||||||
|
--- ```sh
|
||||||
|
--- $ go install github.com/kitagry/bqls@latest
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'bqls' },
|
||||||
|
filetypes = { 'sql' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
settings = {},
|
||||||
|
}
|
||||||
15
.config/nvim/lsp/bright_script.lua
Normal file
15
.config/nvim/lsp/bright_script.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/RokuCommunity/brighterscript
|
||||||
|
---
|
||||||
|
--- `brightscript` can be installed via `npm`:
|
||||||
|
--- ```sh
|
||||||
|
--- npm install -g brighterscript
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'bsc', '--lsp', '--stdio' },
|
||||||
|
filetypes = { 'brs' },
|
||||||
|
root_markers = { 'makefile', 'Makefile', '.git' },
|
||||||
|
}
|
||||||
12
.config/nvim/lsp/brioche.lua
Normal file
12
.config/nvim/lsp/brioche.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/brioche-dev/brioche
|
||||||
|
---
|
||||||
|
--- `Brioche Language Server`.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'brioche', 'lsp' },
|
||||||
|
filetypes = { 'brioche' },
|
||||||
|
root_markers = { 'project.bri' },
|
||||||
|
}
|
||||||
11
.config/nvim/lsp/bsl_ls.lua
Normal file
11
.config/nvim/lsp/bsl_ls.lua
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/1c-syntax/bsl-language-server
|
||||||
|
---
|
||||||
|
--- Language Server Protocol implementation for 1C (BSL) - 1C:Enterprise 8 and OneScript languages.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
filetypes = { 'bsl', 'os' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
18
.config/nvim/lsp/buck2.lua
Normal file
18
.config/nvim/lsp/buck2.lua
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/facebook/buck2
|
||||||
|
---
|
||||||
|
--- Build system, successor to Buck
|
||||||
|
---
|
||||||
|
--- To better detect Buck2 project files, the following can be added:
|
||||||
|
---
|
||||||
|
--- ```
|
||||||
|
--- vim.cmd [[ autocmd BufRead,BufNewFile *.bxl,BUCK,TARGETS set filetype=bzl ]]
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'buck2', 'lsp' },
|
||||||
|
filetypes = { 'bzl' },
|
||||||
|
root_markers = { '.buckconfig' },
|
||||||
|
}
|
||||||
13
.config/nvim/lsp/buddy_ls.lua
Normal file
13
.config/nvim/lsp/buddy_ls.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/buddy-compiler/buddy-mlir#buddy-lsp-server
|
||||||
|
--- The Language Server for the buddy-mlir, a drop-in replacement for mlir-lsp-server,
|
||||||
|
--- supporting new dialects defined in buddy-mlir.
|
||||||
|
--- `buddy-lsp-server` can be installed at the buddy-mlir repository (buddy-compiler/buddy-mlir)
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'buddy-lsp-server' },
|
||||||
|
filetypes = { 'mlir' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
17
.config/nvim/lsp/buf_ls.lua
Normal file
17
.config/nvim/lsp/buf_ls.lua
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
--- @brief
|
||||||
|
--- https://github.com/bufbuild/buf
|
||||||
|
---
|
||||||
|
--- buf lsp included in the cli itself
|
||||||
|
---
|
||||||
|
--- buf lsp is a Protobuf language server compatible with Buf modules and workspaces
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'buf', 'lsp', 'serve', '--log-format=text' },
|
||||||
|
filetypes = { 'proto' },
|
||||||
|
root_markers = { 'buf.yaml', '.git' },
|
||||||
|
reuse_client = function(client, config)
|
||||||
|
-- `buf lsp serve` is meant to be used with multiple workspaces.
|
||||||
|
return client.name == config.name
|
||||||
|
end,
|
||||||
|
}
|
||||||
15
.config/nvim/lsp/bzl.lua
Normal file
15
.config/nvim/lsp/bzl.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://bzl.io/
|
||||||
|
---
|
||||||
|
--- https://docs.stack.build/docs/cli/installation
|
||||||
|
---
|
||||||
|
--- https://docs.stack.build/docs/vscode/starlark-language-server
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'bzl', 'lsp', 'serve' },
|
||||||
|
filetypes = { 'bzl' },
|
||||||
|
-- https://docs.bazel.build/versions/5.4.1/build-ref.html#workspace
|
||||||
|
root_markers = { 'WORKSPACE', 'WORKSPACE.bazel' },
|
||||||
|
}
|
||||||
12
.config/nvim/lsp/c3_lsp.lua
Normal file
12
.config/nvim/lsp/c3_lsp.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/pherrymason/c3-lsp
|
||||||
|
---
|
||||||
|
--- Language Server for c3.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'c3lsp' },
|
||||||
|
root_markers = { 'project.json', 'manifest.json', '.git' },
|
||||||
|
filetypes = { 'c3', 'c3i' },
|
||||||
|
}
|
||||||
20
.config/nvim/lsp/cairo_ls.lua
Normal file
20
.config/nvim/lsp/cairo_ls.lua
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- [Cairo Language Server](https://github.com/starkware-libs/cairo/tree/main/crates/cairo-lang-language-server)
|
||||||
|
---
|
||||||
|
--- First, install Cairo following [this tutorial](https://book.cairo-lang.org/ch01-01-installation.html)
|
||||||
|
---
|
||||||
|
--- Then enable Cairo Language Server in your Lua configuration.
|
||||||
|
--- ```lua
|
||||||
|
--- vim.lsp.enable('cairo_ls')
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- *cairo-language-server is still under active development, some features might not work yet !*
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
init_options = { hostInfo = 'neovim' },
|
||||||
|
cmd = { 'scarb', 'cairo-language-server', '/C', '--node-ipc' },
|
||||||
|
filetypes = { 'cairo' },
|
||||||
|
root_markers = { 'Scarb.toml', 'cairo_project.toml', '.git' },
|
||||||
|
}
|
||||||
53
.config/nvim/lsp/ccls.lua
Normal file
53
.config/nvim/lsp/ccls.lua
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/MaskRay/ccls/wiki
|
||||||
|
---
|
||||||
|
--- ccls relies on a [JSON compilation database](https://clang.llvm.org/docs/JSONCompilationDatabase.html) specified
|
||||||
|
--- as compile_commands.json or, for simpler projects, a .ccls.
|
||||||
|
--- For details on how to automatically generate one using CMake look [here](https://cmake.org/cmake/help/latest/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html). Alternatively, you can use [Bear](https://github.com/rizsotto/Bear).
|
||||||
|
---
|
||||||
|
--- Customization options are passed to ccls at initialization time via init_options, a list of available options can be found [here](https://github.com/MaskRay/ccls/wiki/Customization#initialization-options). For example:
|
||||||
|
---
|
||||||
|
--- ```lua
|
||||||
|
--- vim.lsp.config("ccls", {
|
||||||
|
--- init_options = {
|
||||||
|
--- compilationDatabaseDirectory = "build";
|
||||||
|
--- index = {
|
||||||
|
--- threads = 0;
|
||||||
|
--- };
|
||||||
|
--- clang = {
|
||||||
|
--- excludeArgs = { "-frounding-math"} ;
|
||||||
|
--- };
|
||||||
|
--- }
|
||||||
|
--- })
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
local function switch_source_header(client, bufnr)
|
||||||
|
local method_name = 'textDocument/switchSourceHeader'
|
||||||
|
local params = vim.lsp.util.make_text_document_params(bufnr)
|
||||||
|
client:request(method_name, params, function(err, result)
|
||||||
|
if err then
|
||||||
|
error(tostring(err))
|
||||||
|
end
|
||||||
|
if not result then
|
||||||
|
vim.notify('corresponding file cannot be determined')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
vim.cmd.edit(vim.uri_to_fname(result))
|
||||||
|
end, bufnr)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'ccls' },
|
||||||
|
filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' },
|
||||||
|
root_markers = { 'compile_commands.json', '.ccls', '.git' },
|
||||||
|
offset_encoding = 'utf-32',
|
||||||
|
-- ccls does not support sending a null root directory
|
||||||
|
workspace_required = true,
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
vim.api.nvim_buf_create_user_command(bufnr, 'LspCclsSwitchSourceHeader', function()
|
||||||
|
switch_source_header(client, bufnr)
|
||||||
|
end, { desc = 'Switch between source/header' })
|
||||||
|
end,
|
||||||
|
}
|
||||||
20
.config/nvim/lsp/cds_lsp.lua
Normal file
20
.config/nvim/lsp/cds_lsp.lua
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://cap.cloud.sap/docs/
|
||||||
|
---
|
||||||
|
--- `cds-lsp` can be installed via `npm`:
|
||||||
|
---
|
||||||
|
--- ```sh
|
||||||
|
--- npm i -g @sap/cds-lsp
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'cds-lsp', '--stdio' },
|
||||||
|
filetypes = { 'cds' },
|
||||||
|
-- init_options = { provideFormatter = true }, -- needed to enable formatting capabilities
|
||||||
|
root_markers = { 'package.json', 'db', 'srv' },
|
||||||
|
settings = {
|
||||||
|
cds = { validate = true },
|
||||||
|
},
|
||||||
|
}
|
||||||
14
.config/nvim/lsp/cir_lsp_server.lua
Normal file
14
.config/nvim/lsp/cir_lsp_server.lua
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://llvm.github.io/clangir
|
||||||
|
---
|
||||||
|
--- The Language Server for the LLVM ClangIR language
|
||||||
|
---
|
||||||
|
--- `cir-lsp-server` can be installed at the llvm-project repository (https://github.com/llvm/llvm-project)
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'cir-lsp-server' },
|
||||||
|
filetypes = { 'cir' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
12
.config/nvim/lsp/circom-lsp.lua
Normal file
12
.config/nvim/lsp/circom-lsp.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- [Circom Language Server](https://github.com/rubydusa/circom-lsp)
|
||||||
|
---
|
||||||
|
--- `circom-lsp`, the language server for the Circom language.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'circom-lsp' },
|
||||||
|
filetypes = { 'circom' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
100
.config/nvim/lsp/clangd.lua
Normal file
100
.config/nvim/lsp/clangd.lua
Normal file
|
|
@ -0,0 +1,100 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://clangd.llvm.org/installation.html
|
||||||
|
---
|
||||||
|
--- - **NOTE:** Clang >= 11 is recommended! See [#23](https://github.com/neovim/nvim-lspconfig/issues/23).
|
||||||
|
--- - If `compile_commands.json` lives in a build directory, you should
|
||||||
|
--- symlink it to the root of your source tree.
|
||||||
|
--- ```
|
||||||
|
--- ln -s /path/to/myproject/build/compile_commands.json /path/to/myproject/
|
||||||
|
--- ```
|
||||||
|
--- - clangd relies on a [JSON compilation database](https://clang.llvm.org/docs/JSONCompilationDatabase.html)
|
||||||
|
--- specified as compile_commands.json, see https://clangd.llvm.org/installation#compile_commandsjson
|
||||||
|
|
||||||
|
-- https://clangd.llvm.org/extensions.html#switch-between-sourceheader
|
||||||
|
local function switch_source_header(bufnr, client)
|
||||||
|
local method_name = 'textDocument/switchSourceHeader'
|
||||||
|
---@diagnostic disable-next-line:param-type-mismatch
|
||||||
|
if not client or not client:supports_method(method_name) then
|
||||||
|
return vim.notify(('method %s is not supported by any servers active on the current buffer'):format(method_name))
|
||||||
|
end
|
||||||
|
local params = vim.lsp.util.make_text_document_params(bufnr)
|
||||||
|
---@diagnostic disable-next-line:param-type-mismatch
|
||||||
|
client:request(method_name, params, function(err, result)
|
||||||
|
if err then
|
||||||
|
error(tostring(err))
|
||||||
|
end
|
||||||
|
if not result then
|
||||||
|
vim.notify('corresponding file cannot be determined')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
vim.cmd.edit(vim.uri_to_fname(result))
|
||||||
|
end, bufnr)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function symbol_info(bufnr, client)
|
||||||
|
local method_name = 'textDocument/symbolInfo'
|
||||||
|
---@diagnostic disable-next-line:param-type-mismatch
|
||||||
|
if not client or not client:supports_method(method_name) then
|
||||||
|
return vim.notify('Clangd client not found', vim.log.levels.ERROR)
|
||||||
|
end
|
||||||
|
local win = vim.api.nvim_get_current_win()
|
||||||
|
local params = vim.lsp.util.make_position_params(win, client.offset_encoding)
|
||||||
|
---@diagnostic disable-next-line:param-type-mismatch
|
||||||
|
client:request(method_name, params, function(err, res)
|
||||||
|
if err or #res == 0 then
|
||||||
|
-- Clangd always returns an error, there is no reason to parse it
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local container = string.format('container: %s', res[1].containerName) ---@type string
|
||||||
|
local name = string.format('name: %s', res[1].name) ---@type string
|
||||||
|
vim.lsp.util.open_floating_preview({ name, container }, '', {
|
||||||
|
height = 2,
|
||||||
|
width = math.max(string.len(name), string.len(container)),
|
||||||
|
focusable = false,
|
||||||
|
focus = false,
|
||||||
|
title = 'Symbol Info',
|
||||||
|
})
|
||||||
|
end, bufnr)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@class ClangdInitializeResult: lsp.InitializeResult
|
||||||
|
---@field offsetEncoding? string
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'clangd' },
|
||||||
|
filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' },
|
||||||
|
root_markers = {
|
||||||
|
'.clangd',
|
||||||
|
'.clang-tidy',
|
||||||
|
'.clang-format',
|
||||||
|
'compile_commands.json',
|
||||||
|
'compile_flags.txt',
|
||||||
|
'configure.ac', -- AutoTools
|
||||||
|
'.git',
|
||||||
|
},
|
||||||
|
capabilities = {
|
||||||
|
textDocument = {
|
||||||
|
completion = {
|
||||||
|
editsNearCursor = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
offsetEncoding = { 'utf-8', 'utf-16' },
|
||||||
|
},
|
||||||
|
---@param init_result ClangdInitializeResult
|
||||||
|
on_init = function(client, init_result)
|
||||||
|
if init_result.offsetEncoding then
|
||||||
|
client.offset_encoding = init_result.offsetEncoding
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
vim.api.nvim_buf_create_user_command(bufnr, 'LspClangdSwitchSourceHeader', function()
|
||||||
|
switch_source_header(bufnr, client)
|
||||||
|
end, { desc = 'Switch between source/header' })
|
||||||
|
|
||||||
|
vim.api.nvim_buf_create_user_command(bufnr, 'LspClangdShowSymbolInfo', function()
|
||||||
|
symbol_info(bufnr, client)
|
||||||
|
end, { desc = 'Show symbol info' })
|
||||||
|
end,
|
||||||
|
}
|
||||||
11
.config/nvim/lsp/clarinet.lua
Normal file
11
.config/nvim/lsp/clarinet.lua
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
---@brief
|
||||||
|
--- https://github.com/hirosystems/clarinet
|
||||||
|
---
|
||||||
|
--- Clarinet is the fastest way to build, test, and deploy smart contracts on the Stacks blockchain.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'clarinet', 'lsp' },
|
||||||
|
filetypes = { 'clar', 'clarity' },
|
||||||
|
root_markers = { 'Clarinet.toml' },
|
||||||
|
}
|
||||||
12
.config/nvim/lsp/clojure_lsp.lua
Normal file
12
.config/nvim/lsp/clojure_lsp.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/clojure-lsp/clojure-lsp
|
||||||
|
---
|
||||||
|
--- Clojure Language Server
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'clojure-lsp' },
|
||||||
|
filetypes = { 'clojure', 'edn' },
|
||||||
|
root_markers = { 'project.clj', 'deps.edn', 'build.boot', 'shadow-cljs.edn', '.git', 'bb.edn' },
|
||||||
|
}
|
||||||
15
.config/nvim/lsp/cmake.lua
Normal file
15
.config/nvim/lsp/cmake.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/regen100/cmake-language-server
|
||||||
|
---
|
||||||
|
--- CMake LSP Implementation
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'cmake-language-server' },
|
||||||
|
filetypes = { 'cmake' },
|
||||||
|
root_markers = { 'CMakePresets.json', 'CTestConfig.cmake', '.git', 'build', 'cmake' },
|
||||||
|
init_options = {
|
||||||
|
buildDirectory = 'build',
|
||||||
|
},
|
||||||
|
}
|
||||||
10
.config/nvim/lsp/cobol_ls.lua
Normal file
10
.config/nvim/lsp/cobol_ls.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- Cobol language support
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'cobol-language-support' },
|
||||||
|
filetypes = { 'cobol' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
39
.config/nvim/lsp/codebook.lua
Normal file
39
.config/nvim/lsp/codebook.lua
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/blopker/codebook
|
||||||
|
---
|
||||||
|
--- An unholy spell checker for code.
|
||||||
|
---
|
||||||
|
--- `codebook-lsp` can be installed by following the instructions [here](https://github.com/blopker/codebook/blob/main/README.md#installation).
|
||||||
|
---
|
||||||
|
--- The default `cmd` assumes that the `codebook-lsp` binary can be found in `$PATH`.
|
||||||
|
---
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'codebook-lsp', 'serve' },
|
||||||
|
filetypes = {
|
||||||
|
'c',
|
||||||
|
'css',
|
||||||
|
'gitcommit',
|
||||||
|
'go',
|
||||||
|
'haskell',
|
||||||
|
'html',
|
||||||
|
'java',
|
||||||
|
'javascript',
|
||||||
|
'javascriptreact',
|
||||||
|
'lua',
|
||||||
|
'markdown',
|
||||||
|
'php',
|
||||||
|
'python',
|
||||||
|
'ruby',
|
||||||
|
'rust',
|
||||||
|
'swift',
|
||||||
|
'toml',
|
||||||
|
'text',
|
||||||
|
'typescript',
|
||||||
|
'typescriptreact',
|
||||||
|
'zig',
|
||||||
|
},
|
||||||
|
root_markers = { '.git', 'codebook.toml', '.codebook.toml' },
|
||||||
|
}
|
||||||
16
.config/nvim/lsp/coffeesense.lua
Normal file
16
.config/nvim/lsp/coffeesense.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/phil294/coffeesense
|
||||||
|
---
|
||||||
|
--- CoffeeSense Language Server
|
||||||
|
--- `coffeesense-language-server` can be installed via `npm`:
|
||||||
|
--- ```sh
|
||||||
|
--- npm install -g coffeesense-language-server
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'coffeesense-language-server', '--stdio' },
|
||||||
|
filetypes = { 'coffee' },
|
||||||
|
root_markers = { 'package.json' },
|
||||||
|
}
|
||||||
17
.config/nvim/lsp/contextive.lua
Normal file
17
.config/nvim/lsp/contextive.lua
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- 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.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'Contextive.LanguageServer' },
|
||||||
|
root_markers = { '.contextive', '.git' },
|
||||||
|
}
|
||||||
135
.config/nvim/lsp/copilot.lua
Normal file
135
.config/nvim/lsp/copilot.lua
Normal file
|
|
@ -0,0 +1,135 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://www.npmjs.com/package/@github/copilot-language-server
|
||||||
|
---
|
||||||
|
--- The Copilot Language Server enables any editor or IDE
|
||||||
|
--- to integrate with GitHub Copilot via
|
||||||
|
--- [the language server protocol](https://microsoft.github.io/language-server-protocol/).
|
||||||
|
---
|
||||||
|
--- **[GitHub Copilot](https://github.com/features/copilot)**
|
||||||
|
--- is an AI pair programmer tool that helps you write code faster and smarter.
|
||||||
|
---
|
||||||
|
--- **Sign up for [GitHub Copilot Free](https://github.com/settings/copilot)!**
|
||||||
|
---
|
||||||
|
--- Please see [terms of use for GitHub Copilot](https://docs.github.com/en/site-policy/github-terms/github-terms-for-additional-products-and-features#github-copilot)
|
||||||
|
---
|
||||||
|
--- You need to enable `:help lsp-inline-completion` to receive suggestions. For example, you can enable it in the LspAttach event:
|
||||||
|
---
|
||||||
|
--- ```lua
|
||||||
|
--- vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
--- callback = function(args)
|
||||||
|
--- local bufnr = args.buf
|
||||||
|
--- local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||||
|
---
|
||||||
|
--- if client:supports_method(vim.lsp.protocol.Methods.textDocument_inlineCompletion, bufnr) then
|
||||||
|
--- vim.lsp.inline_completion.enable(true, { bufnr = bufnr })
|
||||||
|
---
|
||||||
|
--- vim.keymap.set(
|
||||||
|
--- 'i',
|
||||||
|
--- '<C-F>',
|
||||||
|
--- vim.lsp.inline_completion.get,
|
||||||
|
--- { desc = 'LSP: accept inline completion', buffer = bufnr }
|
||||||
|
--- )
|
||||||
|
--- vim.keymap.set(
|
||||||
|
--- 'i',
|
||||||
|
--- '<C-G>',
|
||||||
|
--- vim.lsp.inline_completion.select,
|
||||||
|
--- { desc = 'LSP: switch inline completion', buffer = bufnr }
|
||||||
|
--- )
|
||||||
|
--- end
|
||||||
|
--- end
|
||||||
|
--- })
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@param bufnr integer,
|
||||||
|
---@param client vim.lsp.Client
|
||||||
|
local function sign_in(bufnr, client)
|
||||||
|
client:request(
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
|
'signIn',
|
||||||
|
vim.empty_dict(),
|
||||||
|
function(err, result)
|
||||||
|
if err then
|
||||||
|
vim.notify(err.message, vim.log.levels.ERROR)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if result.command then
|
||||||
|
local code = result.userCode
|
||||||
|
local command = result.command
|
||||||
|
vim.fn.setreg('+', code)
|
||||||
|
vim.fn.setreg('*', code)
|
||||||
|
local continue = vim.fn.confirm(
|
||||||
|
'Copied your one-time code to clipboard.\n' .. 'Open the browser to complete the sign-in process?',
|
||||||
|
'&Yes\n&No'
|
||||||
|
)
|
||||||
|
if continue == 1 then
|
||||||
|
client:exec_cmd(command, { bufnr = bufnr }, function(cmd_err, cmd_result)
|
||||||
|
if cmd_err then
|
||||||
|
vim.notify(cmd_err.message, vim.log.levels.ERROR)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if cmd_result.status == 'OK' then
|
||||||
|
vim.notify('Signed in as ' .. cmd_result.user .. '.')
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if result.status == 'PromptUserDeviceFlow' then
|
||||||
|
vim.notify('Enter your one-time code ' .. result.userCode .. ' in ' .. result.verificationUri)
|
||||||
|
elseif result.status == 'AlreadySignedIn' then
|
||||||
|
vim.notify('Already signed in as ' .. result.user .. '.')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param client vim.lsp.Client
|
||||||
|
local function sign_out(_, client)
|
||||||
|
client:request(
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
|
'signOut',
|
||||||
|
vim.empty_dict(),
|
||||||
|
function(err, result)
|
||||||
|
if err then
|
||||||
|
vim.notify(err.message, vim.log.levels.ERROR)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if result.status == 'NotSignedIn' then
|
||||||
|
vim.notify('Not signed in.')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = {
|
||||||
|
'copilot-language-server',
|
||||||
|
'--stdio',
|
||||||
|
},
|
||||||
|
root_markers = { '.git' },
|
||||||
|
init_options = {
|
||||||
|
editorInfo = {
|
||||||
|
name = 'Neovim',
|
||||||
|
version = tostring(vim.version()),
|
||||||
|
},
|
||||||
|
editorPluginInfo = {
|
||||||
|
name = 'Neovim',
|
||||||
|
version = tostring(vim.version()),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
settings = {
|
||||||
|
telemetry = {
|
||||||
|
telemetryLevel = 'all',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
vim.api.nvim_buf_create_user_command(bufnr, 'LspCopilotSignIn', function()
|
||||||
|
sign_in(bufnr, client)
|
||||||
|
end, { desc = 'Sign in Copilot with GitHub' })
|
||||||
|
vim.api.nvim_buf_create_user_command(bufnr, 'LspCopilotSignOut', function()
|
||||||
|
sign_out(bufnr, client)
|
||||||
|
end, { desc = 'Sign out Copilot with GitHub' })
|
||||||
|
end,
|
||||||
|
}
|
||||||
10
.config/nvim/lsp/coq_lsp.lua
Normal file
10
.config/nvim/lsp/coq_lsp.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/ejgallego/coq-lsp/
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'coq-lsp' },
|
||||||
|
filetypes = { 'coq' },
|
||||||
|
root_markers = { '_CoqProject', '.git' },
|
||||||
|
}
|
||||||
12
.config/nvim/lsp/crystalline.lua
Normal file
12
.config/nvim/lsp/crystalline.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/elbywan/crystalline
|
||||||
|
---
|
||||||
|
--- Crystal language server.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'crystalline' },
|
||||||
|
filetypes = { 'crystal' },
|
||||||
|
root_markers = { 'shard.yml', '.git' },
|
||||||
|
}
|
||||||
32
.config/nvim/lsp/csharp_ls.lua
Normal file
32
.config/nvim/lsp/csharp_ls.lua
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/razzmatazz/csharp-language-server
|
||||||
|
---
|
||||||
|
--- Language Server for C#.
|
||||||
|
---
|
||||||
|
--- csharp-ls requires the [dotnet-sdk](https://dotnet.microsoft.com/download) to be installed.
|
||||||
|
---
|
||||||
|
--- The preferred way to install csharp-ls is with `dotnet tool install --global csharp-ls`.
|
||||||
|
|
||||||
|
local util = require 'lspconfig.util'
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = function(dispatchers, config)
|
||||||
|
return vim.lsp.rpc.start({ 'csharp-ls' }, dispatchers, {
|
||||||
|
-- csharp-ls attempt to locate sln, slnx or csproj files from cwd, so set cwd to root directory.
|
||||||
|
-- If cmd_cwd is provided, use it instead.
|
||||||
|
cwd = config.cmd_cwd or config.root_dir,
|
||||||
|
env = config.cmd_env,
|
||||||
|
detached = config.detached,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
root_dir = function(bufnr, on_dir)
|
||||||
|
local fname = vim.api.nvim_buf_get_name(bufnr)
|
||||||
|
on_dir(util.root_pattern '*.sln'(fname) or util.root_pattern '*.slnx'(fname) or util.root_pattern '*.csproj'(fname))
|
||||||
|
end,
|
||||||
|
filetypes = { 'cs' },
|
||||||
|
init_options = {
|
||||||
|
AutomaticWorkspaceInit = true,
|
||||||
|
},
|
||||||
|
}
|
||||||
24
.config/nvim/lsp/cspell_ls.lua
Normal file
24
.config/nvim/lsp/cspell_ls.lua
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- [cspell language server](https://github.com/vlabo/cspell-lsp)
|
||||||
|
---
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'cspell-lsp', '--stdio' },
|
||||||
|
root_markers = {
|
||||||
|
'.git',
|
||||||
|
'cspell.json',
|
||||||
|
'.cspell.json',
|
||||||
|
'cspell.json',
|
||||||
|
'.cSpell.json',
|
||||||
|
'cSpell.json',
|
||||||
|
'cspell.config.js',
|
||||||
|
'cspell.config.cjs',
|
||||||
|
'cspell.config.json',
|
||||||
|
'cspell.config.yaml',
|
||||||
|
'cspell.config.yml',
|
||||||
|
'cspell.yaml',
|
||||||
|
'cspell.yml',
|
||||||
|
},
|
||||||
|
}
|
||||||
51
.config/nvim/lsp/css_variables.lua
Normal file
51
.config/nvim/lsp/css_variables.lua
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- 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
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'css-variables-language-server', '--stdio' },
|
||||||
|
filetypes = { 'css', 'scss', 'less' },
|
||||||
|
|
||||||
|
-- Taken from lsp/ts_ls.lua to handle simple projects and monorepos.
|
||||||
|
root_dir = function(bufnr, on_dir)
|
||||||
|
local root_markers = { 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock' }
|
||||||
|
-- Give the root markers equal priority by wrapping them in a table
|
||||||
|
root_markers = vim.fn.has 'nvim-0.11.3' == 1 and { root_markers, { '.git' } }
|
||||||
|
or vim.list_extend(root_markers, { '.git' })
|
||||||
|
-- We fallback to the current working directory if no project root is found
|
||||||
|
local project_root = vim.fs.root(bufnr, root_markers) or vim.fn.getcwd()
|
||||||
|
|
||||||
|
on_dir(project_root)
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- 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',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
34
.config/nvim/lsp/cssls.lua
Normal file
34
.config/nvim/lsp/cssls.lua
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/hrsh7th/vscode-langservers-extracted
|
||||||
|
---
|
||||||
|
--- `css-languageserver` can be installed via `npm`:
|
||||||
|
---
|
||||||
|
--- ```sh
|
||||||
|
--- npm i -g vscode-langservers-extracted
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- Neovim does not currently include built-in snippets. `vscode-css-language-server` only provides completions when snippet support is enabled. To enable completion, install a snippet plugin and add the following override to your language client capabilities during setup.
|
||||||
|
---
|
||||||
|
--- ```lua
|
||||||
|
--- --Enable (broadcasting) snippet capability for completion
|
||||||
|
--- local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
--- capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
|
---
|
||||||
|
--- vim.lsp.config('cssls', {
|
||||||
|
--- capabilities = capabilities,
|
||||||
|
--- })
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'vscode-css-language-server', '--stdio' },
|
||||||
|
filetypes = { 'css', 'scss', 'less' },
|
||||||
|
init_options = { provideFormatter = true }, -- needed to enable formatting capabilities
|
||||||
|
root_markers = { 'package.json', '.git' },
|
||||||
|
settings = {
|
||||||
|
css = { validate = true },
|
||||||
|
scss = { validate = true },
|
||||||
|
less = { validate = true },
|
||||||
|
},
|
||||||
|
}
|
||||||
17
.config/nvim/lsp/cssmodules_ls.lua
Normal file
17
.config/nvim/lsp/cssmodules_ls.lua
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/antonk52/cssmodules-language-server
|
||||||
|
---
|
||||||
|
--- Language server for autocompletion and go-to-definition functionality for CSS modules.
|
||||||
|
---
|
||||||
|
--- You can install cssmodules-language-server via npm:
|
||||||
|
--- ```sh
|
||||||
|
--- npm install -g cssmodules-language-server
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'cssmodules-language-server' },
|
||||||
|
filetypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact' },
|
||||||
|
root_markers = { 'package.json' },
|
||||||
|
}
|
||||||
19
.config/nvim/lsp/cucumber_language_server.lua
Normal file
19
.config/nvim/lsp/cucumber_language_server.lua
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://cucumber.io
|
||||||
|
--- https://github.com/cucumber/common
|
||||||
|
--- https://www.npmjs.com/package/@cucumber/language-server
|
||||||
|
---
|
||||||
|
--- Language server for Cucumber.
|
||||||
|
---
|
||||||
|
--- `cucumber-language-server` can be installed via `npm`:
|
||||||
|
--- ```sh
|
||||||
|
--- npm install -g @cucumber/language-server
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'cucumber-language-server', '--stdio' },
|
||||||
|
filetypes = { 'cucumber' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
12
.config/nvim/lsp/cue.lua
Normal file
12
.config/nvim/lsp/cue.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/cue-lang/cue
|
||||||
|
---
|
||||||
|
--- CUE makes it easy to validate data, write schemas, and ensure configurations align with policies.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'cue', 'lsp' },
|
||||||
|
filetypes = { 'cue' },
|
||||||
|
root_markers = { 'cue.mod', '.git' },
|
||||||
|
}
|
||||||
32
.config/nvim/lsp/custom_elements_ls.lua
Normal file
32
.config/nvim/lsp/custom_elements_ls.lua
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/Matsuuu/custom-elements-language-server
|
||||||
|
---
|
||||||
|
--- `custom-elements-languageserver` depends on `typescript`. Both packages can be installed via `npm`:
|
||||||
|
--- ```sh
|
||||||
|
--- npm install -g typescript custom-elements-languageserver
|
||||||
|
--- ```
|
||||||
|
--- To configure typescript language server, add a
|
||||||
|
--- [`tsconfig.json`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) or
|
||||||
|
--- [`jsconfig.json`](https://code.visualstudio.com/docs/languages/jsconfig) to the root of your
|
||||||
|
--- project.
|
||||||
|
--- Here's an example that disables type checking in JavaScript files.
|
||||||
|
--- ```json
|
||||||
|
--- {
|
||||||
|
--- "compilerOptions": {
|
||||||
|
--- "module": "commonjs",
|
||||||
|
--- "target": "es6",
|
||||||
|
--- "checkJs": false
|
||||||
|
--- },
|
||||||
|
--- "exclude": [
|
||||||
|
--- "node_modules"
|
||||||
|
--- ]
|
||||||
|
--- }
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
init_options = { hostInfo = 'neovim' },
|
||||||
|
cmd = { 'custom-elements-languageserver', '--stdio' },
|
||||||
|
root_markers = { 'tsconfig.json', 'package.json', 'jsconfig.json', '.git' },
|
||||||
|
}
|
||||||
18
.config/nvim/lsp/cypher_ls.lua
Normal file
18
.config/nvim/lsp/cypher_ls.lua
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- 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
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'cypher-language-server', '--stdio' },
|
||||||
|
filetypes = { 'cypher' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
27
.config/nvim/lsp/daedalus_ls.lua
Normal file
27
.config/nvim/lsp/daedalus_ls.lua
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
--- @brief
|
||||||
|
---
|
||||||
|
--- DaedalusLanguageServer
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'DaedalusLanguageServer' },
|
||||||
|
filetypes = { 'd' },
|
||||||
|
root_markers = {
|
||||||
|
'Gothic.src',
|
||||||
|
'Camera.src',
|
||||||
|
'Menu.src',
|
||||||
|
'Music.src',
|
||||||
|
'ParticleFX.src',
|
||||||
|
'SFX.src',
|
||||||
|
'VisualFX.src',
|
||||||
|
},
|
||||||
|
settings = {
|
||||||
|
DaedalusLanguageServer = {
|
||||||
|
loglevel = 'debug',
|
||||||
|
inlayHints = { constants = true },
|
||||||
|
numParserThreads = 16,
|
||||||
|
fileEncoding = 'Windows-1252',
|
||||||
|
srcFileEncoding = 'Windows-1252',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
15
.config/nvim/lsp/dafny.lua
Normal file
15
.config/nvim/lsp/dafny.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- Support for the Dafny language server.
|
||||||
|
|
||||||
|
-- The default `cmd` uses "dafny server", which works on Dafny 4.0.0+. For
|
||||||
|
-- older versions of Dafny, you can compile the language server from source at
|
||||||
|
-- [dafny-lang/language-server-csharp](https://github.com/dafny-lang/language-server-csharp)
|
||||||
|
-- and set `cmd = {"dotnet", "<Path to your language server>"}`.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'dafny', 'server' },
|
||||||
|
filetypes = { 'dfy', 'dafny' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
12
.config/nvim/lsp/dagger.lua
Normal file
12
.config/nvim/lsp/dagger.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/dagger/cuelsp
|
||||||
|
---
|
||||||
|
--- Dagger's lsp server for cuelang.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'cuelsp' },
|
||||||
|
filetypes = { 'cue' },
|
||||||
|
root_markers = { 'cue.mod', '.git' },
|
||||||
|
}
|
||||||
25
.config/nvim/lsp/dartls.lua
Normal file
25
.config/nvim/lsp/dartls.lua
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/dart-lang/sdk/tree/master/pkg/analysis_server/tool/lsp_spec
|
||||||
|
---
|
||||||
|
--- Language server for dart.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'dart', 'language-server', '--protocol=lsp' },
|
||||||
|
filetypes = { 'dart' },
|
||||||
|
root_markers = { 'pubspec.yaml' },
|
||||||
|
init_options = {
|
||||||
|
onlyAnalyzeProjectsWithOpenFiles = true,
|
||||||
|
suggestFromUnimportedLibraries = true,
|
||||||
|
closingLabels = true,
|
||||||
|
outline = true,
|
||||||
|
flutterOutline = true,
|
||||||
|
},
|
||||||
|
settings = {
|
||||||
|
dart = {
|
||||||
|
completeFunctionCalls = true,
|
||||||
|
showTodos = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
12
.config/nvim/lsp/dcmls.lua
Normal file
12
.config/nvim/lsp/dcmls.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://dcm.dev/
|
||||||
|
---
|
||||||
|
--- Language server for DCM analyzer.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'dcm', 'start-server', '--client=neovim' },
|
||||||
|
filetypes = { 'dart' },
|
||||||
|
root_markers = { 'pubspec.yaml' },
|
||||||
|
}
|
||||||
12
.config/nvim/lsp/debputy.lua
Normal file
12
.config/nvim/lsp/debputy.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://salsa.debian.org/debian/debputy
|
||||||
|
---
|
||||||
|
--- Language Server for Debian packages.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'debputy', 'lsp', 'server' },
|
||||||
|
filetypes = { 'debcontrol', 'debcopyright', 'debchangelog', 'autopkgtest', 'make', 'yaml' },
|
||||||
|
root_markers = { 'debian' },
|
||||||
|
}
|
||||||
129
.config/nvim/lsp/denols.lua
Normal file
129
.config/nvim/lsp/denols.lua
Normal file
|
|
@ -0,0 +1,129 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/denoland/deno
|
||||||
|
---
|
||||||
|
--- Deno's built-in language server
|
||||||
|
---
|
||||||
|
--- To appropriately highlight codefences returned from denols, you will need to augment vim.g.markdown_fenced languages
|
||||||
|
--- in your init.lua. Example:
|
||||||
|
---
|
||||||
|
--- ```lua
|
||||||
|
--- vim.g.markdown_fenced_languages = {
|
||||||
|
--- "ts=typescript"
|
||||||
|
--- }
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
local lsp = vim.lsp
|
||||||
|
|
||||||
|
local function virtual_text_document_handler(uri, res, client)
|
||||||
|
if not res then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local lines = vim.split(res.result, '\n')
|
||||||
|
local bufnr = vim.uri_to_bufnr(uri)
|
||||||
|
|
||||||
|
local current_buf = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
|
||||||
|
if #current_buf ~= 0 then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
|
||||||
|
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
|
||||||
|
|
||||||
|
local function virtual_text_document(uri, client)
|
||||||
|
local params = {
|
||||||
|
textDocument = {
|
||||||
|
uri = uri,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
local result = client:request_sync('deno/virtualTextDocument', params)
|
||||||
|
virtual_text_document_handler(uri, result, client)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function denols_handler(err, result, ctx, config)
|
||||||
|
if not result or vim.tbl_isempty(result) then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
||||||
|
for _, res in pairs(result) do
|
||||||
|
local uri = res.uri or res.targetUri
|
||||||
|
if uri:match '^deno:' then
|
||||||
|
virtual_text_document(uri, client)
|
||||||
|
res['uri'] = uri
|
||||||
|
res['targetUri'] = uri
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
lsp.handlers[ctx.method](err, result, ctx, config)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'deno', 'lsp' },
|
||||||
|
cmd_env = { NO_COLOR = true },
|
||||||
|
filetypes = {
|
||||||
|
'javascript',
|
||||||
|
'javascriptreact',
|
||||||
|
'javascript.jsx',
|
||||||
|
'typescript',
|
||||||
|
'typescriptreact',
|
||||||
|
'typescript.tsx',
|
||||||
|
},
|
||||||
|
root_dir = function(bufnr, on_dir)
|
||||||
|
-- The project root is where the LSP can be started from
|
||||||
|
local root_markers = { 'deno.lock' }
|
||||||
|
-- Give the root markers equal priority by wrapping them in a table
|
||||||
|
root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } }
|
||||||
|
or vim.list_extend(root_markers, { '.git' })
|
||||||
|
-- exclude non-deno projects (npm, yarn, pnpm, bun)
|
||||||
|
local non_deno_path = vim.fs.root(
|
||||||
|
bufnr,
|
||||||
|
{ 'package.json', 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock' }
|
||||||
|
)
|
||||||
|
local project_root = vim.fs.root(bufnr, root_markers)
|
||||||
|
if non_deno_path and (not project_root or #non_deno_path >= #project_root) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
-- We fallback to the current working directory if no project root is found
|
||||||
|
on_dir(project_root or vim.fn.getcwd())
|
||||||
|
end,
|
||||||
|
settings = {
|
||||||
|
deno = {
|
||||||
|
enable = true,
|
||||||
|
suggest = {
|
||||||
|
imports = {
|
||||||
|
hosts = {
|
||||||
|
['https://deno.land'] = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
handlers = {
|
||||||
|
['textDocument/definition'] = denols_handler,
|
||||||
|
['textDocument/typeDefinition'] = denols_handler,
|
||||||
|
['textDocument/references'] = denols_handler,
|
||||||
|
},
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
vim.api.nvim_buf_create_user_command(bufnr, 'LspDenolsCache', function()
|
||||||
|
client:exec_cmd({
|
||||||
|
title = 'DenolsCache',
|
||||||
|
command = 'deno.cache',
|
||||||
|
arguments = { {}, vim.uri_from_bufnr(bufnr) },
|
||||||
|
}, { bufnr = bufnr }, function(err, _, ctx)
|
||||||
|
if err then
|
||||||
|
local uri = ctx.params.arguments[2]
|
||||||
|
vim.notify('cache command failed for' .. vim.uri_to_fname(uri), vim.log.levels.ERROR)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end, {
|
||||||
|
desc = 'Cache a module and all of its dependencies.',
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
18
.config/nvim/lsp/dhall_lsp_server.lua
Normal file
18
.config/nvim/lsp/dhall_lsp_server.lua
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-lsp-server
|
||||||
|
---
|
||||||
|
--- language server for dhall
|
||||||
|
---
|
||||||
|
--- `dhall-lsp-server` can be installed via cabal:
|
||||||
|
--- ```sh
|
||||||
|
--- cabal install dhall-lsp-server
|
||||||
|
--- ```
|
||||||
|
--- prebuilt binaries can be found [here](https://github.com/dhall-lang/dhall-haskell/releases).
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'dhall-lsp-server' },
|
||||||
|
filetypes = { 'dhall' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
14
.config/nvim/lsp/diagnosticls.lua
Normal file
14
.config/nvim/lsp/diagnosticls.lua
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/iamcco/diagnostic-languageserver
|
||||||
|
---
|
||||||
|
--- Diagnostic language server integrate with linters.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
-- Configuration from https://github.com/iamcco/diagnostic-languageserver#config--document
|
||||||
|
cmd = { 'diagnostic-languageserver', '--stdio' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
-- Empty by default, override to add filetypes.
|
||||||
|
filetypes = {},
|
||||||
|
}
|
||||||
16
.config/nvim/lsp/digestif.lua
Normal file
16
.config/nvim/lsp/digestif.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/astoff/digestif
|
||||||
|
---
|
||||||
|
--- Digestif is a code analyzer, and a language server, for LaTeX, ConTeXt et caterva. It provides
|
||||||
|
---
|
||||||
|
--- context-sensitive completion, documentation, code navigation, and related functionality to any
|
||||||
|
---
|
||||||
|
--- text editor that speaks the LSP protocol.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'digestif' },
|
||||||
|
filetypes = { 'tex', 'plaintex', 'context' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
12
.config/nvim/lsp/djls.lua
Normal file
12
.config/nvim/lsp/djls.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/joshuadavidthomas/django-language-server
|
||||||
|
---
|
||||||
|
--- `djls`, a language server for the Django web framework.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'djls', 'serve' },
|
||||||
|
filetypes = { 'htmldjango', 'html', 'python' },
|
||||||
|
root_markers = { 'manage.py', 'pyproject.toml', '.git' },
|
||||||
|
}
|
||||||
13
.config/nvim/lsp/djlsp.lua
Normal file
13
.config/nvim/lsp/djlsp.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/fourdigits/django-template-lsp
|
||||||
|
---
|
||||||
|
--- `djlsp`, a language server for Django templates.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'djlsp' },
|
||||||
|
filetypes = { 'html', 'htmldjango' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
settings = {},
|
||||||
|
}
|
||||||
19
.config/nvim/lsp/docker_compose_language_service.lua
Normal file
19
.config/nvim/lsp/docker_compose_language_service.lua
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/microsoft/compose-language-service
|
||||||
|
--- This project contains a language service for Docker Compose.
|
||||||
|
---
|
||||||
|
--- `compose-language-service` can be installed via `npm`:
|
||||||
|
---
|
||||||
|
--- ```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`.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'docker-compose-langserver', '--stdio' },
|
||||||
|
filetypes = { 'yaml.docker-compose' },
|
||||||
|
root_markers = { 'docker-compose.yaml', 'docker-compose.yml', 'compose.yaml', 'compose.yml' },
|
||||||
|
}
|
||||||
32
.config/nvim/lsp/docker_language_server.lua
Normal file
32
.config/nvim/lsp/docker_language_server.lua
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/docker/docker-language-server
|
||||||
|
---
|
||||||
|
--- `docker-langserver-server` can be installed via `go`:
|
||||||
|
--- ```sh
|
||||||
|
--- go install github.com/docker/docker-language-server/cmd/docker-language-server@latest
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'docker-language-server', 'start', '--stdio' },
|
||||||
|
filetypes = { 'dockerfile', 'yaml.docker-compose' },
|
||||||
|
get_language_id = function(_, ftype)
|
||||||
|
if ftype == 'yaml.docker-compose' or ftype:lower():find('ya?ml') then
|
||||||
|
return 'dockercompose'
|
||||||
|
else
|
||||||
|
return ftype
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
root_markers = {
|
||||||
|
'Dockerfile',
|
||||||
|
'docker-compose.yaml',
|
||||||
|
'docker-compose.yml',
|
||||||
|
'compose.yaml',
|
||||||
|
'compose.yml',
|
||||||
|
'docker-bake.json',
|
||||||
|
'docker-bake.hcl',
|
||||||
|
'docker-bake.override.json',
|
||||||
|
'docker-bake.override.hcl',
|
||||||
|
},
|
||||||
|
}
|
||||||
30
.config/nvim/lsp/dockerls.lua
Normal file
30
.config/nvim/lsp/dockerls.lua
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- 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
|
||||||
|
--- vim.lsp.config('dockerls', {
|
||||||
|
--- settings = {
|
||||||
|
--- docker = {
|
||||||
|
--- languageserver = {
|
||||||
|
--- formatter = {
|
||||||
|
--- ignoreMultilineInstructions = true,
|
||||||
|
--- },
|
||||||
|
--- },
|
||||||
|
--- }
|
||||||
|
--- }
|
||||||
|
--- })
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'docker-langserver', '--stdio' },
|
||||||
|
filetypes = { 'dockerfile' },
|
||||||
|
root_markers = { 'Dockerfile' },
|
||||||
|
}
|
||||||
15
.config/nvim/lsp/dolmenls.lua
Normal file
15
.config/nvim/lsp/dolmenls.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/Gbury/dolmen/blob/master/doc/lsp.md
|
||||||
|
---
|
||||||
|
--- `dolmenls` can be installed via `opam`
|
||||||
|
--- ```sh
|
||||||
|
--- opam install dolmen_lsp
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'dolmenls' },
|
||||||
|
filetypes = { 'smt2', 'tptp', 'p', 'cnf', 'icnf', 'zf' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
15
.config/nvim/lsp/dotls.lua
Normal file
15
.config/nvim/lsp/dotls.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/nikeee/dot-language-server
|
||||||
|
---
|
||||||
|
--- `dot-language-server` can be installed via `npm`:
|
||||||
|
--- ```sh
|
||||||
|
--- npm install -g dot-language-server
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'dot-language-server', '--stdio' },
|
||||||
|
filetypes = { 'dot' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
26
.config/nvim/lsp/dprint.lua
Normal file
26
.config/nvim/lsp/dprint.lua
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/dprint/dprint
|
||||||
|
---
|
||||||
|
--- Pluggable and configurable code formatting platform written in Rust.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'dprint', 'lsp' },
|
||||||
|
filetypes = {
|
||||||
|
'javascript',
|
||||||
|
'javascriptreact',
|
||||||
|
'typescript',
|
||||||
|
'typescriptreact',
|
||||||
|
'json',
|
||||||
|
'jsonc',
|
||||||
|
'markdown',
|
||||||
|
'python',
|
||||||
|
'toml',
|
||||||
|
'rust',
|
||||||
|
'roslyn',
|
||||||
|
'graphql',
|
||||||
|
},
|
||||||
|
root_markers = { 'dprint.json', '.dprint.json', 'dprint.jsonc', '.dprint.jsonc' },
|
||||||
|
settings = {},
|
||||||
|
}
|
||||||
69
.config/nvim/lsp/ds_pinyin_lsp.lua
Normal file
69
.config/nvim/lsp/ds_pinyin_lsp.lua
Normal file
|
|
@ -0,0 +1,69 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/iamcco/ds-pinyin-lsp
|
||||||
|
--- Dead simple Pinyin language server for input Chinese without IME(input method).
|
||||||
|
--- To install, download the latest [release](https://github.com/iamcco/ds-pinyin-lsp/releases) and ensure `ds-pinyin-lsp` is on your path.
|
||||||
|
--- And make ensure the database file `dict.db3` is also downloaded. And put the path to `dict.dbs` in the following code.
|
||||||
|
---
|
||||||
|
--- ```lua
|
||||||
|
---
|
||||||
|
--- vim.lsp.config('ds_pinyin_lsp', {
|
||||||
|
--- init_options = {
|
||||||
|
--- db_path = "your_path_to_database"
|
||||||
|
--- }
|
||||||
|
--- })
|
||||||
|
---
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
local bin_name = 'ds-pinyin-lsp'
|
||||||
|
if vim.fn.has 'win32' == 1 then
|
||||||
|
bin_name = bin_name .. '.exe'
|
||||||
|
end
|
||||||
|
|
||||||
|
local function ds_pinyin_lsp_off(bufnr)
|
||||||
|
local ds_pinyin_lsp_client = vim.lsp.get_clients({ bufnr = bufnr, name = 'ds_pinyin_lsp' })[1]
|
||||||
|
if ds_pinyin_lsp_client then
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
|
ds_pinyin_lsp_client:notify('$/turn/completion', {
|
||||||
|
['completion_on'] = false,
|
||||||
|
})
|
||||||
|
else
|
||||||
|
vim.notify 'notification $/turn/completion is not supported by any servers active on the current buffer'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function ds_pinyin_lsp_on(bufnr)
|
||||||
|
local ds_pinyin_lsp_client = vim.lsp.get_clients({ bufnr = bufnr, name = 'ds_pinyin_lsp' })[1]
|
||||||
|
if ds_pinyin_lsp_client then
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
|
ds_pinyin_lsp_client:notify('$/turn/completion', {
|
||||||
|
['completion_on'] = true,
|
||||||
|
})
|
||||||
|
else
|
||||||
|
vim.notify 'notification $/turn/completion is not supported by any servers active on the current buffer'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { bin_name },
|
||||||
|
filetypes = { 'markdown', 'org' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
init_options = {
|
||||||
|
completion_on = true,
|
||||||
|
show_symbols = true,
|
||||||
|
show_symbols_only_follow_by_hanzi = false,
|
||||||
|
show_symbols_by_n_times = 0,
|
||||||
|
match_as_same_as_input = true,
|
||||||
|
match_long_input = true,
|
||||||
|
max_suggest = 15,
|
||||||
|
},
|
||||||
|
on_attach = function(_, bufnr)
|
||||||
|
vim.api.nvim_buf_create_user_command(bufnr, 'LspDsPinyinCompletionOff', function()
|
||||||
|
ds_pinyin_lsp_off(bufnr)
|
||||||
|
end, { desc = 'Turn off the ds-pinyin-lsp completion' })
|
||||||
|
vim.api.nvim_buf_create_user_command(bufnr, 'LspDsPinyinCompletionOn', function()
|
||||||
|
ds_pinyin_lsp_on(bufnr)
|
||||||
|
end, { desc = 'Turn on the ds-pinyin-lsp completion' })
|
||||||
|
end,
|
||||||
|
}
|
||||||
22
.config/nvim/lsp/dts_lsp.lua
Normal file
22
.config/nvim/lsp/dts_lsp.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- `dts-lsp` is an LSP for Devicetree files built on top of tree-sitter-devicetree grammar.
|
||||||
|
--- Language servers can be used in many editors, such as Visual Studio Code, Emacs
|
||||||
|
--- or Vim
|
||||||
|
---
|
||||||
|
--- Install `dts-lsp` from https://github.com/igor-prusov/dts-lsp and add it to path
|
||||||
|
---
|
||||||
|
--- `dts-lsp` doesn't require any configuration.
|
||||||
|
---
|
||||||
|
--- More about Devicetree:
|
||||||
|
--- https://www.devicetree.org/
|
||||||
|
--- https://docs.zephyrproject.org/latest/build/dts/index.html
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
name = 'dts_lsp',
|
||||||
|
cmd = { 'dts-lsp' },
|
||||||
|
filetypes = { 'dts', 'dtsi', 'overlay' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
settings = {},
|
||||||
|
}
|
||||||
12
.config/nvim/lsp/earthlyls.lua
Normal file
12
.config/nvim/lsp/earthlyls.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/glehmann/earthlyls
|
||||||
|
---
|
||||||
|
--- A fast language server for earthly.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'earthlyls' },
|
||||||
|
filetypes = { 'earthfile' },
|
||||||
|
root_markers = { 'Earthfile' },
|
||||||
|
}
|
||||||
15
.config/nvim/lsp/ecsact.lua
Normal file
15
.config/nvim/lsp/ecsact.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/ecsact-dev/ecsact_lsp_server
|
||||||
|
---
|
||||||
|
--- Language server for Ecsact.
|
||||||
|
---
|
||||||
|
--- The default cmd assumes `ecsact_lsp_server` is in your PATH. Typically from the
|
||||||
|
--- Ecsact SDK: https://ecsact.dev/start
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'ecsact_lsp_server', '--stdio' },
|
||||||
|
filetypes = { 'ecsact' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
25
.config/nvim/lsp/efm.lua
Normal file
25
.config/nvim/lsp/efm.lua
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
--- @brief
|
||||||
|
---
|
||||||
|
--- https://github.com/mattn/efm-langserver
|
||||||
|
---
|
||||||
|
--- General purpose Language Server that can use specified error message format generated from specified command.
|
||||||
|
---
|
||||||
|
--- Requires at minimum EFM version [v0.0.38](https://github.com/mattn/efm-langserver/releases/tag/v0.0.38) to support
|
||||||
|
--- launching the language server on single files.
|
||||||
|
---
|
||||||
|
--- Note: In order for neovim's built-in language server client to send the appropriate `languageId` to EFM, **you must
|
||||||
|
--- specify `filetypes` in your call to `vim.lsp.config`**. Otherwise the server will be launch on the `BufEnter` instead
|
||||||
|
--- of the `FileType` autocommand, and the `filetype` variable used to populate the `languageId` will not yet be set.
|
||||||
|
---
|
||||||
|
--- ```lua
|
||||||
|
--- vim.lsp.config('efm', {
|
||||||
|
--- filetypes = { 'python','cpp','lua' }
|
||||||
|
--- settings = ..., -- You must populate this according to the EFM readme
|
||||||
|
--- })
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'efm-langserver' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
47
.config/nvim/lsp/elixirls.lua
Normal file
47
.config/nvim/lsp/elixirls.lua
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/elixir-lsp/elixir-ls
|
||||||
|
---
|
||||||
|
--- `elixir-ls` can be installed by following the instructions [here](https://github.com/elixir-lsp/elixir-ls#building-and-running).
|
||||||
|
---
|
||||||
|
--- 1. Download the zip from https://github.com/elixir-lsp/elixir-ls/releases/latest/
|
||||||
|
--- 2. Unzip it and make it executable.
|
||||||
|
--- ```bash
|
||||||
|
--- unzip elixir-ls.zip -d /path/to/elixir-ls
|
||||||
|
--- # Unix
|
||||||
|
--- chmod +x /path/to/elixir-ls/language_server.sh
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- **By default, elixir-ls doesn't have a `cmd` set.** This is because nvim-lspconfig does not make assumptions about
|
||||||
|
--- your path. You must add the following to your init.vim or init.lua to set `cmd` to the absolute path ($HOME and
|
||||||
|
--- ~ are not expanded) of your unzipped elixir-ls.
|
||||||
|
---
|
||||||
|
--- ```lua
|
||||||
|
--- vim.lsp.config('elixirls', {
|
||||||
|
--- -- Unix
|
||||||
|
--- cmd = { "/path/to/elixir-ls/language_server.sh" };
|
||||||
|
--- -- Windows
|
||||||
|
--- cmd = { "/path/to/elixir-ls/language_server.bat" };
|
||||||
|
--- ...
|
||||||
|
--- })
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- '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.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'elixir-ls' },
|
||||||
|
filetypes = { 'elixir', 'eelixir', 'heex', 'surface' },
|
||||||
|
root_dir = function(bufnr, on_dir)
|
||||||
|
local fname = vim.api.nvim_buf_get_name(bufnr)
|
||||||
|
--- Elixir workspaces may have multiple `mix.exs` files, for an "umbrella" layout or monorepo.
|
||||||
|
--- So we specify `limit=2` and treat the highest one (if any) as the root of an umbrella app.
|
||||||
|
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)
|
||||||
|
|
||||||
|
on_dir(root_dir)
|
||||||
|
end,
|
||||||
|
}
|
||||||
35
.config/nvim/lsp/elmls.lua
Normal file
35
.config/nvim/lsp/elmls.lua
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/elm-tooling/elm-language-server#installation
|
||||||
|
---
|
||||||
|
--- If you don't want to use Nvim to install it, then you can use:
|
||||||
|
--- ```sh
|
||||||
|
--- npm install -g elm elm-test elm-format @elm-tooling/elm-language-server
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
local api = vim.api
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'elm-language-server' },
|
||||||
|
-- TODO(ashkan) if we comment this out, it will allow elmls to operate on elm.json. It seems like it could do that, but no other editor allows it right now.
|
||||||
|
filetypes = { 'elm' },
|
||||||
|
root_dir = function(bufnr, on_dir)
|
||||||
|
local fname = api.nvim_buf_get_name(bufnr)
|
||||||
|
local filetype = vim.bo[bufnr].filetype
|
||||||
|
if filetype == 'elm' or (filetype == 'json' and fname:match 'elm%.json$') then
|
||||||
|
on_dir(vim.fs.root(fname, 'elm.json'))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
on_dir(nil)
|
||||||
|
end,
|
||||||
|
init_options = {
|
||||||
|
elmReviewDiagnostics = 'off', -- 'off' | 'warning' | 'error'
|
||||||
|
skipInstallPackageConfirmation = false,
|
||||||
|
disableElmLSDiagnostics = false,
|
||||||
|
onlyUpdateDiagnosticsOnSave = false,
|
||||||
|
},
|
||||||
|
capabilities = {
|
||||||
|
offsetEncoding = { 'utf-8', 'utf-16' },
|
||||||
|
},
|
||||||
|
}
|
||||||
13
.config/nvim/lsp/elp.lua
Normal file
13
.config/nvim/lsp/elp.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://whatsapp.github.io/erlang-language-platform
|
||||||
|
---
|
||||||
|
--- ELP integrates Erlang into modern IDEs via the language server protocol and was
|
||||||
|
--- inspired by rust-analyzer.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'elp', 'server' },
|
||||||
|
filetypes = { 'erlang' },
|
||||||
|
root_markers = { 'rebar.config', 'erlang.mk', '.git' },
|
||||||
|
}
|
||||||
16
.config/nvim/lsp/ember.lua
Normal file
16
.config/nvim/lsp/ember.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/ember-tooling/ember-language-server
|
||||||
|
---
|
||||||
|
--- `ember-language-server` can be installed via `npm`:
|
||||||
|
---
|
||||||
|
--- ```sh
|
||||||
|
--- npm install -g @ember-tooling/ember-language-server
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'ember-language-server', '--stdio' },
|
||||||
|
filetypes = { 'handlebars', 'typescript', 'javascript', 'typescript.glimmer', 'javascript.glimmer' },
|
||||||
|
root_markers = { 'ember-cli-build.js', '.git' },
|
||||||
|
}
|
||||||
31
.config/nvim/lsp/emmet_language_server.lua
Normal file
31
.config/nvim/lsp/emmet_language_server.lua
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/olrtg/emmet-language-server
|
||||||
|
---
|
||||||
|
--- Package can be installed via `npm`:
|
||||||
|
--- ```sh
|
||||||
|
--- npm install -g @olrtg/emmet-language-server
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'emmet-language-server', '--stdio' },
|
||||||
|
filetypes = {
|
||||||
|
'astro',
|
||||||
|
'css',
|
||||||
|
'eruby',
|
||||||
|
'html',
|
||||||
|
'htmlangular',
|
||||||
|
'htmldjango',
|
||||||
|
'javascriptreact',
|
||||||
|
'less',
|
||||||
|
'pug',
|
||||||
|
'sass',
|
||||||
|
'scss',
|
||||||
|
'svelte',
|
||||||
|
'templ',
|
||||||
|
'typescriptreact',
|
||||||
|
'vue',
|
||||||
|
},
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
31
.config/nvim/lsp/emmet_ls.lua
Normal file
31
.config/nvim/lsp/emmet_ls.lua
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/aca/emmet-ls
|
||||||
|
---
|
||||||
|
--- Package can be installed via `npm`:
|
||||||
|
--- ```sh
|
||||||
|
--- npm install -g emmet-ls
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'emmet-ls', '--stdio' },
|
||||||
|
filetypes = {
|
||||||
|
'astro',
|
||||||
|
'css',
|
||||||
|
'eruby',
|
||||||
|
'html',
|
||||||
|
'htmlangular',
|
||||||
|
'htmldjango',
|
||||||
|
'javascriptreact',
|
||||||
|
'less',
|
||||||
|
'pug',
|
||||||
|
'sass',
|
||||||
|
'scss',
|
||||||
|
'svelte',
|
||||||
|
'templ',
|
||||||
|
'typescriptreact',
|
||||||
|
'vue',
|
||||||
|
},
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
24
.config/nvim/lsp/emmylua_ls.lua
Normal file
24
.config/nvim/lsp/emmylua_ls.lua
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/EmmyLuaLs/emmylua-analyzer-rust
|
||||||
|
---
|
||||||
|
--- Emmylua Analyzer Rust. Language Server for Lua.
|
||||||
|
---
|
||||||
|
--- `emmylua_ls` can be installed using `cargo` by following the instructions[here]
|
||||||
|
--- (https://github.com/EmmyLuaLs/emmylua-analyzer-rust?tab=readme-ov-file#install).
|
||||||
|
---
|
||||||
|
--- The default `cmd` assumes that the `emmylua_ls` binary can be found in `$PATH`.
|
||||||
|
--- It might require you to provide cargo binaries installation path in it.
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'emmylua_ls' },
|
||||||
|
filetypes = { 'lua' },
|
||||||
|
root_markers = {
|
||||||
|
'.luarc.json',
|
||||||
|
'.emmyrc.json',
|
||||||
|
'.luacheckrc',
|
||||||
|
'.git',
|
||||||
|
},
|
||||||
|
workspace_required = false,
|
||||||
|
}
|
||||||
19
.config/nvim/lsp/erg_language_server.lua
Normal file
19
.config/nvim/lsp/erg_language_server.lua
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/erg-lang/erg#flags ELS
|
||||||
|
---
|
||||||
|
--- ELS (erg-language-server) is a language server for the Erg programming language.
|
||||||
|
---
|
||||||
|
--- erg-language-server can be installed via `cargo` and used as follows:
|
||||||
|
---
|
||||||
|
--- ```sh
|
||||||
|
--- cargo install erg --features els
|
||||||
|
--- erg --language-server
|
||||||
|
--- ```
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'erg', '--language-server' },
|
||||||
|
filetypes = { 'erg' },
|
||||||
|
root_markers = { 'package.er', '.git' },
|
||||||
|
}
|
||||||
21
.config/nvim/lsp/erlangls.lua
Normal file
21
.config/nvim/lsp/erlangls.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://erlang-ls.github.io
|
||||||
|
---
|
||||||
|
--- Language Server for Erlang.
|
||||||
|
---
|
||||||
|
--- Clone [erlang_ls](https://github.com/erlang-ls/erlang_ls)
|
||||||
|
--- Compile the project with `make` and copy resulting binaries somewhere in your $PATH eg. `cp _build/*/bin/* ~/local/bin`
|
||||||
|
---
|
||||||
|
--- Installation instruction can be found [here](https://github.com/erlang-ls/erlang_ls).
|
||||||
|
---
|
||||||
|
--- Installation requirements:
|
||||||
|
--- - [Erlang OTP 21+](https://github.com/erlang/otp)
|
||||||
|
--- - [rebar3 3.9.1+](https://github.com/erlang/rebar3)
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'erlang_ls' },
|
||||||
|
filetypes = { 'erlang' },
|
||||||
|
root_markers = { 'rebar.config', 'erlang.mk', '.git' },
|
||||||
|
}
|
||||||
51
.config/nvim/lsp/esbonio.lua
Normal file
51
.config/nvim/lsp/esbonio.lua
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
---@brief
|
||||||
|
---
|
||||||
|
--- https://github.com/swyddfa/esbonio
|
||||||
|
---
|
||||||
|
--- Esbonio is a language server for [Sphinx](https://www.sphinx-doc.org/en/master/) documentation projects.
|
||||||
|
--- The language server can be installed via pip
|
||||||
|
---
|
||||||
|
--- ```
|
||||||
|
--- pip install esbonio
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- Since Sphinx is highly extensible you will get best results if you install the language server in the same
|
||||||
|
--- Python environment as the one used to build your documentation. To ensure that the correct Python environment
|
||||||
|
--- is picked up, you can either launch `nvim` with the correct environment activated.
|
||||||
|
---
|
||||||
|
--- ```
|
||||||
|
--- source env/bin/activate
|
||||||
|
--- nvim
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- Or you can modify the default `cmd` to include the full path to the Python interpreter.
|
||||||
|
---
|
||||||
|
--- ```lua
|
||||||
|
--- vim.lsp.config('esbonio', {
|
||||||
|
--- cmd = { '/path/to/virtualenv/bin/python', '-m', 'esbonio' }
|
||||||
|
--- })
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- Esbonio supports a number of config values passed as `init_options` on startup, for example.
|
||||||
|
---
|
||||||
|
--- ```lua
|
||||||
|
--- vim.lsp.config('esbonio', {
|
||||||
|
--- init_options = {
|
||||||
|
--- server = {
|
||||||
|
--- logLevel = "debug"
|
||||||
|
--- },
|
||||||
|
--- sphinx = {
|
||||||
|
--- confDir = "/path/to/docs",
|
||||||
|
--- srcDir = "${confDir}/../docs-src"
|
||||||
|
--- }
|
||||||
|
--- })
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- 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)
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'python3', '-m', 'esbonio' },
|
||||||
|
filetypes = { 'rst' },
|
||||||
|
root_markers = { '.git' },
|
||||||
|
}
|
||||||
231
.config/nvim/lsp/eslint.lua
Normal file
231
.config/nvim/lsp/eslint.lua
Normal file
|
|
@ -0,0 +1,231 @@
|
||||||
|
--- @brief
|
||||||
|
---
|
||||||
|
--- https://github.com/hrsh7th/vscode-langservers-extracted
|
||||||
|
---
|
||||||
|
--- `vscode-eslint-language-server` is a linting engine for JavaScript / Typescript.
|
||||||
|
--- It can be installed via `npm`:
|
||||||
|
---
|
||||||
|
--- ```sh
|
||||||
|
--- npm i -g vscode-langservers-extracted
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- The default `on_attach` config provides the `LspEslintFixAll` command that can be used to format a document on save:
|
||||||
|
--- ```lua
|
||||||
|
--- local base_on_attach = vim.lsp.config.eslint.on_attach
|
||||||
|
--- vim.lsp.config("eslint", {
|
||||||
|
--- on_attach = function(client, bufnr)
|
||||||
|
--- if not base_on_attach then return end
|
||||||
|
---
|
||||||
|
--- base_on_attach(client, bufnr)
|
||||||
|
--- vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
--- buffer = bufnr,
|
||||||
|
--- command = "LspEslintFixAll",
|
||||||
|
--- })
|
||||||
|
--- end,
|
||||||
|
--- })
|
||||||
|
--- ```
|
||||||
|
---
|
||||||
|
--- See [vscode-eslint](https://github.com/microsoft/vscode-eslint/blob/55871979d7af184bf09af491b6ea35ebd56822cf/server/src/eslintServer.ts#L216-L229) for configuration options.
|
||||||
|
---
|
||||||
|
--- Messages handled in lspconfig: `eslint/openDoc`, `eslint/confirmESLintExecution`, `eslint/probeFailed`, `eslint/noLibrary`
|
||||||
|
---
|
||||||
|
--- Additional messages you can handle: `eslint/noConfig`
|
||||||
|
---
|
||||||
|
--- ### Monorepo support
|
||||||
|
---
|
||||||
|
--- `vscode-eslint-language-server` supports monorepos by default. It will automatically find the config file corresponding to the package you are working on. You can use different configs in different packages.
|
||||||
|
--- This works without the need of spawning multiple instances of `vscode-eslint-language-server`.
|
||||||
|
--- You can use a different version of ESLint in each package, but it is recommended to use the same version of ESLint in all packages. The location of the ESLint binary will be determined automatically.
|
||||||
|
---
|
||||||
|
--- /!\ When using flat config files, you need to use them across all your packages in your monorepo, as it's a global setting for the server.
|
||||||
|
|
||||||
|
local util = require 'lspconfig.util'
|
||||||
|
local lsp = vim.lsp
|
||||||
|
|
||||||
|
local eslint_config_files = {
|
||||||
|
'.eslintrc',
|
||||||
|
'.eslintrc.js',
|
||||||
|
'.eslintrc.cjs',
|
||||||
|
'.eslintrc.yaml',
|
||||||
|
'.eslintrc.yml',
|
||||||
|
'.eslintrc.json',
|
||||||
|
'eslint.config.js',
|
||||||
|
'eslint.config.mjs',
|
||||||
|
'eslint.config.cjs',
|
||||||
|
'eslint.config.ts',
|
||||||
|
'eslint.config.mts',
|
||||||
|
'eslint.config.cts',
|
||||||
|
}
|
||||||
|
|
||||||
|
---@type vim.lsp.Config
|
||||||
|
return {
|
||||||
|
cmd = { 'vscode-eslint-language-server', '--stdio' },
|
||||||
|
filetypes = {
|
||||||
|
'javascript',
|
||||||
|
'javascriptreact',
|
||||||
|
'javascript.jsx',
|
||||||
|
'typescript',
|
||||||
|
'typescriptreact',
|
||||||
|
'typescript.tsx',
|
||||||
|
'vue',
|
||||||
|
'svelte',
|
||||||
|
'astro',
|
||||||
|
'htmlangular',
|
||||||
|
},
|
||||||
|
workspace_required = true,
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
vim.api.nvim_buf_create_user_command(bufnr, 'LspEslintFixAll', function()
|
||||||
|
client:request_sync('workspace/executeCommand', {
|
||||||
|
command = 'eslint.applyAllFixes',
|
||||||
|
arguments = {
|
||||||
|
{
|
||||||
|
uri = vim.uri_from_bufnr(bufnr),
|
||||||
|
version = lsp.util.buf_versions[bufnr],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, nil, bufnr)
|
||||||
|
end, {})
|
||||||
|
end,
|
||||||
|
root_dir = function(bufnr, on_dir)
|
||||||
|
-- The project root is where the LSP can be started from
|
||||||
|
-- As stated in the documentation above, this LSP supports monorepos and simple projects.
|
||||||
|
-- We select then from the project root, which is identified by the presence of a package
|
||||||
|
-- manager lock file.
|
||||||
|
local root_markers = { 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock' }
|
||||||
|
-- Give the root markers equal priority by wrapping them in a table
|
||||||
|
root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } }
|
||||||
|
or vim.list_extend(root_markers, { '.git' })
|
||||||
|
|
||||||
|
-- exclude deno
|
||||||
|
if vim.fs.root(bufnr, { 'deno.json', 'deno.jsonc', 'deno.lock' }) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- We fallback to the current working directory if no project root is found
|
||||||
|
local project_root = vim.fs.root(bufnr, root_markers) or vim.fn.getcwd()
|
||||||
|
|
||||||
|
-- We know that the buffer is using ESLint if it has a config file
|
||||||
|
-- in its directory tree.
|
||||||
|
--
|
||||||
|
-- Eslint used to support package.json files as config files, but it doesn't anymore.
|
||||||
|
-- We keep this for backward compatibility.
|
||||||
|
local filename = vim.api.nvim_buf_get_name(bufnr)
|
||||||
|
local eslint_config_files_with_package_json =
|
||||||
|
util.insert_package_json(eslint_config_files, 'eslintConfig', filename)
|
||||||
|
local is_buffer_using_eslint = vim.fs.find(eslint_config_files_with_package_json, {
|
||||||
|
path = filename,
|
||||||
|
type = 'file',
|
||||||
|
limit = 1,
|
||||||
|
upward = true,
|
||||||
|
stop = vim.fs.dirname(project_root),
|
||||||
|
})[1]
|
||||||
|
if not is_buffer_using_eslint then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
on_dir(project_root)
|
||||||
|
end,
|
||||||
|
-- Refer to https://github.com/Microsoft/vscode-eslint#settings-options for documentation.
|
||||||
|
settings = {
|
||||||
|
validate = 'on',
|
||||||
|
---@diagnostic disable-next-line: assign-type-mismatch
|
||||||
|
packageManager = nil,
|
||||||
|
useESLintClass = false,
|
||||||
|
experimental = {
|
||||||
|
useFlatConfig = false,
|
||||||
|
},
|
||||||
|
codeActionOnSave = {
|
||||||
|
enable = false,
|
||||||
|
mode = 'all',
|
||||||
|
},
|
||||||
|
format = true,
|
||||||
|
quiet = false,
|
||||||
|
onIgnoredFiles = 'off',
|
||||||
|
rulesCustomizations = {},
|
||||||
|
run = 'onType',
|
||||||
|
problems = {
|
||||||
|
shortenToSingleLine = false,
|
||||||
|
},
|
||||||
|
-- nodePath configures the directory in which the eslint server should start its node_modules resolution.
|
||||||
|
-- This path is relative to the workspace folder (root dir) of the server instance.
|
||||||
|
nodePath = '',
|
||||||
|
-- use the workspace folder location or the file location (if no workspace folder is open) as the working directory
|
||||||
|
workingDirectory = { mode = 'auto' },
|
||||||
|
codeAction = {
|
||||||
|
disableRuleComment = {
|
||||||
|
enable = true,
|
||||||
|
location = 'separateLine',
|
||||||
|
},
|
||||||
|
showDocumentation = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
before_init = function(_, config)
|
||||||
|
-- The "workspaceFolder" is a VSCode concept. It limits how far the
|
||||||
|
-- server will traverse the file system when locating the ESLint config
|
||||||
|
-- file (e.g., .eslintrc).
|
||||||
|
local root_dir = config.root_dir
|
||||||
|
|
||||||
|
if root_dir then
|
||||||
|
config.settings = config.settings or {}
|
||||||
|
config.settings.workspaceFolder = {
|
||||||
|
uri = root_dir,
|
||||||
|
name = vim.fn.fnamemodify(root_dir, ':t'),
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Support flat config files
|
||||||
|
-- They contain 'config' in the file name
|
||||||
|
local flat_config_files = vim.tbl_filter(function(file)
|
||||||
|
return file:match('config')
|
||||||
|
end, eslint_config_files)
|
||||||
|
|
||||||
|
for _, file in ipairs(flat_config_files) do
|
||||||
|
local found_files = vim.fn.globpath(root_dir, file, true, true)
|
||||||
|
|
||||||
|
-- Filter out files inside node_modules
|
||||||
|
local filtered_files = {}
|
||||||
|
for _, found_file in ipairs(found_files) do
|
||||||
|
if string.find(found_file, '[/\\]node_modules[/\\]') == nil then
|
||||||
|
table.insert(filtered_files, found_file)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if #filtered_files > 0 then
|
||||||
|
config.settings.experimental = config.settings.experimental or {}
|
||||||
|
config.settings.experimental.useFlatConfig = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Support Yarn2 (PnP) projects
|
||||||
|
local pnp_cjs = root_dir .. '/.pnp.cjs'
|
||||||
|
local pnp_js = root_dir .. '/.pnp.js'
|
||||||
|
if type(config.cmd) == 'table' and (vim.uv.fs_stat(pnp_cjs) or vim.uv.fs_stat(pnp_js)) then
|
||||||
|
config.cmd = vim.list_extend({ 'yarn', 'exec' }, config.cmd --[[@as table]])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
handlers = {
|
||||||
|
['eslint/openDoc'] = function(_, result)
|
||||||
|
if result then
|
||||||
|
vim.ui.open(result.url)
|
||||||
|
end
|
||||||
|
return {}
|
||||||
|
end,
|
||||||
|
['eslint/confirmESLintExecution'] = function(_, result)
|
||||||
|
if not result then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
return 4 -- approved
|
||||||
|
end,
|
||||||
|
['eslint/probeFailed'] = function()
|
||||||
|
vim.notify('[lspconfig] ESLint probe failed.', vim.log.levels.WARN)
|
||||||
|
return {}
|
||||||
|
end,
|
||||||
|
['eslint/noLibrary'] = function()
|
||||||
|
vim.notify('[lspconfig] Unable to find ESLint library.', vim.log.levels.WARN)
|
||||||
|
return {}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue