3 files changed,
28 insertions(+),
7 deletions(-)
jump to
| M | lua/fk/lsp/init.lua |
| M | lua/fk/plugin.lua |
| A | lua/fk/plugin/rust-tools.lua |
M
lua/fk/lsp/init.lua
@@ -1,31 +1,38 @@
-local on_attach = require "fk.lsp.attach" local diagnostic = require "fk.lsp.diagnostic" +local on_attach = require "fk.lsp.attach" local M = {} function M.setup() - -- Diagnostics vim.diagnostic.config(diagnostic) for _, sign in ipairs(diagnostic.signs.active) do vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" }) end + require "fk.lsp.null" require("nvim-lsp-installer").on_server_ready(function(server) - require "fk.lsp.null" -- null-ls setup local opts = { on_attach = on_attach, capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()), flags = { debounce_text_changes = 150 }, } - - -- setup server config if it exists - require("lua-dev").setup() local ok, server_opts = pcall(require, "fk.lsp.providers." .. server.name) if ok then opts = vim.tbl_deep_extend("force", opts, server_opts or {}) end - server:setup(opts) + if server.name == "sumneko_lua" then + opts = vim.tbl_deep_extend("force", opts, require("lua-dev").setup {}) + end + if server.name == "rust_analyzer" then + opts = vim.tbl_deep_extend("force", server:get_default_options(), opts) + require "fk.plugin.rust-tools"(opts) + server:attach_buffers() + vim.cmd [[ do User LspAttachBuffers ]] + return + end + + server:setup(opts) vim.cmd [[ do User LspAttachBuffers ]] end) end
M
lua/fk/plugin.lua
@@ -35,6 +35,7 @@ }
-- language specific use { "~/code/gopher.nvim", ft = "go" } + use { "simrat39/rust-tools.nvim", module = "rust-tools" } -- appearance use { "folke/which-key.nvim", config = get_config "fk.plugin.whichkey" }
A
lua/fk/plugin/rust-tools.lua
@@ -0,0 +1,13 @@
+---@param opts table +return function(opts) + require("rust-tools").setup { + server = opts, + tools = { + inlay_hints = { + parameter_hints_prefix = "<- ", + other_hints_prefix = "=> ", + highlight = "LspCodeLens", + }, + }, + } +end