1

Refresh generated neovim config

This commit is contained in:
2024-08-15 13:01:03 +02:00
parent 64b51cf53a
commit f5af8e2b28
1836 changed files with 38979 additions and 31094 deletions

View File

@ -13,6 +13,7 @@ local configs = {}
--- @field on_new_config? function
--- @field autostart? boolean
--- @field package _on_attach? fun(client: vim.lsp.Client, bufnr: integer)
--- @field root_dir? string|fun(filename: string, bufnr: number)
--- @param cmd any
local function sanitize_cmd(cmd)

View File

@ -21,7 +21,7 @@ return {
'--ngProbeLocations',
default_probe_dir,
},
filetypes = { 'typescript', 'html', 'typescriptreact', 'typescript.tsx' },
filetypes = { 'typescript', 'html', 'typescriptreact', 'typescript.tsx', 'htmlangular' },
-- Check for angular.json since that is the root of the project.
-- Don't check for tsconfig.json or package.json since there are multiple of these
-- in an angular monorepo setup.

View File

@ -46,10 +46,10 @@ If you don't have a sketch yet create one.
```sh
$ arduino-cli sketch new test
$ cd 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 like using the following commands.
You will need a `sketch.yaml` file in order for the language server to understand your project. It will also save you passing options to `arduino-cli` each time you compile or upload a file. You can generate the file by using the following commands.
First gather some information about your board. Make sure your board is connected and run the following:
@ -66,7 +66,7 @@ Then generate the file:
arduino-cli board attach -p /dev/ttyACM0 -b arduino:avr:uno test.ino
```
The resulting file should like like this:
The resulting file should look like this:
```yaml
default_fqbn: arduino:avr:uno
@ -81,7 +81,7 @@ Your folder structure should look like this:
└── sketch.yaml
```
For further instruction about configuration options, run `arduino-language-server --help`.
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

View File

@ -14,6 +14,7 @@ return {
'sass',
'scss',
'typescriptreact',
'htmlangular',
},
root_dir = util.find_git_ancestor,
single_file_support = true,

View File

@ -17,6 +17,7 @@ return {
'svelte',
'typescriptreact',
'vue',
'htmlangular',
},
root_dir = util.find_git_ancestor,
single_file_support = true,

View File

