Skip to content

fix(configs): remove utils in config with globs as markers #3711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 26 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6547e74
feat(ada_ls): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
019f5e4
feat(agda_ls): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
b4785e0
feat(arduino_language_server): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
dfdbec8
feat(autotools_ls): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
119f95a
feat(csharp_ls): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
8119222
feat(fsautocomplete): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
4f26da5
feat(fsharp_language_server): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
e3fbe13
feat(gitlab_ci_ls): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
be09d18
feat(graphql): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
de9b3c0
feat(hls): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
f9b68fb
feat(idris2_lsp): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
36cde3d
feat(msbuild_project_tools_server): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
d70a049
feat(nim_langserver): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
994d433
feat(nimls): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
67c47cf
feat(nomad_lsp): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
c897967
feat(ocamlls): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
41168c6
feat(ocamllsp): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
9c4e003
feat(ols): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
94e047b
feat(pasls): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
790d6a0
feat(pico8_ls): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
d80a86c
feat(regal): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
a0185e9
feat(regols): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
a7303d0
feat(solc): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
c8bede6
feat(sourcekit): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
b426bc3
feat(stylelint_lsp): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
b01d198
feat(unison): do not use `lspconfig.util`
TheRealLorenz Apr 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions lsp/ada_ls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@
--- })
--- ```

local util = require 'lspconfig.util'

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))
on_dir(vim.fs.root(bufnr, function(name, _)
local patterns = { 'Makefile', '.git', 'alire.toml', '*.gpr', '*.adc' }
for _, pattern in ipairs(patterns) do
if vim.glob.to_lpeg(pattern):match(name) ~= nil then
return true
end
end
return false
end))
end,
}
13 changes: 9 additions & 4 deletions lsp/agda_ls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@
---
--- Language Server for Agda.

local util = require 'lspconfig.util'

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))
on_dir(vim.fs.root(bufnr, function(name, _)
local patterns = { '.git', '*.agda-lib' }
for _, pattern in ipairs(patterns) do
if vim.glob.to_lpeg(pattern):match(name) ~= nil then
return true
end
end
return false
end))
end,
}
7 changes: 3 additions & 4 deletions lsp/arduino_language_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,12 @@
--- 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'

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))
on_dir(vim.fs.root(bufnr, function(name, _)
return vim.glob.to_lpeg('*.ino'):match(name) ~= nil
end))
end,
cmd = {
'arduino-language-server',
Expand Down
12 changes: 8 additions & 4 deletions lsp/autotools_ls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@
---
--- 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' }

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))
on_dir(vim.fs.root(bufnr, function(name, _)
for _, pattern in ipairs(root_files) do
if vim.glob.to_lpeg(pattern):match(name) ~= nil then
return true
end
end
return false
end))
end,
}
13 changes: 9 additions & 4 deletions lsp/csharp_ls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@
---
--- The preferred way to install csharp-ls is with `dotnet tool install --global csharp-ls`.

local util = require 'lspconfig.util'

return {
cmd = { 'csharp-ls' },
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 '*.csproj'(fname))
on_dir(vim.fs.root(bufnr, function(name, _)
local patterns = { '*.sln', '*.csproj' }
for _, pattern in ipairs(patterns) do
if vim.glob.to_lpeg(pattern):match(name) ~= nil then
return true
end
end
return false
end))
end,
filetypes = { 'cs' },
init_options = {
Expand Down
13 changes: 9 additions & 4 deletions lsp/fsautocomplete.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@
--- This is automatically done by plugins such as [PhilT/vim-fsharp](https://github.com/PhilT/vim-fsharp), [fsharp/vim-fsharp](https://github.com/fsharp/vim-fsharp), and [adelarsq/neofsharp.vim](https://github.com/adelarsq/neofsharp.vim).
---

local util = require 'lspconfig.util'

return {
cmd = { 'fsautocomplete', '--adaptive-lsp-server-enabled' },
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
on_dir(util.root_pattern('*.sln', '*.fsproj', '.git')(fname))
on_dir(vim.fs.root(bufnr, function(name, _)
local patterns = { '*.sln', '*.fsproj', '.git' }
for _, pattern in ipairs(patterns) do
if vim.glob.to_lpeg(pattern):match(name) ~= nil then
return true
end
end
return false
end))
end,
filetypes = { 'fsharp' },
init_options = {
Expand Down
13 changes: 9 additions & 4 deletions lsp/fsharp_language_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@
---
--- `autocmd BufNewFile,BufRead *.fs,*.fsx,*.fsi set filetype=fsharp`

local util = require 'lspconfig.util'

return {
cmd = { 'dotnet', 'FSharpLanguageServer.dll' },
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
on_dir(util.root_pattern('*.sln', '*.fsproj', '.git')(fname))
on_dir(vim.fs.root(bufnr, function(name, _)
local patterns = { '*.sln', '*.fsproj', '.git' }
for _, pattern in ipairs(patterns) do
if vim.glob.to_lpeg(pattern):match(name) ~= nil then
return true
end
end
return false
end))
end,
filetypes = { 'fsharp' },
init_options = {
Expand Down
13 changes: 9 additions & 4 deletions lsp/gitlab_ci_ls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,21 @@
--- `gitlab-ci-ls` can be installed via cargo:
--- cargo install gitlab-ci-ls

local util = require 'lspconfig.util'

local cache_dir = vim.uv.os_homedir() .. '/.cache/gitlab-ci-ls/'

return {
cmd = { 'gitlab-ci-ls' },
filetypes = { 'yaml.gitlab' },
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
on_dir(util.root_pattern('.gitlab*', '.git')(fname))
on_dir(vim.fs.root(bufnr, function(name, _)
local patterns = { '.gitlab*', '.git' }
for _, pattern in ipairs(patterns) do
if vim.glob.to_lpeg(pattern):match(name) ~= nil then
return true
end
end
return false
end))
end,
init_options = {
cache_path = cache_dir,
Expand Down
13 changes: 9 additions & 4 deletions lsp/graphql.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@
---
--- Note that you must also have [the graphql package](https://github.com/graphql/graphql-js) installed within your project and create a [GraphQL config file](https://the-guild.dev/graphql/config/docs).

local util = require 'lspconfig.util'

return {
cmd = { 'graphql-lsp', 'server', '-m', 'stream' },
filetypes = { 'graphql', 'typescriptreact', 'javascriptreact' },
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
on_dir(util.root_pattern('.graphqlrc*', '.graphql.config.*', 'graphql.config.*')(fname))
on_dir(vim.fs.root(bufnr, function(name, _)
local patterns = { '.graphqlrc*', '.graphql.config.*', 'graphql.config.*' }
for _, pattern in ipairs(patterns) do
if vim.glob.to_lpeg(pattern):match(name) ~= nil then
return true
end
end
return false
end))
end,
}
13 changes: 9 additions & 4 deletions lsp/hls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@
--- })
--- ```

