diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 5257273..95786f1 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -84,4 +84,8 @@ local on_attach = function(client, bufnr) end +-- Code actions +-- TODO: Generalize to LSP or only attach on Rust buffers +map('n', 't', 'RustTest', options) -- Run test under cursor + return { on_attach = on_attach } diff --git a/lua/lsp.lua b/lua/lsp.lua index efa2098..b885621 100644 --- a/lua/lsp.lua +++ b/lua/lsp.lua @@ -1,3 +1,22 @@ local on_attach = require'keybindings'.on_attach local capabilities = require'cmp_nvim_lsp'.update_capabilities(vim.lsp.protocol.make_client_capabilities()) local cmp = require'nvim-cmp-cfg'.cmp + +-- SERVERS +-- rust_analyzer +vim.g.rustfmt_autosave = 1 +require'lspconfig'.rust_analyzer.setup{ + on_attach = on_attach, + capabilities = capabilities, + settings = { + ["rust-analyzer"] = { + procMacro = { + enable = true, + }, + checkOnSave = { + command = 'clippy', + extraArgs = "-W clippy::pedantic" + }, + } + } +} diff --git a/lua/plugins.lua b/lua/plugins.lua index 8762a60..d14f765 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -31,9 +31,16 @@ local plugins = require('packer').startup(function(use) use 'hrsh7th/cmp-vsnip' use 'hrsh7th/vim-vsnip' + -- Language Specfic + use 'rust-lang/rust.vim' + if packer_bootstrap then require('packer').sync() end end) +-- Required for rust.vim +-- TODO: Convert to lua +vim.cmd([[filetype plugin indent on]]) + return plugins