Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust-tools with AstroVim #294

Closed
sbeyer opened this issue Apr 16, 2022 · 3 comments
Closed

rust-tools with AstroVim #294

sbeyer opened this issue Apr 16, 2022 · 3 comments
Labels
question Further information is requested

Comments

@sbeyer
Copy link
Contributor

sbeyer commented Apr 16, 2022

I'm trying to get rust-tools to work with AstroVim. So I added 'simrat39/rust-tools.nvim' in my lua/user/plugins/init.lua, however, AstroVim uses nvim-lsp-installer, which needs some customization to work with rust-tools, see simrat39/rust-tools.nvim#89 and https://github.com/williamboman/nvim-lsp-installer/wiki/Rust ... as a lazy person, I simply took the code from the latter (which seems to be the most basic configuration that just works), and wrote a lua/user/lsp/server_registration.lua file which contains (in its current form after some unsuccesful attempts):

return function(server, opts)
  -- Integration of rust-tools
  -- from https://github.com/williamboman/nvim-lsp-installer/wiki/Rust
  if server.name == "rust_analyzer" then
    -- Initialize the LSP via rust-tools instead
    require("rust-tools").setup {
        -- The "server" property provided in rust-tools setup function are the
        -- settings rust-tools will provide to lspconfig during init.            -- 
        -- We merge the necessary settings from nvim-lsp-installer (server:get_default_options())
        -- with the user's own settings (opts).
        server = vim.tbl_deep_extend("force", server:get_default_options(), opts),
    }
    server:attach_buffers()
    -- Only if standalone support is needed
    require("rust-tools").start_standalone_if_required()
  else
    server:setup(opts)
  end
end

This, however, does not work. (File is definitely read... writing gibberish into the file leads to errors.)

Any ideas?

@sbeyer
Copy link
Contributor Author

sbeyer commented Apr 16, 2022

Okay, now I have tried so many different things with rust-tools which all lead to the warning message that "rust-analyzer" has not been found, that I did not notice that my solution above indeed works, except that it still prints this warning message. This, however, seems to be unrelated from AstroVim. Closed again ;)

@sbeyer sbeyer closed this as completed Apr 16, 2022
@mehalter mehalter added the question Further information is requested label Apr 16, 2022
@sbeyer
Copy link
Contributor Author

sbeyer commented Apr 16, 2022

I didn't even notice that the topic rust-tools is mentioned and managed in the README.md file :O
(A general drawback of highly modular systems: where do you look when there are issues in the interaction of modules.)

@mehalter
Copy link
Member

Yeah hopefully the new rebranded website and everything will have much clearer documentation and a better resource for "where to look". Looking forward to the nvim 0.7 PR to be finalized!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants