diff --git a/ftplugin/rust.lua b/ftplugin/rust.lua index e905a64f..be2a809d 100644 --- a/ftplugin/rust.lua +++ b/ftplugin/rust.lua @@ -1,3 +1,9 @@ +if vim.b.did_ftplugin_rustacean then + return +end + +vim.b.did_ftplugin_rustacean = 1 + ---@type RustaceanConfig local config = require('rustaceanvim.config.internal') local types = require('rustaceanvim.types.internal') diff --git a/lua/rustaceanvim/lsp.lua b/lua/rustaceanvim/lsp.lua index a920e1a1..6af46ade 100644 --- a/lua/rustaceanvim/lsp.lua +++ b/lua/rustaceanvim/lsp.lua @@ -256,6 +256,15 @@ M.start = function(bufnr) end end + if not root_dir and vim.tbl_isempty(rust_analyzer.get_active_rustaceanvim_clients(bufnr)) then + return vim.lsp.start(lsp_start_opts, { + reuse_client = function() + return false + end, + bufnr = bufnr, + }) + end + return vim.lsp.start(lsp_start_opts) end