@ -8,6 +8,27 @@ return {
init_options = {
AutomaticWorkspaceInit = true,
},
-- this recommended settings values taken from https://github.com/ionide/FsAutoComplete?tab=readme-ov-file#settings
settings = {
FSharp = {
keywordsAutocomplete = true,
ExternalAutocomplete = false,
Linter = true,
UnionCaseStubGeneration = true,
UnionCaseStubGenerationBody = 'failwith "Not Implemented"',
RecordStubGeneration = true,
RecordStubGenerationBody = 'failwith "Not Implemented"',
InterfaceStubGeneration = true,
InterfaceStubGenerationObjectIdentifier = 'this',
InterfaceStubGenerationMethodBody = 'failwith "Not Implemented"',
UnusedOpensAnalyzer = true,
UnusedDeclarationsAnalyzer = true,
UseSdkScripts = true,
SimplifyNameAnalyzer = true,
ResolveNamespaces = true,
EnableReferenceCodeLens = true,
},
},
},
docs = {
description = [[

View File

@ -18,6 +18,9 @@ return {
'csharp',
'toml',
'lua',
'gitcommit',
'java',
'html',
},
root_dir = util.find_git_ancestor,
single_file_support = true,

View File

@ -3,7 +3,7 @@ local util = require 'lspconfig.util'
return {
default_config = {
cmd = { 'hyprls', '--stdio' },
filetypes = { '*.hl', 'hypr*.conf', '.config/hypr/*.conf' },
filetypes = { 'hyprlang', '*.hl', 'hypr*.conf', '.config/hypr/*.conf' },
root_dir = util.find_git_ancestor,
single_file_support = true,
},

View File

@ -1,36 +1,21 @@
local util = require 'lspconfig.util'
local root_files = {}
local default_capabilities = {
textDocument = {
completion = {
editsNearCursor = true,
},
},
offsetEncoding = { 'utf-8' },
}
return {
default_config = {
cmd = { 'koka', '--language-server' },
filetypes = { 'kk' },
root_dir = function(fname)
return util.root_pattern(unpack(root_files))(fname) or util.find_git_ancestor(fname)
end,
cmd = { 'koka', '--language-server', '--lsstdio' },
filetypes = { 'koka' },
single_file_support = true,
capabilities = default_capabilities,
root_dir = util.find_git_ancestor,
},
commands = {},
docs = {
description = [[
https://koka-lang.github.io/koka/doc/index.html
Koka is a functional programming language with effect types and handlers.
]],
default_config = {
root_dir = [[
]],
capabilities = [[default capabilities, with offsetEncoding utf-8]],
root_dir = [[git directory]],
capabilities = [[default capabilities]],
},
},
}

View File

@ -21,36 +21,11 @@ return {
end
end
return util.root_pattern('lakefile.lean', 'lean-toolchain', 'leanpkg.toml')(fname)
return util.root_pattern('lakefile.toml', 'lakefile.lean', 'lean-toolchain')(fname)
or stdlib_dir
or util.find_git_ancestor(fname)
end,
options = {
-- Only Lake 3.0+ supports lake serve, so for old enough Lean 4,
-- or core Lean itself, this command (typically using the in-built
-- Lean 4 language server) will be used instead.
no_lake_lsp_cmd = { 'lean', '--server' },
},
on_new_config = function(config, root_dir)
local use_lake_serve = false
if util.path.exists(util.path.join(root_dir, 'lakefile.lean')) then
local lake_version = ''
local lake_job = vim.fn.jobstart({ 'lake', '--version' }, {
on_stdout = function(_, d, _)
lake_version = table.concat(d, '\n')
end,
stdout_buffered = true,
})
if lake_job > 0 and vim.fn.jobwait({ lake_job })[1] == 0 then
local major = lake_version:match 'Lake version (%d).'
if major and tonumber(major) >= 3 then
use_lake_serve = true
end
end
end
if not use_lake_serve then
config.cmd = config.options.no_lake_lsp_cmd
end
-- add root dir as command-line argument for `ps aux`
table.insert(config.cmd, root_dir)
end,
@ -63,15 +38,15 @@ https://github.com/leanprover/lean4
Lean installation instructions can be found
[here](https://leanprover-community.github.io/get_started.html#regular-install).
The Lean 4 language server is built-in with a Lean 4 install
(and can be manually run with, e.g., `lean --server`).
The Lean language server is included in any Lean installation and
does not require any additional packages.
Note: that if you're using [lean.nvim](https://github.com/Julian/lean.nvim),
that plugin fully handles the setup of the Lean language server,
and you shouldn't set up `leanls` both with it and `lspconfig`.
]],
default_config = {
root_dir = [[root_pattern("lakefile.lean", "lean-toolchain", "leanpkg.toml", ".git")]],
root_dir = [[root_pattern("lakefile.toml", "lakefile.lean", "lean-toolchain", ".git")]],
},
},
}

View File

@ -15,6 +15,18 @@ return {
https://github.com/Decodetalkers/neocmakelsp
CMake LSP Implementation
Neovim does not currently include built-in snippets. `neocmakelsp` 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
require'lspconfig'.neocmake.setup {
capabilities = capabilities,
}
```
]],
default_config = {
root_dir = [[root_pattern('.git', 'cmake')]],

View File

@ -8,7 +8,7 @@ local root_files = {
return {
default_config = {
cmd = { 'ruff', 'server', '--preview' },
cmd = { 'ruff', 'server' },
filetypes = { 'python' },
root_dir = util.root_pattern(unpack(root_files)) or util.find_git_ancestor(),
single_file_support = true,
@ -18,22 +18,29 @@ return {
description = [[
https://github.com/astral-sh/ruff
A Language Server Protocol implementation for Ruff, an extremely fast Python linter and code formatter, written in Rust. It can be installed via pip.
A Language Server Protocol implementation for Ruff, an extremely fast Python linter and code formatter, written in Rust. It can be installed via `pip`.
```sh
pip install ruff
```
_Requires Ruff v0.3.3 or later._
**Available in Ruff `v0.4.5` in beta and stabilized in Ruff `v0.5.3`.**
This is the new Rust-based version of the original `ruff-lsp` implementation. It's currently in alpha, meaning that some features are under development. Currently, the following capabilities are supported:
This is the new built-in language server written in Rust. It supports the same feature set as `ruff-lsp`, but with superior performance and no installation required. Note that the `ruff-lsp` server will continue to be maintained until further notice.
1. Diagnostics
2. Code actions
3. Formatting
4. Range Formatting
Server settings can be provided via:
Please note that the `ruff-lsp` server will continue to be maintained until further notice.
```lua
require('lspconfig').ruff.setup({
init_options = {
settings = {
-- Server settings should go here
}
}
})
```
Refer to the [documentation](https://docs.astral.sh/ruff/editors/) for more details.
]],
root_dir = [[root_pattern("pyproject.toml", "ruff.toml", ".ruff.toml", ".git")]],

View File

@ -77,6 +77,12 @@ return {
serverStatusNotification = true,
},
},
before_init = function(init_params, config)
-- See https://github.com/rust-lang/rust-analyzer/blob/eb5da56d839ae0a9e9f50774fa3eb78eb0964550/docs/dev/lsp-extensions.md?plain=1#L26
if config.settings and config.settings['rust-analyzer'] then
init_params.initializationOptions = config.settings['rust-analyzer']
end
end,
},
commands = {
CargoReload = {
@ -105,6 +111,9 @@ require'lspconfig'.rust_analyzer.setup{
}
}
```
Note: do not set `init_options` for this LS config, it will be automatically populated by the contents of settings["rust-analyzer"] per
https://github.com/rust-lang/rust-analyzer/blob/eb5da56d839ae0a9e9f50774fa3eb78eb0964550/docs/dev/lsp-extensions.md?plain=1#L26.
]],
default_config = {
root_dir = [[root_pattern("Cargo.toml", "rust-project.json")]],

View File

@ -26,10 +26,6 @@ https://shopify.dev/docs/api/shopify-cli
`shopify` can be installed via npm `npm install -g @shopify/cli`.
```lua
require lspconfig.shopify_theme_ls.setup {}
```
Note: This LSP already includes Theme Check so you don't need to use the `theme_check` server configuration as well.
]],
},

