Skip to content

Commit

Permalink
fix: fix importing server config definitions from lspconfig (#468)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter authored Oct 22, 2024
1 parent b950110 commit 87638e7
Show file tree
Hide file tree
Showing 8 changed files with 529 additions and 534 deletions.
569 changes: 284 additions & 285 deletions README.md

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion doc/mason-lspconfig-mapping.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
SERVER MAPPINGS *mason-lspconfig-server-map*

`Mason name` `lspconfig name`
ada-language-server als
angular-language-server angularls
ansible-language-server ansiblels
antlers-language-server antlersls
Expand Down
437 changes: 218 additions & 219 deletions doc/server-mapping.md

Large diffs are not rendered by default.

43 changes: 21 additions & 22 deletions lua/mason-lspconfig/mappings/filetype.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ return {
["BUILD.bazel"] = { "starlark_rust" },
OpenFOAM = { "foam_ls" },
PKGBUILD = { "pkgbuild_language_server" },
ada = { "als" },
antlers = { "antlersls" },
apexcode = { "apex_ls" },
arduino = { "arduino_language_server" },
asm = { "asm_lsp" },
aspnetcorerazor = { "htmx", "tailwindcss" },
astro = { "astro", "biome", "emmet_ls", "eslint", "htmx", "tailwindcss" },
astro = { "astro", "biome", "emmet_ls", "eslint", "htmx", "tailwindcss", "unocss" },
["astro-markdown"] = { "htmx", "tailwindcss" },
automake = { "autotools_ls" },
awk = { "awk_ls" },
Expand All @@ -35,9 +34,8 @@ return {
coq = { "coq_lsp" },
cpp = { "ast_grep", "clangd", "harper_ls" },
crystal = { "crystalline" },
cs = { "csharp_ls", "omnisharp", "omnisharp_mono" },
csharp = { "harper_ls" },
css = { "ast_grep", "biome", "css_variables", "cssls", "emmet_language_server", "emmet_ls", "stylelint_lsp", "tailwindcss" },
cs = { "csharp_ls", "harper_ls", "omnisharp", "omnisharp_mono" },
css = { "ast_grep", "biome", "css_variables", "cssls", "emmet_language_server", "emmet_ls", "stylelint_lsp", "tailwindcss", "unocss" },
cucumber = { "cucumber_language_server" },
cuda = { "clangd" },
cue = { "dagger" },
Expand All @@ -54,10 +52,10 @@ return {
edge = { "htmx", "tailwindcss" },
edn = { "clojure_lsp" },
eelixir = { "elixirls", "htmx", "lexical", "nextls", "tailwindcss" },
ejs = { "htmx", "tailwindcss" },
ejs = { "htmx", "tailwindcss", "unocss" },
elixir = { "elixirls", "htmx", "lexical", "nextls", "tailwindcss" },
elm = { "elmls" },
erb = { "htmx", "tailwindcss" },
erb = { "htmx", "tailwindcss", "unocss" },
erg = { "erg_language_server" },
erlang = { "elp", "erlangls" },
eruby = { "emmet_language_server", "emmet_ls", "htmx", "steep", "stimulus_ls", "tailwindcss" },
Expand All @@ -78,13 +76,13 @@ return {
gomod = { "golangci_lint_ls", "gopls", "snyk_ls" },
gotmpl = { "gopls" },
gowork = { "gopls" },
graphql = { "graphql" },
graphql = { "biome", "graphql" },
groovy = { "gradle_ls", "groovyls" },
haml = { "htmx", "tailwindcss" },
haml = { "htmx", "tailwindcss", "unocss" },
handlebars = { "ember", "glint", "htmx", "tailwindcss" },
haskell = { "hls" },
haxe = { "haxe_language_server" },
hbs = { "htmx", "tailwindcss" },
hbs = { "htmx", "tailwindcss", "unocss" },
heex = { "elixirls", "htmx", "lexical", "nextls", "tailwindcss" },
helm = { "helm_ls", "snyk_ls" },
hoon = { "hoon_ls" },
Expand All @@ -96,10 +94,10 @@ return {
hyprlang = { "hyprls" },
jade = { "htmx", "tailwindcss" },
java = { "ast_grep", "harper_ls", "java_language_server", "jdtls" },
javascript = { "ast_grep", "biome", "cssmodules_ls", "denols", "dprint", "ember", "eslint", "glint", "harper_ls", "htmx", "lwc_ls", "quick_lint_js", "rome", "snyk_ls", "sourcery", "stylelint_lsp", "tailwindcss", "ts_ls", "vtsls" },
javascript = { "ast_grep", "biome", "cssmodules_ls", "denols", "dprint", "ember", "eslint", "glint", "harper_ls", "htmx", "lwc_ls", "quick_lint_js", "rome", "snyk_ls", "sourcery", "tailwindcss", "ts_ls", "unocss", "vtsls" },
["javascript.glimmer"] = { "ember", "glint" },
["javascript.jsx"] = { "denols", "eslint", "ts_ls", "vtsls" },
javascriptreact = { "biome", "cssmodules_ls", "denols", "dprint", "emmet_language_server", "emmet_ls", "eslint", "graphql", "htmx", "rome", "sourcery", "stylelint_lsp", "tailwindcss", "ts_ls", "unocss", "vtsls" },
javascriptreact = { "biome", "cssmodules_ls", "denols", "dprint", "emmet_language_server", "emmet_ls", "eslint", "graphql", "htmx", "rome", "sourcery", "tailwindcss", "ts_ls", "unocss", "vtsls" },
jinja = { "jinja_lsp" },
jq = { "jqls" },
json = { "biome", "dprint", "jsonls", "rome", "snyk_ls", "spectral" },
Expand All @@ -109,7 +107,7 @@ return {
julia = { "julials" },
kotlin = { "ast_grep", "kotlin_language_server" },
leaf = { "htmx", "tailwindcss" },
less = { "css_variables", "cssls", "emmet_language_server", "emmet_ls", "stylelint_lsp", "tailwindcss" },
less = { "css_variables", "cssls", "emmet_language_server", "emmet_ls", "stylelint_lsp", "tailwindcss", "unocss" },
lhaskell = { "hls" },
libsonnet = { "jsonnet_ls" },
liquid = { "htmx", "shopify_theme_ls", "tailwindcss", "theme_check" },
Expand All @@ -118,7 +116,7 @@ return {
luau = { "luau_lsp" },
mail = { "ltex" },
make = { "autotools_ls" },
markdown = { "dprint", "grammarly", "harper_ls", "htmx", "ltex", "markdown_oxide", "marksman", "prosemd_lsp", "remark_ls", "tailwindcss", "vale_ls", "zk" },
markdown = { "dprint", "grammarly", "harper_ls", "htmx", "ltex", "markdown_oxide", "marksman", "prosemd_lsp", "remark_ls", "tailwindcss", "unocss", "vale_ls", "zk" },
["markdown.mdx"] = { "marksman", "mdx_analyzer" },
matlab = { "matlab_ls" },
mdx = { "htmx", "tailwindcss" },
Expand Down Expand Up @@ -152,9 +150,9 @@ return {
pandoc = { "ltex" },
perl = { "perlnavigator" },
pest = { "pest_ls" },
php = { "htmx", "intelephense", "phpactor", "psalm", "stimulus_ls", "tailwindcss" },
php = { "htmx", "intelephense", "phpactor", "psalm", "stimulus_ls", "tailwindcss", "unocss" },
plaintex = { "ltex", "texlab" },
postcss = { "tailwindcss" },
postcss = { "tailwindcss", "unocss" },
prisma = { "prismals" },
proto = { "bufls", "clangd", "pbls" },
ps1 = { "powershell_es" },
Expand All @@ -177,9 +175,9 @@ return {
roslyn = { "dprint" },
rst = { "esbonio", "ltex" },
ruby = { "harper_ls", "rubocop", "ruby_lsp", "solargraph", "sorbet", "standardrb", "steep", "stimulus_ls" },
rust = { "ast_grep", "dprint", "harper_ls", "rust_analyzer" },
sass = { "emmet_language_server", "emmet_ls", "somesass_ls", "tailwindcss" },
scss = { "css_variables", "cssls", "emmet_language_server", "emmet_ls", "somesass_ls", "stylelint_lsp", "tailwindcss" },
rust = { "ast_grep", "dprint", "harper_ls", "rust_analyzer", "unocss" },
sass = { "emmet_language_server", "emmet_ls", "somesass_ls", "tailwindcss", "unocss" },
scss = { "css_variables", "cssls", "emmet_language_server", "emmet_ls", "somesass_ls", "stylelint_lsp", "tailwindcss", "unocss" },
sh = { "bashls" },
slim = { "htmx", "tailwindcss" },
slint = { "slint_lsp" },
Expand All @@ -190,7 +188,7 @@ return {
sql = { "sqlls", "sqls" },
ss = { "snakeskin_ls" },
star = { "starlark_rust" },
stylus = { "tailwindcss" },
stylus = { "tailwindcss", "unocss" },
sugarss = { "stylelint_lsp", "tailwindcss" },
surface = { "elixirls", "lexical", "nextls" },
svelte = { "biome", "emmet_ls", "eslint", "htmx", "svelte", "tailwindcss", "unocss" },
Expand All @@ -208,10 +206,10 @@ return {
thrift = { "thriftls" },
toml = { "dprint", "harper_ls", "taplo" },
twig = { "htmx", "tailwindcss", "twiggy_language_server" },
typescript = { "angularls", "ast_grep", "biome", "cssmodules_ls", "denols", "dprint", "ember", "eslint", "glint", "harper_ls", "htmx", "quick_lint_js", "rome", "snyk_ls", "sourcery", "stylelint_lsp", "tailwindcss", "ts_ls", "vtsls" },
typescript = { "angularls", "ast_grep", "biome", "cssmodules_ls", "denols", "dprint", "ember", "eslint", "glint", "harper_ls", "htmx", "quick_lint_js", "rome", "snyk_ls", "sourcery", "tailwindcss", "ts_ls", "unocss", "vtsls" },
["typescript.glimmer"] = { "ember", "glint" },
["typescript.tsx"] = { "angularls", "biome", "denols", "eslint", "rome", "ts_ls", "vtsls" },
typescriptreact = { "angularls", "biome", "cssmodules_ls", "denols", "dprint", "emmet_language_server", "emmet_ls", "eslint", "graphql", "harper_ls", "htmx", "rome", "sourcery", "stylelint_lsp", "tailwindcss", "ts_ls", "unocss", "vtsls" },
typescriptreact = { "angularls", "biome", "cssmodules_ls", "denols", "dprint", "emmet_language_server", "emmet_ls", "eslint", "graphql", "harper_ls", "htmx", "rome", "sourcery", "tailwindcss", "ts_ls", "unocss", "vtsls" },
typespec = { "tsp_server" },
typst = { "tinymist", "typst_lsp" },
v = { "v_analyzer", "vls" },
Expand All @@ -228,6 +226,7 @@ return {
vmasm = { "asm_lsp" },
vsh = { "v_analyzer" },
vue = { "biome", "emmet_ls", "eslint", "htmx", "stylelint_lsp", "tailwindcss", "unocss", "volar", "vuels" },
["vue-html"] = { "unocss" },
vv = { "v_analyzer" },
wgsl = { "wgsl_analyzer" },
wxss = { "stylelint_lsp" },
Expand Down
1 change: 0 additions & 1 deletion lua/mason-lspconfig/mappings/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local M = {}

---Maps lspconfig server config name to its corresponding package name.
M.lspconfig_to_package = {
["als"] = "ada-language-server",
["angularls"] = "angular-language-server",
["ansiblels"] = "ansible-language-server",
["antlersls"] = "antlers-language-server",
Expand Down
2 changes: 1 addition & 1 deletion lua/mason-lspconfig/server_config_extensions.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
return function()
local configs = require "lspconfig.configs"

configs.omnisharp_mono = require "lspconfig.server_configurations.omnisharp"
configs.omnisharp_mono = require "lspconfig.configs.omnisharp"
end
5 changes: 2 additions & 3 deletions scripts/lua/mason-scripts/mason-lspconfig/generate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,13 @@ local function ensure_valid_package_name_translations()
end
end

local get_lspconfig_url =
_.format "https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#%s"
local get_lspconfig_url = _.format "https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md#%s"

local get_server_mappings = _.compose(
_.filter_map(function(pair)
local lspconfig_name, mason_name =
assert(pair[1], "missing lspconfig name"), assert(pair[2], "missing mason name")
if not pcall(require, ("lspconfig.server_configurations.%s"):format(lspconfig_name)) then
if not pcall(require, "lspconfig.configs." .. lspconfig_name) then
return Optional.empty()
end
local mason_url = ("https://mason-registry.dev/registry/list#%s"):format(mason_name)
Expand Down
5 changes: 3 additions & 2 deletions tests/helpers/lua/luassertx.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local a = require "mason-core.async"
local assert = require "luassert"
local match = require "luassert.match"
local uv = vim.uv or vim.loop

local function wait_for(_, arguments)
---@type (fun()): Function to execute until it does not error.
Expand All @@ -9,14 +10,14 @@ local function wait_for(_, arguments)
local timeout = arguments[2]
timeout = timeout or 15000

local start = vim.loop.hrtime()
local start = uv.hrtime()
local is_ok, err
repeat
is_ok, err = pcall(assertions_fn)
if not is_ok then
a.sleep(math.min(timeout, 100))
end
until is_ok or ((vim.loop.hrtime() - start) / 1e6) > timeout
until is_ok or ((uv.hrtime() - start) / 1e6) > timeout

if not is_ok then
error(err)
Expand Down

0 comments on commit 87638e7

Please sign in to comment.