🪴 my neovim config:)
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(config/lsp): configure lsp servers

robin 0f716c49 e445dedf

+363 -89
+5 -1
config/lsp/astro.lua
··· 1 - return {} 1 + return { 2 + cmd = { "astro-ls", "--stdio" }, 3 + filetypes = { "astro" }, 4 + root_markers = { "package.json", "tsconfig.json", "jsconfig.json", ".git" }, 5 + }
+20 -1
config/lsp/bashls.lua
··· 1 - return {} 1 + return { 2 + cmd = { "bash-language-server", "start" }, 3 + settings = { 4 + bashIde = { 5 + -- Glob pattern for finding and parsing shell script files in the workspace. 6 + -- Used by the background analysis features across files. 7 + 8 + -- Prevent recursive scanning which will cause issues when opening a file 9 + -- directly in the home directory (e.g. ~/foo.sh). 10 + -- 11 + -- Default upstream pattern is "**/*@(.sh|.inc|.bash|.command)". 12 + globPattern = vim.env.GLOB_PATTERN or "*@(.sh|.inc|.bash|.command)", 13 + }, 14 + }, 15 + filetypes = { "bash", "sh" }, 16 + root_dir = function(buf) 17 + return vim.fs.dirname(vim.fs.find(".git", { path = vim.api.nvim_buf_get_name(buf), upward = true })[1]) 18 + end, 19 + single_file_support = true, 20 + }
+80
config/lsp/clangd.lua
··· 1 + -- https://clangd.llvm.org/extensions.html#switch-between-sourceheader 2 + local function switch_source_header(bufnr) 3 + local client = vim.lsp.get_clients({ bufnr = bufnr, name = "clangd" })[1] 4 + if not client then 5 + return vim.notify("Clangd client not found", vim.log.levels.ERROR) 6 + end 7 + local params = vim.lsp.util.make_text_document_params(bufnr) 8 + client:request("textDocument/switchSourceHeader", params, function(err, result) 9 + if err then 10 + error(tostring(err)) 11 + end 12 + if not result then 13 + vim.notify("corresponding file cannot be determined") 14 + return 15 + end 16 + vim.cmd.edit(vim.uri_to_fname(result)) 17 + end, bufnr) 18 + end 19 + 20 + local function symbol_info() 21 + local bufnr = vim.api.nvim_get_current_buf() 22 + local clangd_client = vim.lsp.get_clients({ bufnr = bufnr, name = "clangd" })[1] 23 + if not clangd_client or not clangd_client:supports_method("textDocument/symbolInfo") then 24 + return vim.notify("Clangd client not found", vim.log.levels.ERROR) 25 + end 26 + local win = vim.api.nvim_get_current_win() 27 + local params = vim.lsp.util.make_position_params(win, clangd_client.offset_encoding) 28 + clangd_client:request("textDocument/symbolInfo", params, function(err, res) 29 + if err or #res == 0 then 30 + -- Clangd always returns an error, there is not reason to parse it 31 + return 32 + end 33 + local container = string.format("container: %s", res[1].containerName) ---@type string 34 + local name = string.format("name: %s", res[1].name) ---@type string 35 + vim.lsp.util.open_floating_preview({ name, container }, "", { 36 + height = 2, 37 + width = math.max(string.len(name), string.len(container)), 38 + focusable = false, 39 + focus = false, 40 + border = "single", 41 + title = "Symbol Info", 42 + }) 43 + end, bufnr) 44 + end 45 + 46 + return { 47 + cmd = { "clangd" }, 48 + filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto" }, 49 + root_markers = { 50 + ".clangd", 51 + ".clang-tidy", 52 + ".clang-format", 53 + "compile_commands.json", 54 + "compile_flags.txt", 55 + "configure.ac", -- AutoTools 56 + }, 57 + single_file_support = true, 58 + capabilities = { 59 + textDocument = { 60 + completion = { 61 + editsNearCursor = true, 62 + }, 63 + }, 64 + offsetEncoding = { "utf-8", "utf-16" }, 65 + }, 66 + commands = { 67 + ClangdSwitchSourceHeader = { 68 + function() 69 + switch_source_header(0) 70 + end, 71 + description = "Switch between source/header", 72 + }, 73 + ClangdShowSymbolInfo = { 74 + function() 75 + symbol_info() 76 + end, 77 + description = "Show symbol info", 78 + }, 79 + }, 80 + }
+12 -1
config/lsp/cssls.lua
··· 1 - return {} 1 + return { 2 + cmd = { "vscode-css-language-server", "--stdio" }, 3 + filetypes = { "css", "scss", "less" }, 4 + init_options = { provideFormatter = true }, -- needed to enable formatting capabilities 5 + root_markers = { "package.json", ".git" }, 6 + single_file_support = true, 7 + settings = { 8 + css = { validate = true }, 9 + scss = { validate = true }, 10 + less = { validate = true }, 11 + }, 12 + }
+18
config/lsp/denols.lua
··· 1 1 return { 2 + cmd = { "deno", "lsp" }, 3 + cmd_env = { NO_COLOR = true }, 4 + filetypes = { 5 + "javascript", 6 + "javascriptreact", 7 + "javascript.jsx", 8 + "typescript", 9 + "typescriptreact", 10 + "typescript.tsx", 11 + }, 2 12 root_markers = { "deno.json", "deno.jsonc" }, 3 13 single_file_support = false, 4 14 settings = { 5 15 deno = { 16 + enable = true, 17 + suggest = { 18 + imports = { 19 + hosts = { 20 + ["https://deno.land"] = true, 21 + }, 22 + }, 23 + }, 6 24 inlayHints = { 7 25 parameterNames = { enabled = "all", suppressWhenArgumentMatchesName = true }, 8 26 parameterTypes = { enabled = true },
+6 -1
config/lsp/dockerls.lua
··· 1 - return {} 1 + return { 2 + cmd = { "docker-langserver", "--stdio" }, 3 + filetypes = { "dockerfile" }, 4 + root_markers = { "Dockerfile" }, 5 + single_file_support = true, 6 + }
+8 -1
config/lsp/emmet_language_server.lua
··· 1 1 return { 2 + cmd = { "emmet-language-server", "--stdio" }, 2 3 filetypes = { 3 4 "astro", 4 5 "css", 5 6 "eruby", 6 7 "html", 8 + "htmlangular", 9 + "htmldjango", 7 10 "javascript", 8 11 "javascriptreact", 9 12 "less", 13 + "pug", 10 14 "sass", 11 15 "scss", 12 - "pug", 13 16 "typescriptreact", 14 17 }, 18 + single_file_support = true, 19 + root_dir = function(buf) 20 + return vim.fs.dirname(vim.fs.find(".git", { path = vim.api.nvim_buf_get_name(buf), upward = true })[1]) 21 + end, 15 22 }
+3 -2
config/lsp/gopls.lua
··· 1 1 return { 2 - single_file_support = true, 3 - filetypes = { "go", "gomod", "gosum", "gotmpl", "gohtmltmpl", "gotexttmpl" }, 4 2 cmd = { 5 3 "gopls", -- share the gopls instance if there is one already 6 4 "-remote.debug=:0", 7 5 }, 6 + filetypes = { "go", "gomod", "gosum", "gotmpl", "gohtmltmpl", "gotexttmpl" }, 7 + single_file_support = true, 8 + root_markers = { "go.work", "go.mod", ".git" }, 8 9 settings = { 9 10 gopls = { 10 11 hints = {
-1
config/lsp/helm_ls.lua
··· 1 - return {}
+12 -1
config/lsp/hls.lua
··· 1 - return {} 1 + return { 2 + cmd = { "haskell-language-server-wrapper", "--lsp" }, 3 + filetypes = { "haskell", "lhaskell" }, 4 + root_markers = { "hie.yaml", "stack.yaml", "cabal.project", "*.cabal", "package.yaml" }, 5 + single_file_support = true, 6 + settings = { 7 + haskell = { 8 + formattingProvider = "ormolu", 9 + cabalFormattingProvider = "cabalfmt", 10 + }, 11 + }, 12 + }
+11 -1
config/lsp/html.lua
··· 1 - return {} 1 + return { 2 + cmd = { "vscode-html-language-server", "--stdio" }, 3 + filetypes = { "html", "templ" }, 4 + root_dir = { "package.json", ".git" }, 5 + single_file_support = true, 6 + settings = { 7 + provideFormatter = true, 8 + embeddedLanguages = { css = true, javascript = true }, 9 + configurationSection = { "html", "css", "javascript" }, 10 + }, 11 + }
-1
config/lsp/intelephense.lua
··· 1 - return {}
-1
config/lsp/jqls.lua
··· 1 - return {}
+11 -1
config/lsp/jsonls.lua
··· 1 - return {} 1 + return { 2 + cmd = { "vscode-json-language-server", "--stdio" }, 3 + filetypes = { "json", "jsonc" }, 4 + settings = { 5 + provideFormatter = true, 6 + }, 7 + root_dir = function(buf) 8 + return vim.fs.dirname(vim.fs.find(".git", { path = vim.api.nvim_buf_get_name(buf), upward = true })[1]) 9 + end, 10 + single_file_support = true, 11 + }
+6 -1
config/lsp/marksman.lua
··· 1 - return {} 1 + return { 2 + cmd = { "marksman", "server" }, 3 + filetypes = { "markdown", "markdown.mdx" }, 4 + root_markers = { ".marksman.toml", ".git" }, 5 + single_file_support = true, 6 + }
+3
config/lsp/nil_ls.lua
··· 1 1 return { 2 2 cmd = { "nil" }, 3 + filetypes = { "nix" }, 4 + root_dir = { "flake.nix", ".git" }, 5 + single_file_support = true, 3 6 settings = { 4 7 ["nil"] = { 5 8 formatting = {
+8 -1
config/lsp/nushell.lua
··· 1 - return {} 1 + return { 2 + cmd = { "nu", "--lsp" }, 3 + filetypes = { "nu" }, 4 + root_dir = function(buf) 5 + return vim.fs.dirname(vim.fs.find(".git", { path = vim.api.nvim_buf_get_name(buf), upward = true })[1]) 6 + end, 7 + single_file_support = true, 8 + }
-1
config/lsp/serve_d.lua
··· 1 - return {}
-1
config/lsp/sourcekit.lua
··· 1 - return {}
+51 -1
config/lsp/tailwindcss.lua
··· 1 1 return { 2 + cmd = { "tailwindcss-language-server", "--stdio" }, 2 3 filetypes = { 3 4 "astro", 5 + 4 6 "javascriptreact", 5 7 "typescriptreact", 8 + 9 + "css", 10 + "less", 11 + "postcss", 12 + "sass", 13 + "scss", 14 + 15 + "gohtml", 16 + "gohtmltmpl", 6 17 "html", 7 - "css", 18 + "svelte", 19 + "templ", 8 20 "tera", 21 + "vue", 22 + }, 23 + settings = { 24 + tailwindCSS = { 25 + validate = true, 26 + lint = { 27 + cssConflict = "warning", 28 + invalidApply = "error", 29 + invalidScreen = "error", 30 + invalidVariant = "error", 31 + invalidConfigPath = "error", 32 + invalidTailwindDirective = "error", 33 + recommendedVariantOrder = "warning", 34 + }, 35 + classAttributes = { 36 + "class", 37 + "className", 38 + "class:list", 39 + "classList", 40 + "ngClass", 41 + }, 42 + includeLanguages = { 43 + eelixir = "html-eex", 44 + eruby = "erb", 45 + templ = "html", 46 + htmlangular = "html", 47 + }, 48 + }, 49 + }, 50 + root_markers = { 51 + "tailwind.config.js", 52 + "tailwind.config.cjs", 53 + "tailwind.config.mjs", 54 + "tailwind.config.ts", 55 + "postcss.config.js", 56 + "postcss.config.cjs", 57 + "postcss.config.mjs", 58 + "postcss.config.ts", 9 59 }, 10 60 }
+8 -1
config/lsp/taplo.lua
··· 1 - return {} 1 + return { 2 + cmd = { "taplo", "lsp", "stdio" }, 3 + filetypes = { "toml" }, 4 + root_dir = function(buf) 5 + return vim.fs.dirname(vim.fs.find(".git", { path = vim.api.nvim_buf_get_name(buf), upward = true })[1]) 6 + end, 7 + single_file_support = true, 8 + }
+9
config/lsp/teal_ls.lua
··· 1 + return { 2 + cmd = { 3 + "teal-language-server", 4 + }, 5 + filetypes = { 6 + "teal", 7 + }, 8 + root_markers = { "tlconfig.lua" }, 9 + }
+6
config/lsp/tinymist.lua
··· 1 1 return { 2 + cmd = { "tinymist" }, 3 + filetypes = { "typst" }, 4 + root_dir = function(buf) 5 + return vim.fs.dirname(vim.fs.find(".git", { path = vim.api.nvim_buf_get_name(buf), upward = true })[1]) 6 + end, 7 + single_file_support = true, 2 8 settings = { 3 9 formatterMode = "typstyle", 4 10 exportPdf = "onDocumentHasTitle",
+10
config/lsp/ts_ls.lua
··· 1 1 return { 2 + cmd = { "typescript-language-server", "--stdio" }, 3 + filetypes = { 4 + "javascript", 5 + "javascriptreact", 6 + "javascript.jsx", 7 + "typescript", 8 + "typescriptreact", 9 + "typescript.tsx", 10 + }, 11 + 2 12 single_file_support = false, 3 13 root_dir = function(buf) 4 14 local root_dir = vim.fs.root(buf, { "package.json", "tsconfig.json" })
+3 -1
config/lsp/volar.lua
··· 1 1 return { 2 + cmd = { "vue-language-server", "--stdio" }, 3 + filetypes = { "vue" }, 4 + root_markers = { "package.json" }, 2 5 capabilities = { 3 6 workspace = { 4 7 didChangeWatchedFiles = { ··· 6 9 }, 7 10 }, 8 11 }, 9 - root_markers = { "package.json" }, 10 12 }
+6
config/lsp/yamlls.lua
··· 1 1 return { 2 + cmd = { "yaml-language-server", "--stdio" }, 3 + filetypes = { "yaml", "yaml.docker-compose", "yaml.gitlab" }, 4 + root_dir = function(buf) 5 + return vim.fs.dirname(vim.fs.find(".git", { path = vim.api.nvim_buf_get_name(buf), upward = true })[1]) 6 + end, 7 + single_file_support = true, 2 8 settings = { 3 9 yaml = { 4 10 completion = true,
+65
config/lsp/zk.lua
··· 1 + local function find_zk_root(startpath) 2 + for dir in vim.fs.parents(startpath) do 3 + if vim.fn.isdirectory(vim.fs.joinpath(dir, ".zk")) == 1 then 4 + return dir 5 + end 6 + end 7 + end 8 + 9 + return { 10 + cmd = { "zk", "lsp" }, 11 + filetypes = { "markdown" }, 12 + root_dir = { ".zk" }, 13 + commands = { 14 + ZkIndex = { 15 + function() 16 + local bufpath = vim.api.nvim_buf_get_name(0) 17 + local root = find_zk_root(bufpath) 18 + 19 + vim.lsp.buf_request(0, "workspace/executeCommand", { 20 + command = "zk.index", 21 + arguments = { root, { select = { "path" } } }, 22 + }) 23 + end, 24 + description = "ZkIndex", 25 + }, 26 + ZkList = { 27 + function() 28 + local bufpath = vim.api.nvim_buf_get_name(0) 29 + local root = find_zk_root(bufpath) 30 + 31 + vim.lsp.buf_request(0, "workspace/executeCommand", { 32 + command = "zk.list", 33 + arguments = { root, { select = { "path" } } }, 34 + }, function(_, result, _, _) 35 + if not result then 36 + return 37 + end 38 + local paths = vim.tbl_map(function(item) 39 + return item.path 40 + end, result) 41 + vim.ui.select(paths, {}, vim.cmd.edit) 42 + end) 43 + end, 44 + description = "ZkList", 45 + }, 46 + ZkNew = { 47 + function(...) 48 + vim.lsp.buf_request(0, "workspace/executeCommand", { 49 + command = "zk.new", 50 + arguments = { 51 + vim.api.nvim_buf_get_name(0), 52 + ..., 53 + }, 54 + }, function(_, result, _, _) 55 + if not (result and result.path) then 56 + return 57 + end 58 + vim.cmd.edit(result.path) 59 + end) 60 + end, 61 + 62 + description = "ZkNew", 63 + }, 64 + }, 65 + }
-67
config/lua/ivy/init.lua
··· 36 36 end, 37 37 servers = function() 38 38 return { 39 - astro = {}, 40 - bashls = {}, 41 - cssls = {}, 42 - dockerls = {}, 43 - emmet_language_server = { 44 - filetypes = { 45 - "astro", 46 - "css", 47 - "eruby", 48 - "html", 49 - "javascript", 50 - "javascriptreact", 51 - "less", 52 - "sass", 53 - "scss", 54 - "pug", 55 - "typescriptreact", 56 - }, 57 - }, 58 - helm_ls = {}, 59 - hls = {}, 60 - html = {}, 61 - intelephense = {}, 62 - jqls = {}, 63 39 jsonls = { 64 40 settings = { 65 41 json = { ··· 68 44 }, 69 45 }, 70 46 }, 71 - marksman = {}, 72 - nushell = {}, 73 - serve_d = {}, 74 - sourcekit = {}, 75 - taplo = {}, 76 - teal_ls = {}, 77 - tailwindcss = { 78 - filetypes = { 79 - "astro", 80 - "javascriptreact", 81 - "typescriptreact", 82 - "html", 83 - "css", 84 - "tera", 85 - }, 86 - }, 87 - tinymist = { 88 - settings = { 89 - formatterMode = "typstyle", 90 - exportPdf = "onDocumentHasTitle", 91 - }, 92 - }, 93 - volar = { 94 - capabilities = { 95 - workspace = { 96 - didChangeWatchedFiles = { 97 - dynamicRegistration = true, 98 - }, 99 - }, 100 - }, 101 - root_markers = { "package.json" }, 102 - }, 103 47 yamlls = { 104 48 settings = { 105 49 yaml = { 106 - completion = true, 107 - validate = true, 108 - suggest = { 109 - parentSkeletonSelectedFirst = true, 110 - }, 111 50 schemas = vim.tbl_extend("keep", { 112 51 ["https://json.schemastore.org/github-action"] = ".github/action.{yaml,yml}", 113 52 ["https://json.schemastore.org/github-workflow"] = ".github/workflows/*", 114 53 ["https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json"] = "*lab-ci.{yaml,yml}", 115 - ["https://json.schemastore.org/helmfile"] = "helmfile.{yaml,yml}", 116 54 ["https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json"] = "docker-compose.{yml,yaml}", 117 55 ["https://goreleaser.com/static/schema.json"] = ".goreleaser.{yml,yaml}", 118 56 }, require("schemastore").yaml.schemas()), 119 - }, 120 - redhat = { 121 - telemetry = { 122 - enabled = false, 123 - }, 124 57 }, 125 58 }, 126 59 },
+2 -2
pkgs/neovim.nix
··· 25 25 gopls, 26 26 haskell-language-server, 27 27 lua-language-server, 28 + luajitPackages, 28 29 marksman, 29 30 selene, 30 31 tailwindcss-language-server, 31 32 taplo, 32 - teal-language-server, 33 33 tinymist, 34 34 typescript-language-server, 35 35 vscode-langservers-extracted, ··· 194 194 nodePackages.prettier 195 195 proselint 196 196 taplo # toml 197 - teal-language-server 197 + luajitPackages.teal-language-server 198 198 yaml-language-server # yaml 199 199 dockerfile-language-server-nodejs 200 200 lazygit