Created
October 3, 2025 19:01
-
-
Save tobihans/e1dfae02de0e678a1be3980d87d89832 to your computer and use it in GitHub Desktop.
Dump neovim lsp configs in json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local servers = { | |
| "elixirls", | |
| "gopls", | |
| "html", | |
| "tinymist", | |
| "vtsls", | |
| "lua_ls", | |
| "pyrefly", | |
| "ruby_lsp", | |
| } | |
| local config = vim.iter(servers):fold({}, function(configs, lsp_name) | |
| local conf = vim.lsp.config[lsp_name] | |
| for key, value in pairs(conf) do | |
| if type(value) == "function" then conf[key] = nil end | |
| end | |
| conf.init_options = nil | |
| conf.capabilities = nil | |
| configs[lsp_name] = conf | |
| return configs | |
| end) | |
| local filename = "<path>/<to>/lsps.json" | |
| local file = io.open(filename, "w") | |
| if file then | |
| file:write(vim.json.encode(config, { indent = " ", sort_keys = true })) | |
| file:close() | |
| print("Content written to " .. filename) | |
| else | |
| print("Error: Could not open file " .. filename .. " for writing.") | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment