diff options
| author | William Boman <william@redwill.se> | 2022-07-22 03:15:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-22 03:15:43 +0200 |
| commit | 11c0af44e69a165df41e5fe6681b47f4204d3623 (patch) | |
| tree | 28bc4c9c6e7295996924d6b2ce8e620b2a963fa2 /lua | |
| parent | feat: add markdownlint linter (#107) (diff) | |
| download | mason-11c0af44e69a165df41e5fe6681b47f4204d3623.tar mason-11c0af44e69a165df41e5fe6681b47f4204d3623.tar.gz mason-11c0af44e69a165df41e5fe6681b47f4204d3623.tar.bz2 mason-11c0af44e69a165df41e5fe6681b47f4204d3623.tar.lz mason-11c0af44e69a165df41e5fe6681b47f4204d3623.tar.xz mason-11c0af44e69a165df41e5fe6681b47f4204d3623.tar.zst mason-11c0af44e69a165df41e5fe6681b47f4204d3623.zip | |
refactor!: extract mason-lspconfig to separate plugin (#109)
The rationale behind this is to make boundaries clearer as mason.nvim
has no direct relation with lspconfig per se.
Also, hopefully, by having it as a separate package like this would
encourage more people to write similar extensions (think mason-dap and
mason-null-ls). Ideally such extensions wouldn't be required at all, but
there are definitely gaps to fill as of today.
From now on you'll need to add `williamboman/mason-lspconfig.nvim` as
a plugin if you want to use the `mason-lspconfig` extension:
```lua
use {
{ "williamboman/mason.nvim", branch = "alpha" },
"williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig",
}
```
```lua
Plug "williamboman/mason.nvim", { 'branch': 'alpha' }
Plug "williamboman/mason-lspconfig.nvim"
Plug "neovim/nvim-lspconfig"
```
Diffstat (limited to 'lua')
30 files changed, 0 insertions, 1032 deletions
diff --git a/lua/mason-lspconfig/api/command.lua b/lua/mason-lspconfig/api/command.lua deleted file mode 100644 index 136cd350..00000000 --- a/lua/mason-lspconfig/api/command.lua +++ /dev/null @@ -1,150 +0,0 @@ -local a = require "mason-core.async" -local Optional = require "mason-core.optional" -local notify = require "mason-core.notify" -local _ = require "mason-core.functional" - ----@async ----@param user_args string[]: The arguments, as provided by the user. -local function parse_packages_from_user_args(user_args) - local Package = require "mason-core.package" - local server_mapping = require "mason-lspconfig.mappings.server" - local language_mapping = require "mason.mappings.language" - - return _.filter_map(function(server_specifier) - local server_name, version = Package.Parse(server_specifier) - -- 1. first see if the provided arg is an actual lspconfig server name - return Optional - .of_nilable(server_mapping.lspconfig_to_package[server_name]) - -- 2. if not, check if it's a language specifier (e.g., "typescript" or "java") - :or_(function() - return Optional.of_nilable(language_mapping[server_name]):map(function(package_names) - local lsp_package_names = _.filter(function(package_name) - return server_mapping.package_to_lspconfig[package_name] ~= nil - end, package_names) - - if #lsp_package_names == 0 then - return nil - end - - return a.promisify(vim.ui.select)(lsp_package_names, { - prompt = ("Please select which server you want to install for language %q:"):format( - server_name - ), - format_item = function(item) - return server_mapping.package_to_lspconfig[item] - end, - }) - end) - end) - :map(function(package_name) - return { package = package_name, version = version } - end) - :if_not_present(function() - notify(("Could not find LSP server %q."):format(server_name), vim.log.levels.ERROR) - end) - end, user_args) -end - ----@async -local function parse_packages_from_heuristics() - local server_mapping = require "mason-lspconfig.mappings.server" - - -- Prompt user which server they want to install (based on the current filetype) - local current_ft = vim.api.nvim_buf_get_option(vim.api.nvim_get_current_buf(), "filetype") - local filetype_mapping = require "mason-lspconfig.mappings.filetype" - return Optional.of_nilable(filetype_mapping[current_ft]) - :map(function(server_names) - return a.promisify(vim.ui.select)(server_names, { - prompt = ("Please select which server you want to install for filetype %q:"):format(current_ft), - }) - end) - :map(function(server_name) - local package_name = server_mapping.lspconfig_to_package[server_name] - return { { package = package_name, version = nil } } - end) - :or_else_get(function() - notify(("No LSP servers found for filetype %q."):format(current_ft), vim.log.levels.ERROR) - return {} - end) -end - -local parse_packages_to_install = _.cond { - { _.compose(_.gt(0), _.length), parse_packages_from_user_args }, - { _.compose(_.equals(0), _.length), parse_packages_from_heuristics }, - { _.T, _.always {} }, -} - -local LspInstall = a.scope(function(servers) - local packages_to_install = parse_packages_to_install(servers) - if #packages_to_install > 0 then - local registry = require "mason-registry" - _.each(function(target) - local pkg = registry.get_package(target.package) - pkg:install { version = target.version } - end, packages_to_install) - local ui = require "mason.ui" - ui.open() - ui.set_view "LSP" - vim.schedule(function() - ui.set_sticky_cursor "installing-section" - end) - end -end) - -vim.api.nvim_create_user_command("LspInstall", function(opts) - LspInstall(opts.fargs) -end, { - desc = "Install one or more LSP servers.", - nargs = "*", - complete = "custom,v:lua.mason_lspconfig_completion.available_server_completion", -}) - -local function LspUninstall(servers) - require("mason.ui").open() - require("mason.ui").set_view "LSP" - local registry = require "mason-registry" - local server_mapping = require "mason-lspconfig.mappings.server" - for _, server_specifier in ipairs(servers) do - local package_name = server_mapping.lspconfig_to_package[server_specifier] - local pkg = registry.get_package(package_name) - pkg:uninstall() - end -end - -vim.api.nvim_create_user_command("LspUninstall", function(opts) - LspUninstall(opts.fargs) -end, { - desc = "Uninstall one or more LSP servers.", - nargs = "+", - complete = "custom,v:lua.mason_lspconfig_completion.installed_server_completion", -}) - -_G.mason_lspconfig_completion = { - available_server_completion = function() - local registry = require "mason-registry" - local server_mapping = require "mason-lspconfig.mappings.server" - local language_mapping = require "mason.mappings.language" - - local package_names = _.filter_map(function(pkg_name) - return Optional.of_nilable(server_mapping.package_to_lspconfig[pkg_name]) - end, registry.get_all_package_names()) - local completion = - _.compose(_.sort_by(_.identity), _.uniq_by(_.identity), _.concat(_.keys(language_mapping)))(package_names) - return table.concat(completion, "\n") - end, - installed_server_completion = function() - local registry = require "mason-registry" - local server_mapping = require "mason-lspconfig.mappings.server" - - local server_names = _.filter_map(function(pkg_name) - return Optional.of_nilable(server_mapping.package_to_lspconfig[pkg_name]) - end, registry.get_installed_package_names()) - table.sort(server_names) - return table.concat(server_names, "\n") - end, -} - -return { - LspInstall = LspInstall, - LspUninstall = LspUninstall, -} diff --git a/lua/mason-lspconfig/init.lua b/lua/mason-lspconfig/init.lua deleted file mode 100644 index fcc9b5cc..00000000 --- a/lua/mason-lspconfig/init.lua +++ /dev/null @@ -1,171 +0,0 @@ -local log = require "mason-core.log" -local Package = require "mason-core.package" -local Optional = require "mason-core.optional" -local _ = require "mason-core.functional" -local settings = require "mason-lspconfig.settings" -local server_mapping = require "mason-lspconfig.mappings.server" -local path = require "mason-core.path" -local registry = require "mason-registry" -local notify = require "mason-core.notify" -local platform = require "mason-core.platform" - -local M = {} - ----@param lspconfig_server_name string -local function resolve_package(lspconfig_server_name) - return Optional.of_nilable(server_mapping.lspconfig_to_package[lspconfig_server_name]):map(function(package_name) - local ok, pkg = pcall(registry.get_package, package_name) - if ok then - return pkg - end - end) -end - ----@param lspconfig_server_name string -local function resolve_server_config_factory(lspconfig_server_name) - local ok, server_config = pcall(require, ("mason-lspconfig.server_configurations.%s"):format(lspconfig_server_name)) - if ok then - return Optional.of(server_config) - end - return Optional.empty() -end - ----@param t1 table ----@param t2 table -local function merge_in_place(t1, t2) - for k, v in pairs(t2) do - if type(v) == "table" then - if type(t1[k]) == "table" and not vim.tbl_islist(t1[k]) then - merge_in_place(t1[k], v) - else - t1[k] = v - end - else - t1[k] = v - end - end - return t1 -end - -local memoized_set = _.memoize(_.set_of) - ----@param server_name string -local function should_auto_install(server_name) - if settings.current.automatic_installation == true then - return true - end - if type(settings.current.automatic_installation) == "table" then - return not memoized_set(settings.current.automatic_installation.exclude)[server_name] - end - return false -end - -local function setup_lspconfig_hook() - local util = require "lspconfig.util" - local win_exepath_compat = platform.is.win and require "mason-lspconfig.win-exepath-compat" - - util.on_setup = util.add_hook_before(util.on_setup, function(config) - local pkg_name = server_mapping.lspconfig_to_package[config.name] - if not pkg_name then - return - end - - if registry.is_installed(pkg_name) then - resolve_server_config_factory(config.name):if_present(function(config_factory) - merge_in_place(config, config_factory({ install_dir = path.package_prefix(pkg_name) }, config)) - if win_exepath_compat and win_exepath_compat[config.name] and config.cmd and config.cmd[1] then - local exepath = vim.fn.exepath(config.cmd[1]) - if exepath ~= "" then - config.cmd[1] = exepath - else - log.error("Failed to expand cmd path", config.name, config.cmd) - end - end - end) - else - if should_auto_install(config.name) then - local pkg = registry.get_package(pkg_name) - pkg:install() - end - end - end) -end - -local function ensure_installed() - for _, server_identifier in ipairs(settings.current.ensure_installed) do - local server_name, version = Package.Parse(server_identifier) - resolve_package(server_name):if_present( - ---@param pkg Package - function(pkg) - if not pkg:is_installed() then - pkg:install { - version = version, - } - end - end - ) - end -end - ----@param config MasonLspconfigSettings | nil -function M.setup(config) - if config then - settings.set(config) - end - - setup_lspconfig_hook() - ensure_installed() - - require "mason-lspconfig.api.command" -end - ----See `:h mason-lspconfig.setup_handlers()` ----@param handlers table<string, fun(server_name: string)> -function M.setup_handlers(handlers) - local default_handler = Optional.of_nilable(handlers[1]) - - _.each(function(handler) - if type(handler) == "string" and not server_mapping.lspconfig_to_package[handler] then - notify( - ("mason-lspconfig.setup_handlers: Received handler for unknown lspconfig server name: %s."):format( - handler - ), - vim.log.levels.WARN - ) - end - end, _.keys(handlers)) - - ---@param pkg_name string - local function get_server_name(pkg_name) - return Optional.of_nilable(server_mapping.package_to_lspconfig[pkg_name]) - end - - local function call_handler(server_name) - log.fmt_trace("Checking handler for %s", server_name) - Optional.of_nilable(handlers[server_name]):or_(_.always(default_handler)):if_present(function(handler) - log.fmt_trace("Calling handler for %s", server_name) - local ok, err = pcall(handler, server_name) - if not ok then - vim.notify(err, vim.log.levels.ERROR) - end - end) - end - - local installed_servers = _.filter_map(get_server_name, registry.get_installed_package_names()) - _.each(call_handler, installed_servers) - registry:on( - "package:install:success", - vim.schedule_wrap(function(pkg) - get_server_name(pkg.name):if_present(call_handler) - end) - ) -end - ----@return string[] -function M.get_installed_servers() - return _.filter_map(function(pkg_name) - return Optional.of_nilable(server_mapping.package_to_lspconfig[pkg_name]) - end, registry.get_installed_package_names()) -end - -return M diff --git a/lua/mason-lspconfig/mappings/filetype.lua b/lua/mason-lspconfig/mappings/filetype.lua deleted file mode 100644 index fc84277b..00000000 --- a/lua/mason-lspconfig/mappings/filetype.lua +++ /dev/null @@ -1,162 +0,0 @@ --- THIS FILE IS GENERATED. DO NOT EDIT MANUALLY. --- stylua: ignore start -return { - OpenFOAM = { "foam_ls" }, - apexcode = { "apex_ls" }, - arduino = { "arduino_language_server" }, - asm = { "asm_lsp" }, - aspnetcorerazor = { "tailwindcss" }, - astro = { "astro", "tailwindcss" }, - ["astro-markdown"] = { "tailwindcss" }, - awk = { "awk_ls" }, - bean = { "beancount" }, - beancount = { "beancount" }, - bib = { "ltex", "texlab" }, - bicep = { "bicep" }, - blade = { "tailwindcss" }, - bsl = { "bsl_ls" }, - c = { "clangd" }, - clar = { "clarity_lsp" }, - clarity = { "clarity_lsp" }, - clojure = { "clojure_lsp" }, - cmake = { "cmake" }, - cpp = { "clangd" }, - crystal = { "crystalline" }, - cs = { "csharp_ls", "omnisharp" }, - css = { "cssls", "emmet_ls", "stylelint_lsp", "tailwindcss" }, - cucumber = { "cucumber_language_server" }, - cuda = { "clangd" }, - d = { "serve_d" }, - dhall = { "dhall_lsp_server" }, - ["django-html"] = { "tailwindcss" }, - dockerfile = { "dockerls" }, - dot = { "dotls" }, - dune = { "ocamllsp" }, - edge = { "tailwindcss" }, - edn = { "clojure_lsp" }, - eelixir = { "elixirls", "tailwindcss" }, - ejs = { "tailwindcss" }, - elixir = { "elixirls" }, - elm = { "elmls" }, - erb = { "tailwindcss" }, - erlang = { "erlangls" }, - eruby = { "tailwindcss" }, - flux = { "flux_lsp" }, - foam = { "foam_ls" }, - fortran = { "fortls" }, - fsharp = { "fsautocomplete" }, - genie = { "vala_ls" }, - gitcommit = { "ltex" }, - go = { "golangci_lint_ls", "gopls" }, - gohtml = { "tailwindcss" }, - gomod = { "golangci_lint_ls", "gopls" }, - gotmpl = { "gopls" }, - graphql = { "graphql" }, - groovy = { "groovyls" }, - haml = { "tailwindcss" }, - handlebars = { "ember", "tailwindcss" }, - haskell = { "hls" }, - haxe = { "haxe_language_server" }, - hbs = { "tailwindcss" }, - heex = { "elixirls", "tailwindcss" }, - hoon = { "hoon_ls" }, - html = { "angularls", "emmet_ls", "html", "tailwindcss" }, - ["html-eex"] = { "tailwindcss" }, - htmldjango = { "tailwindcss" }, - jade = { "tailwindcss" }, - java = { "jdtls" }, - javascript = { "cssmodules_ls", "denols", "ember", "eslint", "quick_lint_js", "rome", "stylelint_lsp", "tailwindcss", "tsserver" }, - ["javascript.jsx"] = { "denols", "eslint", "tsserver" }, - javascriptreact = { "cssmodules_ls", "denols", "eslint", "graphql", "rome", "stylelint_lsp", "tailwindcss", "tsserver" }, - json = { "jsonls", "rome" }, - jsonc = { "jsonls" }, - jsonnet = { "jsonnet_ls" }, - julia = { "julials" }, - kotlin = { "kotlin_language_server" }, - leaf = { "tailwindcss" }, - less = { "cssls", "stylelint_lsp", "tailwindcss" }, - lhaskell = { "hls" }, - libsonnet = { "jsonnet_ls" }, - liquid = { "tailwindcss", "theme_check" }, - llw = { "lelwel_ls" }, - lua = { "sumneko_lua" }, - markdown = { "grammarly", "ltex", "marksman", "prosemd_lsp", "remark_ls", "tailwindcss", "zk" }, - mdx = { "tailwindcss" }, - ["metamath-zero"] = { "mm0_ls" }, - mustache = { "tailwindcss" }, - mysql = { "sqlls", "sqls" }, - ncl = { "nickel_ls" }, - nickel = { "nickel_ls" }, - nim = { "nimls" }, - nix = { "rnix" }, - njk = { "tailwindcss" }, - nunjucks = { "tailwindcss" }, - objc = { "clangd" }, - objcpp = { "clangd" }, - ocaml = { "ocamllsp" }, - ["ocaml.interface"] = { "ocamllsp" }, - ["ocaml.menhir"] = { "ocamllsp" }, - ["ocaml.ocamllex"] = { "ocamllsp" }, - opencl = { "opencl_ls" }, - org = { "ltex" }, - os = { "bsl_ls" }, - perl = { "perlnavigator" }, - php = { "intelephense", "phpactor", "psalm", "tailwindcss" }, - plaintex = { "ltex" }, - postcss = { "tailwindcss" }, - prisma = { "prismals" }, - ps1 = { "powershell_es" }, - puppet = { "puppet" }, - purescript = { "purescriptls" }, - python = { "jedi_language_server", "pylsp", "pyright", "sourcery" }, - ql = { "codeqlls" }, - r = { "r_language_server" }, - razor = { "tailwindcss" }, - reason = { "ocamllsp", "reason_ls", "tailwindcss" }, - rescript = { "rescriptls", "tailwindcss" }, - rmd = { "r_language_server" }, - rnoweb = { "ltex" }, - robot = { "robotframework_ls" }, - rst = { "esbonio", "ltex" }, - ruby = { "solargraph", "sorbet" }, - rust = { "rust_analyzer" }, - sass = { "tailwindcss" }, - scss = { "cssls", "stylelint_lsp", "tailwindcss" }, - sh = { "bashls" }, - slim = { "tailwindcss" }, - slint = { "slint_lsp" }, - sls = { "salt_ls" }, - solidity = { "solang", "solc" }, - sql = { "sqlls", "sqls" }, - stylus = { "tailwindcss" }, - sugarss = { "stylelint_lsp", "tailwindcss" }, - svelte = { "svelte", "tailwindcss" }, - svg = { "lemminx" }, - systemverilog = { "svlangserver", "svls", "verible" }, - teal = { "teal_ls" }, - terraform = { "terraformls", "tflint" }, - tex = { "ltex", "texlab" }, - toml = { "taplo" }, - twig = { "tailwindcss" }, - typescript = { "angularls", "cssmodules_ls", "denols", "ember", "eslint", "rome", "stylelint_lsp", "tailwindcss", "tsserver" }, - ["typescript.tsx"] = { "angularls", "denols", "eslint", "rome", "tsserver" }, - typescriptreact = { "angularls", "cssmodules_ls", "denols", "eslint", "graphql", "rome", "stylelint_lsp", "tailwindcss", "tsserver" }, - vala = { "vala_ls" }, - vb = { "omnisharp" }, - verilog = { "svlangserver", "svls", "verible" }, - vim = { "vimls" }, - visualforce = { "visualforce_ls" }, - vlang = { "vls" }, - vmasm = { "asm_lsp" }, - vue = { "eslint", "stylelint_lsp", "tailwindcss", "volar", "vuels" }, - wxss = { "stylelint_lsp" }, - xml = { "lemminx" }, - xsd = { "lemminx" }, - xsl = { "lemminx" }, - xslt = { "lemminx" }, - yaml = { "yamlls" }, - ["yaml.ansible"] = { "ansiblels" }, - ["yaml.docker-compose"] = { "yamlls" }, - zig = { "zls" }, - zir = { "zls" } -}
\ No newline at end of file diff --git a/lua/mason-lspconfig/mappings/server.lua b/lua/mason-lspconfig/mappings/server.lua deleted file mode 100644 index 939042c9..00000000 --- a/lua/mason-lspconfig/mappings/server.lua +++ /dev/null @@ -1,127 +0,0 @@ -local _ = require "mason-core.functional" - -local M = {} - ----Maps lspconfig server config name to its corresponding package name. -M.lspconfig_to_package = { - ["angularls"] = "angular-language-server", - ["ansiblels"] = "ansible-language-server", - ["apex_ls"] = "apex-language-server", - ["arduino_language_server"] = "arduino-language-server", - ["asm_lsp"] = "asm-lsp", - ["astro"] = "astro-language-server", - ["awk_ls"] = "awk-language-server", - ["bashls"] = "bash-language-server", - ["beancount"] = "beancount-language-server", - ["bicep"] = "bicep-lsp", - ["bsl_ls"] = "bsl-language-server", - ["clangd"] = "clangd", - ["clarity_lsp"] = "clarity-lsp", - ["clojure_lsp"] = "clojure-lsp", - ["cmake"] = "cmake-language-server", - ["codeqlls"] = "codeql", - ["crystalline"] = "crystalline", - ["csharp_ls"] = "csharp-language-server", - ["cssls"] = "css-lsp", - ["cssmodules_ls"] = "cucumber-language-server", - ["cucumber_language_server"] = "cucumber-language-server", - ["denols"] = "deno", - ["dhall_lsp_server"] = "dhall-lsp", - ["diagnosticls"] = "diagnostic-languageserver", - ["dockerls"] = "dockerfile-language-server", - ["dotls"] = "dot-language-server", - ["efm"] = "efm", - ["elixirls"] = "elixir-ls", - ["elmls"] = "elm-language-server", - ["ember"] = "ember-language-server", - ["emmet_ls"] = "emmet-ls", - ["erlangls"] = "erlang-ls", - ["esbonio"] = "esbonio", - ["eslint"] = "eslint-lsp", - ["flux_lsp"] = "flux-lsp", - ["foam_ls"] = "foam-language-server", - ["fortls"] = "fortls", - ["fsautocomplete"] = "fsautocomplete", - ["golangci_lint_ls"] = "golangci-lint-langserver", - ["gopls"] = "gopls", - ["grammarly"] = "grammarly-languageserver", - ["graphql"] = "graphql-language-service-cli", - ["groovyls"] = "groovy-language-server", - ["haxe_language_server"] = "haxe-language-server", - ["hls"] = "haskell-language-server", - ["hoon_ls"] = "hoon-language-server", - ["html"] = "html-lsp", - ["intelephense"] = "intelephense", - ["jdtls"] = "jdtls", - ["jedi_language_server"] = "jedi-language-server", - ["jsonls"] = "json-lsp", - ["jsonnet_ls"] = "jsonnet-language-server", - ["julials"] = "julia-lsp", - ["kotlin_language_server"] = "kotlin-language-server", - ["lelwel_ls"] = "lelwel", - ["lemminx"] = "lemminx", - ["ltex"] = "ltex-ls", - ["marksman"] = "marksman", - ["mm0_ls"] = "metamath-zero-lsp", - ["nickel_ls"] = "nickel-lang-lsp", - ["nimls"] = "nimlsp", - ["ocamllsp"] = "ocaml-lsp", - ["omnisharp"] = "omnisharp", - ["opencl_ls"] = "opencl-language-server", - ["perlnavigator"] = "perlnavigator", - ["phpactor"] = "phpactor", - ["powershell_es"] = "powershell-editor-services", - ["prismals"] = "prisma-language-server", - ["prosemd_lsp"] = "prosemd-lsp", - ["psalm"] = "psalm", - ["puppet"] = "puppet-editor-services", - ["purescriptls"] = "purescript-language-server", - ["pylsp"] = "python-lsp-server", - ["pyright"] = "pyright", - ["quick_lint_js"] = "quick-lint-js", - ["r_language_server"] = "r-languageserver", - ["reason_ls"] = "reason-language-server", - ["remark_ls"] = "remark-language-server", - ["rescriptls"] = "rescript-lsp", - ["rnix"] = "rnix-lsp", - ["robotframework_ls"] = "robotframework-lsp", - ["rome"] = "rome", - ["rust_analyzer"] = "rust-analyzer", - ["salt_ls"] = "salt-lsp", - ["serve_d"] = "serve-d", - ["slint_lsp"] = "slint-lsp", - ["solang"] = "solang", - ["solargraph"] = "solargraph", - ["solc"] = "solidity", - ["sorbet"] = "sorbet", - ["sourcery"] = "sourcery", - ["sqlls"] = "sqlls", - ["sqls"] = "sqls", - ["stylelint_lsp"] = "stylelint-lsp", - ["sumneko_lua"] = "lua-language-server", - ["svelte"] = "svelte-language-server", - ["svlangserver"] = "svlangserver", - ["svls"] = "svls", - ["tailwindcss"] = "tailwindcss-language-server", - ["taplo"] = "taplo", - ["teal_ls"] = "teal-language-server", - ["terraformls"] = "terraform-ls", - ["texlab"] = "texlab", - ["tflint"] = "tflint", - ["theme_check"] = "shopify-theme-check", - ["tsserver"] = "typescript-language-server", - ["vala_ls"] = "vala-language-server", - ["verible"] = "verible", - ["vimls"] = "vim-language-server", - ["visualforce_ls"] = "visualforce-language-server", - ["vls"] = "vls", - ["volar"] = "vue-language-server", - ["vuels"] = "vetur-vls", - ["yamlls"] = "yaml-language-server", - ["zk"] = "zk", - ["zls"] = "zls", -} - -M.package_to_lspconfig = _.invert(M.lspconfig_to_package) - -return M diff --git a/lua/mason-lspconfig/server_configurations/angularls/init.lua b/lua/mason-lspconfig/server_configurations/angularls/init.lua deleted file mode 100644 index 813e5258..00000000 --- a/lua/mason-lspconfig/server_configurations/angularls/init.lua +++ /dev/null @@ -1,39 +0,0 @@ -local platform = require "mason-core.platform" -local _ = require "mason-core.functional" -local path = require "mason-core.path" - ----@param install_dir string -return function(install_dir) - local append_node_modules = _.map(function(dir) - return path.concat { dir, "node_modules" } - end) - - local function get_cmd(workspace_dir) - local cmd = { - "ngserver", - "--stdio", - "--tsProbeLocations", - table.concat(append_node_modules { install_dir, workspace_dir }, ","), - "--ngProbeLocations", - table.concat( - append_node_modules { - path.concat { install_dir, "node_modules", "@angular", "language-server" }, - workspace_dir, - }, - "," - ), - } - if platform.is_win then - cmd[1] = vim.fn.exepath(cmd[1]) - end - - return cmd - end - - return { - cmd = get_cmd(vim.loop.cwd()), - on_new_config = function(new_config, root_dir) - new_config.cmd = get_cmd(root_dir) - end, - } -end diff --git a/lua/mason-lspconfig/server_configurations/apex_ls/init.lua b/lua/mason-lspconfig/server_configurations/apex_ls/init.lua deleted file mode 100644 index 6251dc73..00000000 --- a/lua/mason-lspconfig/server_configurations/apex_ls/init.lua +++ /dev/null @@ -1,8 +0,0 @@ -local path = require "mason-core.path" - ----@param install_dir string -return function(install_dir) - return { - apex_jar_path = path.concat { install_dir, "apex-jorje-lsp.jar" }, - } -end diff --git a/lua/mason-lspconfig/server_configurations/bicep/init.lua b/lua/mason-lspconfig/server_configurations/bicep/init.lua deleted file mode 100644 index ddc0a2af..00000000 --- a/lua/mason-lspconfig/server_configurations/bicep/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -return function() - return { - cmd = { "bicep-lsp" }, - } -end diff --git a/lua/mason-lspconfig/server_configurations/bsl_ls/init.lua b/lua/mason-lspconfig/server_configurations/bsl_ls/init.lua deleted file mode 100644 index 62dfa5c0..00000000 --- a/lua/mason-lspconfig/server_configurations/bsl_ls/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -return function() - return { - cmd = { "bsl-language-server" }, - } -end diff --git a/lua/mason-lspconfig/server_configurations/elixirls/init.lua b/lua/mason-lspconfig/server_configurations/elixirls/init.lua deleted file mode 100644 index 0c424b18..00000000 --- a/lua/mason-lspconfig/server_configurations/elixirls/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -return function() - return { - cmd = { "elixir-ls" }, - } -end diff --git a/lua/mason-lspconfig/server_configurations/esbonio/init.lua b/lua/mason-lspconfig/server_configurations/esbonio/init.lua deleted file mode 100644 index e9d8d988..00000000 --- a/lua/mason-lspconfig/server_configurations/esbonio/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -return function() - return { - cmd = { "esbonio" }, - } -end diff --git a/lua/mason-lspconfig/server_configurations/groovyls/init.lua b/lua/mason-lspconfig/server_configurations/groovyls/init.lua deleted file mode 100644 index 495c7592..00000000 --- a/lua/mason-lspconfig/server_configurations/groovyls/init.lua +++ /dev/null @@ -1,3 +0,0 @@ -return function() - return { cmd = "groovy-language-server" } -end diff --git a/lua/mason-lspconfig/server_configurations/julials/README.md b/lua/mason-lspconfig/server_configurations/julials/README.md deleted file mode 100644 index 18e6880d..00000000 --- a/lua/mason-lspconfig/server_configurations/julials/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# julials - -## Configuring the Julia Environment - -The Julia Environment will be identified in the following order: - -1) user configuration (`lspconfig.julials.setup { julia_env_path = "/my/env" }`) -2) if the `Project.toml` & `Manifest.toml` (or `JuliaProject.toml` & `JuliaManifest.toml`) files exists in the current project working directory, the current project working directory is used as the environment -3) the result of `Pkg.Types.Context().env.project_file` diff --git a/lua/mason-lspconfig/server_configurations/julials/init.lua b/lua/mason-lspconfig/server_configurations/julials/init.lua deleted file mode 100644 index 6166e35d..00000000 --- a/lua/mason-lspconfig/server_configurations/julials/init.lua +++ /dev/null @@ -1,50 +0,0 @@ -local path = require "mason-core.path" -local platform = require "mason-core.platform" -local fs = require "mason-core.fs" -local _ = require "mason-core.functional" - ----@param install_dir string -return function(install_dir) - return { - on_new_config = function(config, workspace_dir) - local env_path = config.julia_env_path and vim.fn.expand(config.julia_env_path) - if not env_path then - local file_exists = _.compose(fs.sync.file_exists, path.concat, _.concat { workspace_dir }) - if file_exists { "Project.toml" } and file_exists { "Manifest.toml" } then - env_path = workspace_dir - elseif file_exists { "JuliaProject.toml" } and file_exists { "JuliaManifest.toml" } then - env_path = workspace_dir - end - end - - if not env_path then - local ok, env = pcall(vim.fn.system, { - "julia", - "--startup-file=no", - "--history-file=no", - "-e", - "using Pkg; print(dirname(Pkg.Types.Context().env.project_file))", - }) - if ok then - env_path = env - end - end - - config.cmd = { - "julia", - "--startup-file=no", - "--history-file=no", - "--depwarn=no", - ("--project=%s"):format(path.concat { install_dir, "scripts", "environments", "languageserver" }), - path.concat { install_dir, "nvim-lsp.jl" }, - vim.env.JULIA_DEPOT_PATH or "", - path.concat { install_dir, "symbolstorev5" }, - env_path, - } - end, - cmd_env = { - JULIA_DEPOT_PATH = path.concat { install_dir, "lsdepot" }, - JULIA_LOAD_PATH = platform.is.win and ";" or ":", - }, - } -end diff --git a/lua/mason-lspconfig/server_configurations/kotlin_language_server/init.lua b/lua/mason-lspconfig/server_configurations/kotlin_language_server/init.lua deleted file mode 100644 index 585797fc..00000000 --- a/lua/mason-lspconfig/server_configurations/kotlin_language_server/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -return function() - return { - cmd = { "kotlin-language-server" }, - } -end diff --git a/lua/mason-lspconfig/server_configurations/ltex/init.lua b/lua/mason-lspconfig/server_configurations/ltex/init.lua deleted file mode 100644 index f24d86f7..00000000 --- a/lua/mason-lspconfig/server_configurations/ltex/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -return function() - return { - cmd = { "ltex-ls" }, - } -end diff --git a/lua/mason-lspconfig/server_configurations/omnisharp/README.md b/lua/mason-lspconfig/server_configurations/omnisharp/README.md deleted file mode 100644 index 78255785..00000000 --- a/lua/mason-lspconfig/server_configurations/omnisharp/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# omnisharp - -## How to enable Omnisharp Mono - -By default, the `omnisharp` server will use the `dotnet` (NET6) runtime to run the server. -To run the server using the Mono runtime, set the `use_modern_net` setting to `false`, like so: - -__This requires the `omnisharp-mono` package to be installed.__ - -```lua -local lspconfig = require("lspconfig") - -lspconfig.omnisharp.setup { - use_modern_net = false -} -``` diff --git a/lua/mason-lspconfig/server_configurations/omnisharp/init.lua b/lua/mason-lspconfig/server_configurations/omnisharp/init.lua deleted file mode 100644 index 274ff182..00000000 --- a/lua/mason-lspconfig/server_configurations/omnisharp/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -return function(install_dir, config) - return { - cmd = { config.use_modern_net == false and "omnisharp-mono" or "omnisharp" }, - } -end diff --git a/lua/mason-lspconfig/server_configurations/perlnavigator/init.lua b/lua/mason-lspconfig/server_configurations/perlnavigator/init.lua deleted file mode 100644 index c376dc77..00000000 --- a/lua/mason-lspconfig/server_configurations/perlnavigator/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -return function() - return { - cmd = { "perlnavigator", "--stdio" }, - } -end diff --git a/lua/mason-lspconfig/server_configurations/powershell_es/init.lua b/lua/mason-lspconfig/server_configurations/powershell_es/init.lua deleted file mode 100644 index d36a580b..00000000 --- a/lua/mason-lspconfig/server_configurations/powershell_es/init.lua +++ /dev/null @@ -1,6 +0,0 @@ ----@param install_dir string -return function(install_dir) - return { - bundle_path = install_dir, - } -end diff --git a/lua/mason-lspconfig/server_configurations/psalm/init.lua b/lua/mason-lspconfig/server_configurations/psalm/init.lua deleted file mode 100644 index 8dd3645a..00000000 --- a/lua/mason-lspconfig/server_configurations/psalm/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -return function() - return { - cmd = { "psalm-language-server" }, - } -end diff --git a/lua/mason-lspconfig/server_configurations/pylsp/README.md b/lua/mason-lspconfig/server_configurations/pylsp/README.md deleted file mode 100644 index 2434bb4b..00000000 --- a/lua/mason-lspconfig/server_configurations/pylsp/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Pylsp - -## Installing pylsp plugins - -Pylsp has [third party plugins](https://github.com/python-lsp/python-lsp-server#3rd-party-plugins) which are not installed by default. - -In order for these plugins to work with the `pylsp` server managed by this plugin, they need to be installed in the same [virtual environment](https://docs.python.org/3/library/venv.html) as `pylsp`. For these reasons, there's a convenient `:PylspInstall <packages>` command that does this for you, for example: - -```vim -:PylspInstall pyls-flake8 pylsp-mypy pyls-isort -``` - -The `:PylspInstall` command will only be available once the `pylsp` server has been set up. - -**Note that these extra pylsp plugins will not be reinstalled if you update/reinstall the `pylsp` server, you will have to manage -them manually.** diff --git a/lua/mason-lspconfig/server_configurations/pylsp/init.lua b/lua/mason-lspconfig/server_configurations/pylsp/init.lua deleted file mode 100644 index 9626fdca..00000000 --- a/lua/mason-lspconfig/server_configurations/pylsp/init.lua +++ /dev/null @@ -1,51 +0,0 @@ -local a = require "mason-core.async" -local _ = require "mason-core.functional" -local pip3 = require "mason-core.managers.pip3" -local process = require "mason-core.process" -local notify = require "mason-core.notify" -local spawn = require "mason-core.spawn" - ----@param install_dir string -return function(install_dir) - vim.api.nvim_create_user_command( - "PylspInstall", - a.scope(function(opts) - local plugins = opts.fargs - local plugins_str = table.concat(plugins, ", ") - notify(("Installing %s..."):format(plugins_str)) - local result = spawn.pip { - "install", - "-U", - "--disable-pip-version-check", - plugins, - stdio_sink = process.simple_sink(), - with_paths = { pip3.venv_path(install_dir) }, - } - if vim.in_fast_event() then - a.scheduler() - end - result - :on_success(function() - notify(("Successfully installed pylsp plugins %s"):format(plugins_str)) - end) - :on_failure(function() - notify("Failed to install requested pylsp plugins.", vim.log.levels.ERROR) - end) - end), - { - desc = "[mason.nvim] Installs the provided packages in the same venv as pylsp.", - nargs = "+", - complete = _.always { - "pyls-flake8", - "pylsp-mypy", - "pyls-spyder", - "pyls-isort", - "python-lsp-black", - "pyls-memestra", - "pylsp-rope", - }, - } - ) - - return {} -end diff --git a/lua/mason-lspconfig/server_configurations/r_language_server/init.lua b/lua/mason-lspconfig/server_configurations/r_language_server/init.lua deleted file mode 100644 index 84b004c5..00000000 --- a/lua/mason-lspconfig/server_configurations/r_language_server/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -return function() - return { - cmd = { "r-languageserver" }, - } -end diff --git a/lua/mason-lspconfig/server_configurations/rescriptls/init.lua b/lua/mason-lspconfig/server_configurations/rescriptls/init.lua deleted file mode 100644 index 2f55cc30..00000000 --- a/lua/mason-lspconfig/server_configurations/rescriptls/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -return function() - return { - cmd = { "rescript-lsp", "--stdio" }, - } -end diff --git a/lua/mason-lspconfig/server_configurations/solang/init.lua b/lua/mason-lspconfig/server_configurations/solang/init.lua deleted file mode 100644 index 2d8dcf79..00000000 --- a/lua/mason-lspconfig/server_configurations/solang/init.lua +++ /dev/null @@ -1,14 +0,0 @@ -local path = require "mason-core.path" -local process = require "mason-core.process" - ----@param install_dir string -return function(install_dir) - return { - cmd_env = { - PATH = process.extend_path { - path.concat { install_dir, "llvm13.0", "bin" }, - path.concat { install_dir, "llvm12.0", "bin" }, -- kept for backwards compatibility - }, - }, - } -end diff --git a/lua/mason-lspconfig/server_configurations/tflint/README.md b/lua/mason-lspconfig/server_configurations/tflint/README.md deleted file mode 100644 index 51298d69..00000000 --- a/lua/mason-lspconfig/server_configurations/tflint/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# tflint - -## Installing TFLint plugins - -TFLint has [third party plugins](https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/plugins.md) which are not installed by default. - -To install TFLint plugins, there's a convenient `:TFLintInit` command that does this for you. It will use Neovim's -current working directory to locate the plugins to install (according to `tflint --init`): - -``` -:TFLintInit -``` - -The `:TFLintInit` command will only be available once the `tflint` server has been set up. diff --git a/lua/mason-lspconfig/server_configurations/visualforce_ls/init.lua b/lua/mason-lspconfig/server_configurations/visualforce_ls/init.lua deleted file mode 100644 index 7d4c0ec3..00000000 --- a/lua/mason-lspconfig/server_configurations/visualforce_ls/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -return function() - return { - cmd = { "visualforce-language-server", "--stdio" }, - } -end diff --git a/lua/mason-lspconfig/server_configurations/volar/init.lua b/lua/mason-lspconfig/server_configurations/volar/init.lua deleted file mode 100644 index e1d98e77..00000000 --- a/lua/mason-lspconfig/server_configurations/volar/init.lua +++ /dev/null @@ -1,27 +0,0 @@ -local fs = require "mason-core.fs" -local path = require "mason-core.path" - ----@param install_dir string -return function(install_dir) - ---@param dir string - local function get_tsserverlib_path(dir) - return path.concat { dir, "node_modules", "typescript", "lib", "tsserverlibrary.js" } - end - - ---@param workspace_dir string|nil - local function get_typescript_server_path(workspace_dir) - local local_tsserverlib = workspace_dir ~= nil and get_tsserverlib_path(workspace_dir) - local vendored_tsserverlib = get_tsserverlib_path(install_dir) - if local_tsserverlib and fs.sync.file_exists(local_tsserverlib) then - return local_tsserverlib - else - return vendored_tsserverlib - end - end - - return { - on_new_config = function(new_config, new_install_dir) - new_config.init_options.typescript.serverPath = get_typescript_server_path(new_install_dir) - end, - } -end diff --git a/lua/mason-lspconfig/settings.lua b/lua/mason-lspconfig/settings.lua deleted file mode 100644 index a405f95c..00000000 --- a/lua/mason-lspconfig/settings.lua +++ /dev/null @@ -1,27 +0,0 @@ -local M = {} - ----@class MasonLspconfigSettings -local DEFAULT_SETTINGS = { - -- A list of servers to automatically install if they're not already installed. Example: { "rust_analyzer@nightly", "sumneko_lua" } - -- This setting has no relation with the `automatic_installation` setting. - ensure_installed = {}, - - -- Whether servers that are set up (via lspconfig) should be automatically installed if they're not already installed. - -- This setting has no relation with the `ensure_installed` setting. - -- Can either be: - -- - false: Servers are not automatically installed. - -- - true: All servers set up via lspconfig are automatically installed. - -- - { exclude: string[] }: All servers set up via lspconfig, except the ones provided in the list, are automatically installed. - -- Example: automatic_installation = { exclude = { "rust_analyzer", "solargraph" } } - automatic_installation = false, -} - -M._DEFAULT_SETTINGS = DEFAULT_SETTINGS -M.current = M._DEFAULT_SETTINGS - ----@param opts MasonLspconfigSettings -function M.set(opts) - M.current = vim.tbl_deep_extend("force", M.current, opts) -end - -return M diff --git a/lua/mason-lspconfig/win-exepath-compat.lua b/lua/mason-lspconfig/win-exepath-compat.lua deleted file mode 100644 index 995bb6db..00000000 --- a/lua/mason-lspconfig/win-exepath-compat.lua +++ /dev/null @@ -1,82 +0,0 @@ ----On Windows, Mason will link executables as .cmd wrapper scripts in Mason's bin/ directory. ----Some utilities, libuv in particular (which neovim's RPC client, among others, uses), have problems finding .cmd ----executables in PATH. ----The following is a table of lspconfig servers whose cmd will need to be expanded with |exepath()| in order to be ----successfully located and started with lspconfig. -return { - ["angularls"] = true, - ["arduino_language_server"] = true, - ["asm_lsp"] = true, - ["beancount"] = true, - ["bicep"] = true, - ["bsl_ls"] = true, - ["ccls"] = true, - ["clangd"] = true, - ["clarity_lsp"] = true, - ["clojure_lsp"] = true, - ["cmake"] = true, - ["codeqlls"] = true, - ["crystalline"] = true, - ["csharp_ls"] = true, - ["cssls"] = true, - ["denols"] = true, - ["dhall_lsp_server"] = true, - ["efm"] = true, - ["elixirls"] = true, - ["esbonio"] = true, - ["flux_lsp"] = true, - ["fortls"] = true, - ["fsautocomplete"] = true, - ["golangci_lint_ls"] = true, - ["gopls"] = true, - ["groovyls"] = true, - ["haxe_language_server"] = true, - ["hls"] = true, - ["jdtls"] = true, - ["jedi_language_server"] = true, - ["jsonnet_ls"] = true, - ["kotlin_language_server"] = true, - ["lelwel_ls"] = true, - ["lemminx"] = true, - ["ltex"] = true, - ["mm0_ls"] = true, - ["nickel_ls"] = true, - ["nimls"] = true, - ["ocamllsp"] = true, - ["omnisharp"] = true, - ["perlnavigator"] = true, - ["phpactor"] = true, - ["prosemd_lsp"] = true, - ["psalm"] = true, - ["puppet"] = true, - ["pylsp"] = true, - ["quick_lint_js"] = true, - ["reason_ls"] = true, - ["rescriptls"] = true, - ["rnix"] = true, - ["robotframework_ls"] = true, - ["rust_analyzer"] = true, - ["salt_ls"] = true, - ["scry"] = true, - ["serve_d"] = true, - ["slint_lsp"] = true, - ["solang"] = true, - ["sorbet"] = true, - ["sourcery"] = true, - ["sqlls"] = true, - ["sqls"] = true, - ["sumneko_lua"] = true, - ["svls"] = true, - ["taplo"] = true, - ["teal_ls"] = true, - ["terraformls"] = true, - ["texlab"] = true, - ["tflint"] = true, - ["theme_check"] = true, - ["vala_ls"] = true, - ["verible"] = true, - ["visualforce_ls"] = true, - ["vls"] = true, - ["zk"] = true, - ["zls"] = true, -} |