local util = require 'lspconfig.util'

return {
cmd = { 'haskell-language-server-wrapper', '--lsp' },
filetypes = { 'haskell', 'lhaskell' },
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
on_dir(util.root_pattern('hie.yaml', 'stack.yaml', 'cabal.project', '*.cabal', 'package.yaml')(fname))
on_dir(vim.fs.root(bufnr, function(name, _)
local patterns = { 'hie.yaml', 'stack.yaml', 'cabal.project', '*.cabal', 'package.yaml' }
for _, pattern in ipairs(patterns) do
if vim.glob.to_lpeg(pattern):match(name) ~= nil then
return true
end
end
return false
end))
end,
settings = {
haskell = {
Expand Down
7 changes: 3 additions & 4 deletions lsp/idris2_lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@
--- latest commit on the `master` branch, and set a reminder to check the Idris2-Lsp
--- repo for the release of a compatible versioned branch.

local util = require 'lspconfig.util'

return {
cmd = { 'idris2-lsp' },
filetypes = { 'idris2' },
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
on_dir(util.root_pattern '*.ipkg'(fname))
on_dir(vim.fs.root(bufnr, function(name, _)
return vim.glob.to_lpeg('*.ipkg'):match(name) ~= nil
end))
end,
}
12 changes: 9 additions & 3 deletions lsp/msbuild_project_tools_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@
--- ```

local host_dll_name = 'MSBuildProjectTools.LanguageServer.Host.dll'
local util = require 'lspconfig.util'

return {
filetypes = { 'msbuild' },
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
on_dir(util.root_pattern('*.sln', '*.slnx', '*.*proj', '.git')(fname))
on_dir(vim.fs.root(bufnr, function(name, _)
local patterns = { '*.sln', '*.slnx', '*.*proj', '.git' }
for _, pattern in ipairs(patterns) do
if vim.glob.to_lpeg(pattern):match(name) ~= nil then
return true
end
end
return false
end))
end,
init_options = {},
cmd = { 'dotnet', host_dll_name },
Expand Down
15 changes: 9 additions & 6 deletions lsp/nim_langserver.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
--- nimble install nimlangserver
--- ```

local util = require 'lspconfig.util'

return {
cmd = { 'nimlangserver' },
filetypes = { 'nim' },
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
on_dir(
util.root_pattern '*.nimble'(fname) or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1])
)
on_dir(vim.fs.root(bufnr, function(name, _)
local patterns = { '*.nimble', '.git' }
for _, pattern in ipairs(patterns) do
if vim.glob.to_lpeg(pattern):match(name) ~= nil then
return true
end
end
return false
end))
end,
}
15 changes: 9 additions & 6 deletions lsp/nimls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
--- nimble install nimlsp
--- ```

local util = require 'lspconfig.util'

return {
cmd = { 'nimlsp' },
filetypes = { 'nim' },
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
on_dir(
util.root_pattern '*.nimble'(fname) or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1])
)
on_dir(vim.fs.root(bufnr, function(name, _)
local patterns = { '*.nimble', '.git' }
for _, pattern in ipairs(patterns) do
if vim.glob.to_lpeg(pattern):match(name) ~= nil then
return true
end
end
return false
end))
end,
}
6 changes: 3 additions & 3 deletions lsp/nomad_lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
---
--- Description of your jobs should be written in `.nomad` files for the LSP client to configure the server's `root_dir` configuration option.

local util = require 'lspconfig.util'
local bin_name = 'nomad-lsp'

if vim.fn.has 'win32' == 1 then
Expand All @@ -27,7 +26,8 @@ return {
cmd = { bin_name },
filetypes = { 'hcl.nomad', 'nomad' },
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
on_dir(util.root_pattern '*.nomad'(fname))
on_dir(vim.fs.root(bufnr, function(name, _)
return vim.glob.to_lpeg('*.nomad'):match(name) ~= nil
end))
end,
}
13 changes: 9 additions & 4 deletions lsp/ocamlls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@
--- npm install -g ocaml-language-server
--- ```

local util = require 'lspconfig.util'

return {
cmd = { 'ocaml-language-server', '--stdio' },
filetypes = { 'ocaml', 'reason' },
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
on_dir(util.root_pattern('*.opam', 'esy.json', 'package.json')(fname))
on_dir(vim.fs.root(bufnr, function(name, _)
local patterns = { '*.opam', 'esy.json', 'package.json' }
for _, pattern in ipairs(patterns) do
if vim.glob.to_lpeg(pattern):match(name) ~= nil then
return true
end
end
return false
end))
end,
}
13 changes: 9 additions & 4 deletions lsp/ocamllsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
--- opam install ocaml-lsp-server
--- ```

local util = require 'lspconfig.util'

local language_id_of = {
menhir = 'ocaml.menhir',
ocaml = 'ocaml',
Expand All @@ -28,8 +26,15 @@ return {
cmd = { 'ocamllsp' },
filetypes = { 'ocaml', 'menhir', 'ocamlinterface', 'ocamllex', 'reason', 'dune' },
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
on_dir(util.root_pattern('*.opam', 'esy.json', 'package.json', '.git', 'dune-project', 'dune-workspace')(fname))
on_dir(vim.fs.root(bufnr, function(name, _)
local patterns = { '*.opam', 'esy.json', 'package.json', '.git', 'dune-project', 'dune-workspace' }
for _, pattern in ipairs(patterns) do
if vim.glob.to_lpeg(pattern):match(name) ~= nil then
return true
end
end
return false
end))
end,
get_language_id = get_language_id,
}
Loading
Loading