Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into add-pbls
Browse files Browse the repository at this point in the history
* origin/main:
  feat: add textlsp (williamboman#433)
  feat: add hyprls (williamboman#428)
  feat: Add regal lsp support (OPA rego linter) (williamboman#426)
  tests: add nvim v0.10.1 and v0.10.1 to test matrix (williamboman#446)
  docs: auto-generate available LSP servers list in readme (williamboman#445)
  feat: add steep configuration (williamboman#422)
  chore: update generated code (williamboman#441)
  chore: update generated code (williamboman#439)
  • Loading branch information
williamboman committed Aug 4, 2024
2 parents 28a747a + 9ac210a commit bb6ed06
Show file tree
Hide file tree
Showing 10 changed files with 416 additions and 237 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/autogenerate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: v0.9.0
version: v0.10.1

- name: make generate
run: make generate
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-generated-code-state.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: v0.9.0
version: v0.10.1

- name: make generate
run: make generate
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stylua.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
# CLI arguments
args: --check .
version: 0.18.0
version: 0.20.0
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
- v0.9.2
- v0.9.4
- v0.9.5
- v0.10.0
- v0.10.1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
500 changes: 281 additions & 219 deletions README.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions doc/mason-lspconfig-mapping.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ hoon-language-server hoon_ls
html-lsp html
htmx-lsp htmx
hydra-lsp hydra_lsp
hyprls hyprls
intelephense intelephense
java-language-server java_language_server
jdtls jdtls
Expand Down Expand Up @@ -146,6 +147,7 @@ quick-lint-js quick_lint_js
r-languageserver r_language_server
raku-navigator raku_navigator
reason-language-server reason_ls
regal regal
regols regols
remark-language-server remark_ls
rescript-language-server rescriptls
Expand Down Expand Up @@ -177,6 +179,7 @@ sqlls sqlls
sqls sqls
standardrb standardrb
starlark-rust starlark_rust
steep steep
stimulus-language-server stimulus_ls
stylelint-lsp stylelint_lsp
svelte-language-server svelte
Expand All @@ -189,6 +192,7 @@ teal-language-server teal_ls
templ templ
terraform-ls terraformls
texlab texlab
textlsp textlsp
tflint tflint
shopify-theme-check theme_check
thriftls thriftls
Expand Down
4 changes: 4 additions & 0 deletions doc/server-mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
| [html](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#html) | [html-lsp](https://mason-registry.dev/registry/list#html-lsp) |
| [htmx](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#htmx) | [htmx-lsp](https://mason-registry.dev/registry/list#htmx-lsp) |
| [hydra_lsp](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#hydra_lsp) | [hydra-lsp](https://mason-registry.dev/registry/list#hydra-lsp) |
| [hyprls](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#hyprls) | [hyprls](https://mason-registry.dev/registry/list#hyprls) |
| [intelephense](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#intelephense) | [intelephense](https://mason-registry.dev/registry/list#intelephense) |
| [java_language_server](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#java_language_server) | [java-language-server](https://mason-registry.dev/registry/list#java-language-server) |
| [jdtls](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#jdtls) | [jdtls](https://mason-registry.dev/registry/list#jdtls) |
Expand Down Expand Up @@ -143,6 +144,7 @@
| [r_language_server](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#r_language_server) | [r-languageserver](https://mason-registry.dev/registry/list#r-languageserver) |
| [raku_navigator](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#raku_navigator) | [raku-navigator](https://mason-registry.dev/registry/list#raku-navigator) |
| [reason_ls](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#reason_ls) | [reason-language-server](https://mason-registry.dev/registry/list#reason-language-server) |
| [regal](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#regal) | [regal](https://mason-registry.dev/registry/list#regal) |
| [regols](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#regols) | [regols](https://mason-registry.dev/registry/list#regols) |
| [remark_ls](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#remark_ls) | [remark-language-server](https://mason-registry.dev/registry/list#remark-language-server) |
| [rescriptls](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rescriptls) | [rescript-language-server](https://mason-registry.dev/registry/list#rescript-language-server) |
Expand Down Expand Up @@ -174,6 +176,7 @@
| [sqls](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#sqls) | [sqls](https://mason-registry.dev/registry/list#sqls) |
| [standardrb](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#standardrb) | [standardrb](https://mason-registry.dev/registry/list#standardrb) |
| [starlark_rust](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#starlark_rust) | [starlark-rust](https://mason-registry.dev/registry/list#starlark-rust) |
| [steep](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#steep) | [steep](https://mason-registry.dev/registry/list#steep) |
| [stimulus_ls](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#stimulus_ls) | [stimulus-language-server](https://mason-registry.dev/registry/list#stimulus-language-server) |
| [stylelint_lsp](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#stylelint_lsp) | [stylelint-lsp](https://mason-registry.dev/registry/list#stylelint-lsp) |
| [svelte](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#svelte) | [svelte-language-server](https://mason-registry.dev/registry/list#svelte-language-server) |
Expand All @@ -186,6 +189,7 @@
| [templ](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#templ) | [templ](https://mason-registry.dev/registry/list#templ) |
| [terraformls](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#terraformls) | [terraform-ls](https://mason-registry.dev/registry/list#terraform-ls) |
| [texlab](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#texlab) | [texlab](https://mason-registry.dev/registry/list#texlab) |
| [textlsp](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#textlsp) | [textlsp](https://mason-registry.dev/registry/list#textlsp) |
| [tflint](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#tflint) | [tflint](https://mason-registry.dev/registry/list#tflint) |
| [theme_check](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#theme_check) | [shopify-theme-check](https://mason-registry.dev/registry/list#shopify-theme-check) |
| [thriftls](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#thriftls) | [thriftls](https://mason-registry.dev/registry/list#thriftls) |
Expand Down
23 changes: 14 additions & 9 deletions lua/mason-lspconfig/mappings/filetype.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
-- stylua: ignore start
return {
["*"] = { "typos_lsp" },
["*.hl"] = { "hyprls" },
[".config/hypr/*.conf"] = { "hyprls" },
["BUILD.bazel"] = { "starlark_rust" },
OpenFOAM = { "foam_ls" },
PKGBUILD = { "pkgbuild_language_server" },
Expand Down Expand Up @@ -61,7 +63,7 @@ return {
erb = { "tailwindcss" },
erg = { "erg_language_server" },
erlang = { "elp", "erlangls" },
eruby = { "emmet_language_server", "emmet_ls", "stimulus_ls", "tailwindcss" },
eruby = { "emmet_language_server", "emmet_ls", "steep", "stimulus_ls", "tailwindcss" },
fennel = { "fennel_language_server", "fennel_ls" },
flux = { "flux_lsp" },
foam = { "foam_ls" },
Expand All @@ -71,7 +73,7 @@ return {
fsharp = { "fsautocomplete" },
genie = { "vala_ls" },
geom = { "glsl_analyzer", "glslls" },
gitcommit = { "ltex" },
gitcommit = { "harper_ls", "ltex" },
glsl = { "glsl_analyzer", "glslls" },
go = { "ast_grep", "golangci_lint_ls", "gopls", "harper_ls", "snyk_ls" },
gohtml = { "tailwindcss" },
Expand All @@ -89,12 +91,15 @@ return {
heex = { "elixirls", "lexical", "tailwindcss" },
helm = { "helm_ls", "snyk_ls" },
hoon = { "hoon_ls" },
html = { "angularls", "antlersls", "ast_grep", "emmet_language_server", "emmet_ls", "html", "htmx", "ltex", "lwc_ls", "stimulus_ls", "tailwindcss", "unocss" },
html = { "angularls", "antlersls", "ast_grep", "emmet_language_server", "emmet_ls", "harper_ls", "html", "htmx", "ltex", "lwc_ls", "stimulus_ls", "tailwindcss", "unocss" },
["html-eex"] = { "tailwindcss" },
["html.handlebars"] = { "glint" },
htmlangular = { "angularls", "emmet_language_server", "emmet_ls", "tailwindcss" },
htmldjango = { "emmet_language_server", "emmet_ls", "tailwindcss" },
["hypr*.conf"] = { "hyprls" },
hyprlang = { "hyprls" },
jade = { "tailwindcss" },
java = { "ast_grep", "java_language_server", "jdtls" },
java = { "ast_grep", "harper_ls", "java_language_server", "jdtls" },
javascript = { "ast_grep", "biome", "cssmodules_ls", "denols", "dprint", "ember", "eslint", "glint", "harper_ls", "lwc_ls", "quick_lint_js", "rome", "snyk_ls", "sourcery", "stylelint_lsp", "tailwindcss", "tsserver", "vtsls" },
["javascript.glimmer"] = { "ember", "glint" },
["javascript.jsx"] = { "denols", "eslint", "tsserver", "vtsls" },
Expand Down Expand Up @@ -145,7 +150,7 @@ return {
odin = { "ols" },
opencl = { "opencl_ls" },
openscad = { "openscad_lsp" },
org = { "ltex" },
org = { "ltex", "textlsp" },
os = { "bsl_ls" },
p8 = { "pico8_ls" },
pandoc = { "ltex" },
Expand All @@ -168,15 +173,15 @@ return {
raku = { "raku_navigator" },
razor = { "tailwindcss" },
reason = { "ocamllsp", "reason_ls", "tailwindcss" },
rego = { "regols" },
rego = { "regal", "regols" },
requirements = { "snyk_ls" },
rescript = { "rescriptls", "tailwindcss", "unocss" },
rmd = { "ltex", "r_language_server" },
rnoweb = { "ltex" },
robot = { "robotframework_ls" },
roslyn = { "dprint" },
rst = { "esbonio", "ltex" },
ruby = { "harper_ls", "rubocop", "ruby_lsp", "solargraph", "sorbet", "standardrb", "stimulus_ls" },
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" },
Expand All @@ -202,8 +207,8 @@ return {
["terraform-vars"] = { "snyk_ls", "terraformls" },
tesc = { "glsl_analyzer", "glslls" },
tese = { "glsl_analyzer", "glslls" },
tex = { "ltex", "texlab", "vale_ls" },
text = { "ltex", "vale_ls" },
tex = { "ltex", "texlab", "textlsp", "vale_ls" },
text = { "ltex", "textlsp", "vale_ls" },
thrift = { "thriftls" },
toml = { "dprint", "harper_ls", "taplo" },
twig = { "tailwindcss", "twiggy_language_server" },
Expand Down
4 changes: 4 additions & 0 deletions lua/mason-lspconfig/mappings/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ M.lspconfig_to_package = {
["html"] = "html-lsp",
["htmx"] = "htmx-lsp",
["hydra_lsp"] = "hydra-lsp",
["hyprls"] = "hyprls",
["intelephense"] = "intelephense",
["java_language_server"] = "java-language-server",
["jdtls"] = "jdtls",
Expand Down Expand Up @@ -147,6 +148,7 @@ M.lspconfig_to_package = {
["raku_navigator"] = "raku-navigator",
["reason_ls"] = "reason-language-server",
["regols"] = "regols",
["regal"] = "regal",
["remark_ls"] = "remark-language-server",
["rescriptls"] = "rescript-language-server",
["rnix"] = "rnix-lsp",
Expand Down Expand Up @@ -177,6 +179,7 @@ M.lspconfig_to_package = {
["sqls"] = "sqls",
["standardrb"] = "standardrb",
["starlark_rust"] = "starlark-rust",
["steep"] = "steep",
["stimulus_ls"] = "stimulus-language-server",
["stylelint_lsp"] = "stylelint-lsp",
["svelte"] = "svelte-language-server",
Expand All @@ -190,6 +193,7 @@ M.lspconfig_to_package = {
["templ"] = "templ",
["terraformls"] = "terraform-ls",
["texlab"] = "texlab",
["textlsp"] = "textlsp",
["tflint"] = "tflint",
["theme_check"] = "shopify-theme-check",
["thriftls"] = "thriftls",
Expand Down
110 changes: 104 additions & 6 deletions scripts/lua/mason-scripts/mason-lspconfig/generate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ local Optional = require "mason-core.optional"

local _ = require "mason-core.functional"
local a = require "mason-core.async"
local fs = require "mason-core.fs"
local lspconfig = require "lspconfig"
local lspconfig_server_mapping = require "mason-lspconfig.mappings.server"
local path = require "mason-core.path"
local script_utils = require "mason-scripts.utils"

local DOCS_DIR = path.concat { vim.loop.cwd(), "doc" }
local MASON_LSPCONFIG_DIR = path.concat { vim.loop.cwd(), "lua", "mason-lspconfig" }
local DOCS_DIR = "doc"
local MASON_LSPCONFIG_DIR = path.concat { "lua", "mason-lspconfig" }

require("mason").setup()
require("mason-registry").refresh()
Expand Down Expand Up @@ -50,21 +51,21 @@ 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_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
return Optional.empty()
end
local lspconfig_url = ("https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#%s"):format(
lspconfig_name
)
local mason_url = ("https://mason-registry.dev/registry/list#%s"):format(mason_name)
return Optional.of {
lspconfig_name = lspconfig_name,
mason_name = mason_name,
lspconfig_url = lspconfig_url,
lspconfig_url = get_lspconfig_url(lspconfig_name),
mason_url = mason_url,
}
end),
Expand Down Expand Up @@ -128,10 +129,107 @@ local function create_server_mapping_docs()
end
end

local find_index = _.curryN(function(predicate, list)
for i, item in ipairs(list) do
if predicate(item) then
return i
end
end
return -1
end, 2)

---@async
local function update_available_lsp_servers()
local readme_path = "README.md"
local readme_contents = fs.sync.read_file(readme_path)
local readme_lines = _.split("\n", readme_contents)

local start = find_index(_.equals "<!-- available-lsp-servers:start -->", readme_lines) + 1
local stop = find_index(_.equals "<!-- available-lsp-servers:end -->", readme_lines) - 1

for i = stop, start, -1 do
table.remove(readme_lines, i)
end

local server_mappings = require("mason-lspconfig.mappings.server").lspconfig_to_package
local registry = require "mason-registry"

---@type {languages: string[], name: string}[]
local servers = {}

for lspconfig_name, mason_name in pairs(server_mappings) do
local pkg = registry.get_package(mason_name)
table.insert(servers, {
languages = pkg.spec.languages,
name = lspconfig_name,
})
end

local servers_markdown_list = _.compose(
_.map(function(entry)
local server_docs = path.concat { MASON_LSPCONFIG_DIR, "server_configurations", entry.server, "README.md" }
if fs.sync.file_exists(server_docs) then
return ("| %s ([docs](%s)) | [`%s`](%s) |"):format(
entry.language,
server_docs,
entry.server,
get_lspconfig_url(entry.server)
)
else
return ("| %s | [`%s`](%s) |"):format(entry.language, entry.server, get_lspconfig_url(entry.server))
end
end),
_.sort_by(function(entry)
if entry.language == "-" then
-- brother eww
return "zzzz" .. (entry.language .. entry.server):lower()
else
return (entry.language .. entry.server):lower()
end
end),
function(tbl)
return vim.iter(tbl):flatten():totable()
end,
_.map(function(server)
if #server.languages == 0 then
return {
{
server = server.name,
language = "-",
},
}
else
return _.map(function(language)
return {
server = server.name,
language = language,
}
end, server.languages)
end
end)
)(servers)

for i = #servers_markdown_list, 1, -1 do
table.insert(readme_lines, start, servers_markdown_list[i])
end

for _, line in
ipairs(_.reverse {
"| Language | Server name |",
"| --- | --- |",
})
do
table.insert(readme_lines, start, line)
end

fs.sync.write_file(readme_path, _.join("\n", readme_lines))
end

a.run_blocking(function()
a.wait_all {
create_lspconfig_filetype_map,
ensure_valid_package_name_translations,
create_server_mapping_docs,
update_available_lsp_servers,
}
end)

0 comments on commit bb6ed06

Please sign in to comment.