From 972e5f9c68cc433c5fc26adf92cd25b293a3776a Mon Sep 17 00:00:00 2001 From: brustybee Date: Mon, 9 Mar 2026 17:02:03 +0530 Subject: One shot upload --- lua/config/lsp.lua | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 lua/config/lsp.lua (limited to 'lua/config/lsp.lua') diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua new file mode 100644 index 0000000..2e7cf05 --- /dev/null +++ b/lua/config/lsp.lua @@ -0,0 +1,91 @@ +vim.lsp.inlay_hint.enable(true) +vim.lsp.enable({ + "clangd", + "lua_ls", + "nixd", + "nil_ls", + "zls", + "pyrefly", + "marksman", + "harper", + "tinymist", + "gopls", + "tombi", +}) + +vim.lsp.config("nil_ls", { + settings = { + formatting = { + command = { "nixfmt" }, + }, + }, +}) + +vim.lsp.config("lua_ls", { + settings = { + Lua = { + codeLens = { enable = true }, + hint = { + enable = true, + semicolon = "Disable", + }, + workspace = { + checkThirdParty = false, + -- IMPORTANT: Leave library empty here. + -- lazydev will inject the correct Nix store paths dynamically. + library = {}, + }, + runtime = { + version = "LuaJIT", + -- Setting this to false allows lazydev to find files + -- outside your immediate workspace (like Nix store plugins) + pathStrict = false, + }, + }, + }, +}) + +vim.lsp.config("*", { + capabilities = { textDocument = { semanticTokens = { multilineTokenSupport = true } } }, + root_markers = { ".git", ".editorconfig", "flake.nix", "shell.nix" }, +}) + +vim.diagnostic.config({ + severity_sort = true, + severity_sort_priority = { + Error = 100, + Warn = 90, + Hint = 50, + Info = 10, + }, +}) + +local RustLsp = function(mode, keymap, action, bufnr) + vim.keymap.set(mode, keymap, function() + vim.cmd.RustLsp(action) + end, { silent = true, buffer = bufnr }) +end + +vim.g.rustaceanvim = { + tools = {}, + server = { + on_attach = function(client, bufnr) + RustLsp({ "n", "x" }, "gra", "codeAction", bufnr) + RustLsp("n", "ee", "explainError", bufnr) + RustLsp("n", "K", { "hover", "actions" }, bufnr) + RustLsp("n", "L", { "hover", "range" }, bufnr) + end, + default_settings = { + ["rust-analyzer"] = { + checkOnSave = { + enable = false, + command = "clippy", + }, + procMacro = { + enable = true, + }, + }, + }, + }, + dap = {}, +} -- cgit v1.3.1