simrat39 / rust-tools.nvim

Tools for better development in rust using neovim's builtin lsp
MIT License
2.17k stars 159 forks source link

Disable parts of plugin #364

Open Tenshock opened 1 year ago

Tenshock commented 1 year ago

The plugin makes a lot of things but all are not wanted everytime.

When I setup the plugin, it breaks my configuration and overrides some mappings.

I only want configuration for dap purpose, and particularly RustDebuggables. How can I disable all other configuration and just provide to my configuration only this command without all the rest loading?

I already have a lsp configuration set up, I don't want this plugin to interact with it

Tenshock commented 1 year ago

To be more precise, it breaks the configuration I have from nvChad, and especially all my keymaps linked to my lsp configuration.

I can't figure out from where the break happens

BingCoke commented 1 year ago

That is my problem too. rust-tools takes too many time for setup and give some features which i will not use for sometime.By the way, rust-tools will not change your keymaps so it will be another problem. lsp provide on_attach function to keymap in buffer, so if you use rust-tools , you should config lsp by youself. like this

local lsp_conf = require("lsp.lsp")
-- import rust-tools plugin safely
local rust_setup, rt = pcall(require, "rust-tools")
if not rust_setup then
  return
end

local lldb_path = "/usr/lib/codelldb/"

local codelldb_path = lldb_path .. "adapter/codelldb"
local liblldb_path = lldb_path .. "lldb/lib/liblldb.so"
-- The liblldb extension is .so for linux and .dylib for macOS
local keymap = vim.keymap -- for conciseness

rt.setup({
  dap = {
    adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path),
  },
  server = {
    capabilities = lsp_conf.capabilities,
    on_attach = function(client, bufnr)
      local opts = { noremap = true, silent = true, buffer = bufnr }
      lsp_conf.on_attach(client, bufnr)
      -- Hover actions
      vim.keymap.set("n", "<F9>", rt.hover_actions.hover_actions, opts)
    end,
    settings = { }
  }
})