From 215778e9c430d8fae9171719f80a3a6d63a59e55 Mon Sep 17 00:00:00 2001 From: "RingOfStorms (Joshua Bell)" Date: Mon, 21 Oct 2024 19:00:14 -0500 Subject: [PATCH] renames, refactors, comment updates --- .../{formatter.lua => conform_formatter.lua} | 17 +++++----- lua/plugins/lsp.lua | 31 ++++++++++++++----- lua/plugins/rustaceanvim.lua | 19 ------------ 3 files changed, 31 insertions(+), 36 deletions(-) rename lua/plugins/{formatter.lua => conform_formatter.lua} (84%) delete mode 100644 lua/plugins/rustaceanvim.lua diff --git a/lua/plugins/formatter.lua b/lua/plugins/conform_formatter.lua similarity index 84% rename from lua/plugins/formatter.lua rename to lua/plugins/conform_formatter.lua index 0f2acc4..f64af40 100644 --- a/lua/plugins/formatter.lua +++ b/lua/plugins/conform_formatter.lua @@ -61,19 +61,18 @@ return { }, -- Note that all these need to be available at runtime, add them to flake.nix#runtimeDependencies formatters_by_ft = { - lua = { "stylua", lsp_format = "fallback" }, - nix = { "nixfmt", lsp_format = "fallback" }, - -- vlang = { "v_fmt" }, - typescript = expandFormatters({ { "prettierd", "prettier" }, "rustywind", lsp_format = "fallback" }), - typescriptreact = expandFormatters({ { "prettierd", "prettier" }, "rustywind", lsp_format = "fallback" }), - javascript = expandFormatters({ { "prettierd", "prettier" }, "rustywind", lsp_format = "fallback" }), - javascriptreact = expandFormatters({ { "prettierd", "prettier" }, "rustywind", lsp_format = "fallback" }), + lua = { "stylua", lsp_format = "first" }, + nix = { "nixfmt", lsp_format = "first" }, + typescript = expandFormatters({ { "prettierd", "prettier" }, "rustywind", lsp_format = "first" }), + typescriptreact = expandFormatters({ { "prettierd", "prettier" }, "rustywind", lsp_format = "first" }), + javascript = expandFormatters({ { "prettierd", "prettier" }, "rustywind", lsp_format = "first" }), + javascriptreact = expandFormatters({ { "prettierd", "prettier" }, "rustywind", lsp_format = "first" }), -- TODO revisit these I'd like to use them but they are not in nixpkgs yet -- https://nixos.org/guides/nix-pills/ -- markdown = { "mdslw", "mdsf"}, - markdown = { "markdownlint-cli2", lsp_format = "fallback" }, - -- rust = { "rustfmt" }, + markdown = { "markdownlint-cli2", lsp_format = "first" }, + rust = { "rustfmt", lsp_format = "first" }, }, }, keys = { diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 42ce618..42e5cf8 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,3 +1,14 @@ +vim.g.rustaceanvim = { + tools = { + enable_clippy = true, + enable_nextest = true, + reload_workspace_from_cargo_toml = true, + }, + server = { + -- cmd = { "nix", "run", "nixpkgs#rust-analyzer" }, + }, +} + return { -- LSP helper plugins for various languages { "folke/neodev.nvim", event = { "BufRead *.lua", "BufRead *.vim" }, opts = {}, main = "neodev" }, @@ -8,10 +19,19 @@ return { -- }, -- TODO add some hotkeys for opening the popup menus on crates { "Saecki/crates.nvim", event = "BufRead Cargo.toml", tag = "stable", opts = {}, main = "crates" }, + { + "mrcjkb/rustaceanvim", + version = "^5", + lazy = false, -- already lazy + ft = { "rust" }, + keys = {}, + command = "RustLsp", + }, { "neovim/nvim-lspconfig", event = "BufEnter", dependencies = { + { "hrsh7th/nvim-cmp" }, { "lvimuser/lsp-inlayhints.nvim", init = function() @@ -66,7 +86,7 @@ return { vim.api.nvim_create_autocmd("LspDetach", { group = vim.api.nvim_create_augroup("myconfig-lsp-detach", { clear = true }), - callback = function(event) + callback = function() -- function (event) vim.lsp.buf.clear_references() -- vim.api.nvim_clear_autocmds({ group = "myconfig-lsp-highlight", buffer = event.buf }) end, @@ -83,7 +103,7 @@ return { -- Some languages (like typescript) have entire language plugins that can be useful: -- https://github.com/pmizio/typescript-tools.nvim -- - -- But for many setups, the LSP (`tsserver`) will work just fine + -- But for many setups, the LSP (`ts_ls`) will work just fine -- Note that `rust-analyzer` is done via mrcjkb/rustaceanvim plugin above, do not register it here. lua_ls = { capabilities = capabilities, @@ -120,6 +140,7 @@ return { }, }, }, + -- Using rustaceanvim now -- rust_analyzer = { -- capabilities = capabilities, -- settings = { @@ -136,12 +157,6 @@ return { nil_ls = { -- nix capabilities = capabilities, }, - -- tsserver = { - -- -- typescript/javascript - -- implicitProjectConfiguration = { - -- checkJs = true, - -- }, - -- }, ts_ls = { -- typescript/javascript capabilities = capabilities, diff --git a/lua/plugins/rustaceanvim.lua b/lua/plugins/rustaceanvim.lua deleted file mode 100644 index 396c799..0000000 --- a/lua/plugins/rustaceanvim.lua +++ /dev/null @@ -1,19 +0,0 @@ -vim.g.rustaceanvim = { - tools = { - enable_clippy = true, - enable_nextest = true, - reload_workspace_from_cargo_toml = true, - }, - server = { - -- cmd = { "nix", "run", "nixpkgs#rust-analyzer" }, - }, -} - -return { - "mrcjkb/rustaceanvim", - version = "^5", - lazy = false, -- already lazy - ft = { "rust" }, - keys = {}, - command = "RustLsp", -}