This repository was archived by the owner on Jan 3, 2024. It is now read-only.
Please i need help with the configuration. #358
Unanswered
luismeramosr
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, i tried to configure in many ways rust-tools and rust-analyzer to accomplish the same behavior of navigating to a definition of an external crate type, like in VSCode.
Let me explain myself better.
In that image i already opened the main.rs file of a project (rust-analyzer has already loaded), i have some errors, then i want to go to the definition of some type like String.
As you can see i have the same errors as before, rust-analyzer did not perform any cargo check or anything.
But in Neovim i have this issue.
At first there is no problem and everything works as intended, until i try to go to the definition of String or any type wich is outside of my project.
Rust-analyzer performs a cargo check, and then this happens.
I don't know what to do, i will put here my rust-tools config, im using kickstart.nvim as a base config: https://github.com/nvim-lua/kickstart.nvim. And the only thing i did was separate the init.lua into multiple files and setup rust-tools.
My rust-tools config:
local rt = require("rust-tools")
local lsp = require("plugins.config.lsp") -- The lspconfig part of kickstart.nvim in a separate file, only exports on_attach()
local lspconfig = require("lspconfig")
rt.setup({
tools = {
reload_workspace_from_cargo_toml = false,
inlay_hints = {
-- automatically set inlay hints (type hints)
-- default: true
auto = true,
-- Only show inlay hints for the current line
only_current_line = false,
-- whether to show parameter hints with the inlay hints or not
-- default: true
show_parameter_hints = true,
-- prefix for parameter hints
-- default: "<-"
parameter_hints_prefix = "<- ",
-- prefix for all the other hints (type, chaining)
-- default: "=>"
other_hints_prefix = "=> ",
-- whether to align to the length of the longest line in the file
max_len_align = false,
-- padding from the left if max_len_align is true
max_len_align_padding = 1,
-- whether to align to the extreme right or not
right_align = false,
-- padding from the right if right_align is true
right_align_padding = 7,
-- The color of the hints
highlight = "Comment",
},
hover_actions = {
-- the border that is used for the hover window
-- see vim.api.nvim_open_win()
border = {
{ "╭", "FloatBorder" },
{ "─", "FloatBorder" },
{ "╮", "FloatBorder" },
{ "│", "FloatBorder" },
{ "╯", "FloatBorder" },
{ "─", "FloatBorder" },
{ "╰", "FloatBorder" },
{ "│", "FloatBorder" },
},
-- Maximal width of the hover window. Nil means no max.
max_width = nil,
-- Maximal height of the hover window. Nil means no max.
max_height = nil,
-- whether the hover action window gets automatically focused
-- default: false
auto_focus = false,
},
},
server = {
standalone = false,
on_attach = lsp.on_attach,
settings = {
["rust-analyzer"] = {
cachePriming = {
enable = true
},
lens = {
enable = true
},
checkOnSave = {
command = "clippy"
},
cargo = {
buildScripts = {
enabled = false,
}
},
procMacro = {
enable = true,
},
completion = {
autoimport = {
enable = true,
},
autoself = {
enable = true,
},
},
},
},
},
})
Beta Was this translation helpful? Give feedback.
All reactions