diff options
| author | kylo252 <[email protected]> | 2021-12-20 08:59:47 +0100 | 
|---|---|---|
| committer | GitHub <[email protected]> | 2021-12-20 08:59:47 +0100 | 
| commit | f1ca79e628090d10c46cccdb6387f13b696c70cf (patch) | |
| tree | f2110f042823fdc14ba00eca6103345e4d46bb01 | |
| parent | ccb5a6f0605c9429c2a44f3a800d7c6da6ca7752 (diff) | |
refactor: remove unused old language configs (#2094)
| -rw-r--r-- | lua/lvim/config/init.lua | 3 | ||||
| -rw-r--r-- | lua/lvim/config/supported_languages.lua | 95 | ||||
| -rw-r--r-- | lua/lvim/interface/popup.lua | 4 | ||||
| -rw-r--r-- | lua/lvim/lsp/manager.lua | 1 | ||||
| -rw-r--r-- | lua/lvim/lsp/templates.lua | 1 | ||||
| -rw-r--r-- | lua/lvim/lsp/utils.lua | 21 | ||||
| -rw-r--r-- | utils/julia/Manifest.toml | 182 | ||||
| -rw-r--r-- | utils/julia/Project.toml | 3 | ||||
| -rw-r--r-- | utils/julia/run.jl | 37 | 
9 files changed, 23 insertions, 324 deletions
| diff --git a/lua/lvim/config/init.lua b/lua/lvim/config/init.lua index fba6213d..9b6d36f0 100644 --- a/lua/lvim/config/init.lua +++ b/lua/lvim/config/init.lua @@ -40,8 +40,7 @@ function M:init()    local lvim_lsp_config = require "lvim.lsp.config"    lvim.lsp = apply_defaults(lvim.lsp, vim.deepcopy(lvim_lsp_config)) -  local supported_languages = require "lvim.config.supported_languages" -  require("lvim.lsp.manager").init_defaults(supported_languages) +  require("lvim.lsp.manager").init_defaults()  end  local function handle_deprecated_settings() diff --git a/lua/lvim/config/supported_languages.lua b/lua/lvim/config/supported_languages.lua deleted file mode 100644 index ce5bc0db..00000000 --- a/lua/lvim/config/supported_languages.lua +++ /dev/null @@ -1,95 +0,0 @@ -return { -  "asm", -  "bash", -  "beancount", -  "bibtex", -  "bicep", -  "c", -  "c_sharp", -  "clojure", -  "cmake", -  "comment", -  "commonlisp", -  "cpp", -  "crystal", -  "cs", -  "css", -  "cuda", -  "d", -  "dart", -  "dockerfile", -  "dot", -  "elixir", -  "elm", -  "emmet", -  "erlang", -  "fennel", -  "fish", -  "fortran", -  "fsharp", -  "gdscript", -  "glimmer", -  "go", -  "gomod", -  "graphql", -  "haskell", -  "hcl", -  "heex", -  "html", -  "java", -  "javascript", -  "javascriptreact", -  "jsdoc", -  "json", -  "json5", -  "jsonc", -  "julia", -  "kotlin", -  "latex", -  "ledger", -  "less", -  "lua", -  "markdown", -  "nginx", -  "nix", -  "ocaml", -  "ocaml_interface", -  "perl", -  "php", -  "pioasm", -  "ps1", -  "puppet", -  "python", -  "ql", -  "query", -  "r", -  "regex", -  "rst", -  "ruby", -  "rust", -  "scala", -  "scss", -  "sh", -  "solidity", -  "sparql", -  "sql", -  "supercollider", -  "surface", -  "svelte", -  "swift", -  "tailwindcss", -  "terraform", -  "tex", -  "tlaplus", -  "toml", -  "tsx", -  "turtle", -  "typescript", -  "typescriptreact", -  "verilog", -  "vim", -  "vue", -  "yaml", -  "yang", -  "zig", -} diff --git a/lua/lvim/interface/popup.lua b/lua/lvim/interface/popup.lua index b628125c..6587f5d4 100644 --- a/lua/lvim/interface/popup.lua +++ b/lua/lvim/interface/popup.lua @@ -43,7 +43,9 @@ end  -- @param content_provider A function accepting the popup's layout and returning the content to display  function Popup:display(content_provider)    self.win_id = vim.api.nvim_open_win(self.buffer, true, self.layout) -  vim.lsp.util.close_preview_autocmd({ "BufHidden", "BufLeave" }, self.win_id) +  vim.api.nvim_command( +    string.format("autocmd BufHidden,BufLeave <buffer> ++once lua pcall(vim.api.nvim_win_close, %d, true)", self.win_id) +  )    local lines = content_provider(self.layout)    vim.api.nvim_buf_set_lines(self.bufnr, 0, -1, false, lines) diff --git a/lua/lvim/lsp/manager.lua b/lua/lvim/lsp/manager.lua index 7a35f1ff..c95b9f69 100644 --- a/lua/lvim/lsp/manager.lua +++ b/lua/lvim/lsp/manager.lua @@ -4,6 +4,7 @@ local Log = require "lvim.core.log"  local lvim_lsp_utils = require "lvim.lsp.utils"  function M.init_defaults(languages) +  languages = languages or lvim_lsp_utils.get_all_supported_filetypes()    for _, entry in ipairs(languages) do      if not lvim.lang[entry] then        lvim.lang[entry] = { diff --git a/lua/lvim/lsp/templates.lua b/lua/lvim/lsp/templates.lua index 3478f4fb..eb05615e 100644 --- a/lua/lvim/lsp/templates.lua +++ b/lua/lvim/lsp/templates.lua @@ -53,6 +53,7 @@ function M.generate_templates(servers_names)      for _, server in pairs(available_servers) do        table.insert(servers_names, server.name) +      table.sort(servers_names)      end    end diff --git a/lua/lvim/lsp/utils.lua b/lua/lvim/lsp/utils.lua index df3846ce..6d1ed09c 100644 --- a/lua/lvim/lsp/utils.lua +++ b/lua/lvim/lsp/utils.lua @@ -49,12 +49,15 @@ function M.get_client_capabilities(client_id)    return enabled_caps  end +---Get supported filetypes per server +---@param server_name string can be any server supported by nvim-lsp-installer +---@return table supported filestypes as a list of strings  function M.get_supported_filetypes(server_name) -  -- temporary workaround: https://github.com/neovim/nvim-lspconfig/pull/1358 -  if server_name == "dockerls" then -    return { "dockerfile" } +  local status_ok, lsp_installer_servers = pcall(require, "nvim-lsp-installer.servers") +  if not status_ok then +    return {}    end -  local lsp_installer_servers = require "nvim-lsp-installer.servers" +    local server_available, requested_server = lsp_installer_servers.get_server(server_name)    if not server_available then      return {} @@ -63,4 +66,14 @@ function M.get_supported_filetypes(server_name)    return requested_server:get_supported_filetypes()  end +---Get all supported filetypes by nvim-lsp-installer +---@return table supported filestypes as a list of strings +function M.get_all_supported_filetypes() +  local status_ok, lsp_installer_filetypes = pcall(require, "nvim-lsp-installer._generated.filetype_map") +  if not status_ok then +    return {} +  end +  return vim.tbl_keys(lsp_installer_filetypes or {}) +end +  return M diff --git a/utils/julia/Manifest.toml b/utils/julia/Manifest.toml deleted file mode 100644 index c6c12950..00000000 --- a/utils/julia/Manifest.toml +++ /dev/null @@ -1,182 +0,0 @@ -# This file is machine-generated - editing it directly is not advised - -[[ArgTools]] -uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" - -[[Artifacts]] -uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" - -[[Base64]] -uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" - -[[CSTParser]] -deps = ["Tokenize"] -git-tree-sha1 = "9723e1c07c1727082e169ca50789644a552fb023" -uuid = "00ebfdb7-1f24-5e51-bd34-a7502290713f" -version = "3.2.3" - -[[Dates]] -deps = ["Printf"] -uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" - -[[DocumentFormat]] -deps = ["CSTParser", "FilePathsBase", "Tokenize"] -git-tree-sha1 = "cf048d65cbcdec70f10745e5801eeb0c6478a7f7" -uuid = "ffa9a821-9c82-50df-894e-fbcef3ed31cd" -version = "3.2.4" - -[[Downloads]] -deps = ["ArgTools", "LibCURL", "NetworkOptions"] -uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" - -[[FilePathsBase]] -deps = ["Dates", "Mmap", "Printf", "Test", "UUIDs"] -git-tree-sha1 = "0f5e8d0cb91a6386ba47bd1527b240bd5725fbae" -uuid = "48062228-2e41-5def-b9a4-89aafe57970f" -version = "0.9.10" - -[[InteractiveUtils]] -deps = ["Markdown"] -uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" - -[[JSON]] -deps = ["Dates", "Mmap", "Parsers", "Unicode"] -git-tree-sha1 = "81690084b6198a2e1da36fcfda16eeca9f9f24e4" -uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" -version = "0.21.1" - -[[JSONRPC]] -deps = ["JSON", "UUIDs"] -git-tree-sha1 = "1e9a820a29b37864a6738b8fd00eedf3fb8d772e" -uuid = "b9b8584e-8fd3-41f9-ad0c-7255d428e418" -version = "1.3.3" - -[[LanguageServer]] -deps = ["CSTParser", "DocumentFormat", "JSON", "JSONRPC", "Markdown", "Pkg", "REPL", "StaticLint", "SymbolServer", "Tokenize", "URIParser", "UUIDs"] -git-tree-sha1 = "ac9f7da10fbba9cad8455a3436d121eaf8f308f6" -uuid = "2b0e0bc5-e4fd-59b4-8912-456d1b03d8d7" -version = "4.0.0" - -[[LibCURL]] -deps = ["LibCURL_jll", "MozillaCACerts_jll"] -uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" - -[[LibCURL_jll]] -deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] -uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" - -[[LibGit2]] -deps = ["Base64", "NetworkOptions", "Printf", "SHA"] -uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" - -[[LibSSH2_jll]] -deps = ["Artifacts", "Libdl", "MbedTLS_jll"] -uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" - -[[Libdl]] -uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" - -[[Logging]] -uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" - -[[Markdown]] -deps = ["Base64"] -uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" - -[[MbedTLS_jll]] -deps = ["Artifacts", "Libdl"] -uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" - -[[Mmap]] -uuid = "a63ad114-7e13-5084-954f-fe012c677804" - -[[MozillaCACerts_jll]] -uuid = "14a3606d-f60d-562e-9121-12d972cd8159" - -[[NetworkOptions]] -uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" - -[[Parsers]] -deps = ["Dates"] -git-tree-sha1 = "c8abc88faa3f7a3950832ac5d6e690881590d6dc" -uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" -version = "1.1.0" - -[[Pkg]] -deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] -uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" - -[[Printf]] -deps = ["Unicode"] -uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" - -[[REPL]] -deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] -uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" - -[[Random]] -deps = ["Serialization"] -uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" - -[[SHA]] -uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" - -[[Serialization]] -uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" - -[[Sockets]] -uuid = "6462fe0b-24de-5631-8697-dd941f90decc" - -[[StaticLint]] -deps = ["CSTParser", "Serialization", "SymbolServer"] -git-tree-sha1 = "337ca6f234947b31e921a424f7d0ec8dda22ed49" -uuid = "b3cc710f-9c33-5bdb-a03d-a94903873e97" -version = "8.0.0" - -[[SymbolServer]] -deps = ["InteractiveUtils", "LibGit2", "Markdown", "Pkg", "REPL", "SHA", "Serialization", "Sockets", "UUIDs"] -git-tree-sha1 = "9053544866f779dfb87027c52a332e2830e868ab" -uuid = "cf896787-08d5-524d-9de7-132aaa0cb996" -version = "7.0.0" - -[[TOML]] -deps = ["Dates"] -uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" - -[[Tar]] -deps = ["ArgTools", "SHA"] -uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" - -[[Test]] -deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] -uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" - -[[Tokenize]] -git-tree-sha1 = "eee92eda3cc8e104b7e56ff4c1fcf0d78ca37c89" -uuid = "0796e94c-ce3b-5d07-9a54-7f471281c624" -version = "0.5.18" - -[[URIParser]] -deps = ["Unicode"] -git-tree-sha1 = "53a9f49546b8d2dd2e688d216421d050c9a31d0d" -uuid = "30578b45-9adc-5946-b283-645ec420af67" -version = "0.4.1" - -[[UUIDs]] -deps = ["Random", "SHA"] -uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" - -[[Unicode]] -uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" - -[[Zlib_jll]] -deps = ["Libdl"] -uuid = "83775a58-1f1d-513f-b197-d71354ab007a" - -[[nghttp2_jll]] -deps = ["Artifacts", "Libdl"] -uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" - -[[p7zip_jll]] -deps = ["Artifacts", "Libdl"] -uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" diff --git a/utils/julia/Project.toml b/utils/julia/Project.toml deleted file mode 100644 index 50cd7702..00000000 --- a/utils/julia/Project.toml +++ /dev/null @@ -1,3 +0,0 @@ -[deps] -LanguageServer = "2b0e0bc5-e4fd-59b4-8912-456d1b03d8d7" -SymbolServer = "cf896787-08d5-524d-9de7-132aaa0cb996" diff --git a/utils/julia/run.jl b/utils/julia/run.jl deleted file mode 100644 index 4662e1b2..00000000 --- a/utils/julia/run.jl +++ /dev/null @@ -1,37 +0,0 @@ -# Load LanguageServer from the project next to this file -## Save old load path -old_load_path = copy(LOAD_PATH) -push!(empty!(LOAD_PATH), @__DIR__) -## Load packages -using LanguageServer, SymbolServer -## Restore old load path -append!(empty!(LOAD_PATH), old_load_path) - -# Figure out the active project -## This configuration is a good default -project_path = let -    dirname(something( -        ## 1. Finds an explicitly set project (JULIA_PROJECT) -        Base.load_path_expand(( -            p = get(ENV, "JULIA_PROJECT", nothing); -            p === nothing ? nothing : isempty(p) ? nothing : p -        )), -        ## 2. Look for a Project.toml file in the current working directory, -        ##    or parent directories, with $HOME as an upper boundary -        Base.current_project(), -        ## 3. First entry in the load path -        get(Base.load_path(), 1, nothing), -        ## 4. Fallback to default global environment, -        ##    this is more or less unreachable -        Base.load_path_expand("@v#.#"), -    )) -end - -# Depot path for the server to index (empty uses default). -depot_path = get(ENV, "JULIA_DEPOT_PATH", "") - -# Start the server -@info "Running julia language server" VERSION project_path depot_path -server = LanguageServer.LanguageServerInstance(stdin, stdout, project_path, depot_path) -server.runlinter = true -run(server) | 