View File

@ -25,8 +25,7 @@ return {
'handlebars',
'hbs',
'html',
-- 'HTML (Eex)',
-- 'HTML (EEx)',
'htmlangular',
'html-eex',
'heex',
'jade',
@ -61,13 +60,6 @@ return {
'svelte',
'templ',
},
init_options = {
userLanguages = {
eelixir = 'html-eex',
eruby = 'erb',
templ = 'html',
},
},
settings = {
tailwindCSS = {
validate = true,
@ -87,6 +79,12 @@ return {
'classList',
'ngClass',
},
includeLanguages = {
eelixir = 'html-eex',
eruby = 'erb',
templ = 'html',
htmlangular = 'html',
},
},
},
on_new_config = function(new_config)

View File

@ -27,10 +27,13 @@ local function buf_build(bufnr)
if err then
error(tostring(err))
end
print('Build ' .. texlab_build_status[result.status])
vim.notify('Build ' .. texlab_build_status[result.status], vim.log.levels.INFO)
end, bufnr)
else
print 'method textDocument/build is not supported by any servers active on the current buffer'
vim.notify(
'method textDocument/build is not supported by any servers active on the current buffer',
vim.log.levels.WARN
)
end
end
@ -47,13 +50,108 @@ local function buf_search(bufnr)
if err then
error(tostring(err))
end
print('Search ' .. texlab_forward_status[result.status])
vim.notify('Search ' .. texlab_forward_status[result.status], vim.log.levels.INFO)
end, bufnr)
else
print 'method textDocument/forwardSearch is not supported by any servers active on the current buffer'
vim.notify(
'method textDocument/forwardSearch is not supported by any servers active on the current buffer',
vim.log.levels.WARN
)
end
end
local function buf_cancel_build(bufnr)
bufnr = util.validate_bufnr(bufnr)
if not util.get_active_client_by_name(bufnr, 'texlab') then
return vim.notify('Texlab client not found', vim.log.levels.ERROR)
end
vim.lsp.buf.execute_command { command = 'texlab.cancelBuild' }
vim.notify('Build cancelled', vim.log.levels.INFO)
end
local function dependency_graph(bufnr)
bufnr = util.validate_bufnr(bufnr)
local texlab_client = util.get_active_client_by_name(bufnr, 'texlab')
if not texlab_client then
return vim.notify('Texlab client not found', vim.log.levels.ERROR)
end
texlab_client.request('workspace/executeCommand', { command = 'texlab.showDependencyGraph' }, function(err, result)
if err then
return vim.notify(err.code .. ': ' .. err.message, vim.log.levels.ERROR)
end
vim.notify('The dependency graph has been generated:\n' .. result, vim.log.levels.INFO)
end, 0)
end
local function cleanArtifacts(bufnr)
bufnr = util.validate_bufnr(bufnr)
if not util.get_active_client_by_name(bufnr, 'texlab') then
return vim.notify('Texlab client not found', vim.log.levels.ERROR)
end
vim.lsp.buf.execute_command {
command = 'texlab.cleanArtifacts',
arguments = { { uri = vim.uri_from_bufnr(bufnr) } },
}
vim.notify('Artifacts cleaned successfully', vim.log.levels.INFO)
end
local function cleanAuxiliary(bufnr)
bufnr = util.validate_bufnr(bufnr)
if not util.get_active_client_by_name(bufnr, 'texlab') then
return vim.notify('Texlab client not found', vim.log.levels.ERROR)
end
vim.lsp.buf.execute_command {
command = 'texlab.cleanAuxiliary',
arguments = { { uri = vim.uri_from_bufnr(bufnr) } },
}
vim.notify('Auxiliary files cleaned successfully', vim.log.levels.INFO)
end
local function buf_find_envs(bufnr)
bufnr = util.validate_bufnr(bufnr)
local texlab_client = util.get_active_client_by_name(bufnr, 'texlab')
if not texlab_client then
return vim.notify('Texlab client not found', vim.log.levels.ERROR)
end
local pos = vim.api.nvim_win_get_cursor(0)
texlab_client.request('workspace/executeCommand', {
command = 'texlab.findEnvironments',
arguments = {
{
textDocument = { uri = vim.uri_from_bufnr(bufnr) },
position = { line = pos[1] - 1, character = pos[2] },
},
},
}, function(err, result)
if err then
return vim.notify(err.code .. ': ' .. err.message, vim.log.levels.ERROR)
end
return vim.notify('The environments are:\n' .. vim.inspect(result), vim.log.levels.INFO)
end, bufnr)
end
local function buf_change_env(bufnr)
bufnr = util.validate_bufnr(bufnr)
if not util.get_active_client_by_name(bufnr, 'texlab') then
return vim.notify('Texlab client not found', vim.log.levels.ERROR)
end
local new = vim.fn.input 'Enter the new environment name: '
if not new or new == '' then
return vim.notify('No environment name provided', vim.log.levels.WARN)
end
local pos = vim.api.nvim_win_get_cursor(0)
vim.lsp.buf.execute_command {
command = 'texlab.changeEnvironment',
arguments = {
{
textDocument = { uri = vim.uri_from_bufnr(bufnr) },
position = { line = pos[1] - 1, character = pos[2] },
newName = tostring(new),
},
},
}
end
-- bufnr isn't actually required here, but we need a valid buffer in order to
-- be able to find the client for buf_request.
-- TODO find a client by looking through buffers for a valid client?
@ -114,6 +212,42 @@ return {
end,
description = 'Forward search from current position',
},
TexlabCancelBuild = {
function()
buf_cancel_build(0)
end,
description = 'Cancel the current build',
},
TexlabDependencyGraph = {
function()
dependency_graph(0)
end,
description = 'Show the dependency graph',
},
TexlabCleanArtifacts = {
function()
cleanArtifacts(0)
end,
description = 'Clean the artifacts',
},
TexlabCleanAuxiliary = {
function()
cleanAuxiliary(0)
end,
description = 'Clean the auxiliary files',
},
TexlabFindEnvironments = {
function()
buf_find_envs(0)
end,
description = 'Find the environments at current position',
},
TexlabChangeEnvironment = {
function()
buf_change_env(0)
end,
description = 'Change the environment at current position',
},
},
docs = {
description = [[

View File

@ -88,10 +88,12 @@ end
function M.create_module_commands(module_name, commands)
for command_name, def in pairs(commands) do
local opts = M._parse_user_command_options(def)
api.nvim_create_user_command(command_name, function(info)
require('lspconfig')[module_name].commands[command_name][1](unpack(info.fargs))
end, opts)
if type(def) ~= 'function' then
local opts = M._parse_user_command_options(def)
api.nvim_create_user_command(command_name, function(info)
require('lspconfig')[module_name].commands[command_name][1](unpack(info.fargs))
end, opts)
end
end
end