From cd0cfc7c9749d31e596196705a7dde3b558a1095 Mon Sep 17 00:00:00 2001 From: cailue Date: Fri, 18 Aug 2023 22:28:03 +0800 Subject: [PATCH] fix: make rust analyzer could auto start patch refers to: https://github.com/simrat39/rust-tools.nvim/issues/397#issuecomment-1609662279 Signed-off-by: cailue --- lua/modules/plugins/completion.lua | 8 +++++++- lua/modules/plugins/lang.lua | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lua/modules/plugins/completion.lua b/lua/modules/plugins/completion.lua index 063cc9e18..168a899e6 100644 --- a/lua/modules/plugins/completion.lua +++ b/lua/modules/plugins/completion.lua @@ -7,13 +7,19 @@ completion["neovim/nvim-lspconfig"] = { config = require("completion.lsp"), dependencies = { { "williamboman/mason.nvim" }, - { "williamboman/mason-lspconfig.nvim" }, { "Jint-lzxy/lsp_signature.nvim", config = require("completion.lsp-signature"), }, }, } + +completion["williamboman/mason-lspconfig.nvim"] = { + lazy = true, + event = { "CursorHold", "CursorHoldI" }, + dependencies = { "neovim/nvim-lspconfig" }, +} + completion["nvimdev/lspsaga.nvim"] = { lazy = true, event = "LspAttach", diff --git a/lua/modules/plugins/lang.lua b/lua/modules/plugins/lang.lua index 5154e9401..05a280dd0 100644 --- a/lua/modules/plugins/lang.lua +++ b/lua/modules/plugins/lang.lua @@ -8,7 +8,8 @@ lang["fatih/vim-go"] = { } lang["simrat39/rust-tools.nvim"] = { lazy = true, - ft = "rust", + ft = { "rust", "rs" }, + event = { "BufReadPost *.rs" }, config = require("lang.rust-tools"), dependencies = { "nvim-lua/plenary.nvim" }, }