-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Need help getting leptosfmt to work with rust-analyzer #283
Comments
Sorry, followed the method with the json file but I still cant get it to work |
Hey 👋
It says:
but I don't see this in your issue description.
|
Also, see this comment |
HI, first of all, thanks for your help, an sorry should have been more specific, I have leptosfmt working on the project, it works from terminal, but when using it to integrate it with rustaceanvim is when it fails, in vscode with this settings.json it does work. I changed the tardetDir structure, it was wrong on the first one, my bad, also I fixed it in the
"rust-analyzer.cargo.targetDir": true,
"rust-analyzer.rustfmt.overrideCommand": ["leptosfmt", "--stdin", "--rustfmt"],
"rust-analyzer.checkOnSave": true, about exrc and what I did got working, idk maybe it was because yesterday was really late for me but I couldnt make heads or tails of vim.g.rustaceanvim = {
-- Plugin configuration
tools = {},
-- LSP configuration
server = {
on_attach = function(client, bufnr)
-- you can also put keymaps in here
end,
default_settings = {
-- rust-analyzer language server configuration
["rust-analyzer"] = {
["cargo.targetDir"] = true,
["rustfmt.overrideCommand"] = { "leptosfmt", "--stdin", "--rustfmt" },
-- Additional settings appended here
cargo = {
allFeatures = true,
loadOutDirsFromCheck = true,
runBuildScripts = true,
},
checkOnSave = {
allFeatures = true,
command = "clippy",
extraArgs = { "--no-deps" },
},
procMacro = {
enable = true,
ignored = {
["async-trait"] = { "async_trait" },
["napi-derive"] = { "napi" },
["async-recursion"] = { "async_recursion" },
},
},
},
},
},
-- DAP configuration
dap = {},
} Nonetheless it still doesnt work with the formatter and the target dir doesnt change, this is also my require("config.lazy")
vim.opt.exrc = true
vim.g.rustaceanvim = {
-- ...
server = {
---@param project_root string Path to the project root
settings = function(project_root)
local ra = require("rustaceanvim.config.server")
return ra.load_rust_analyzer_settings(project_root, {
settings_file_pattern = "rust-analyzer.json",
})
end,
},
} I am using LazyVim distro so its possible something is colliding but I cant figure it out for the life of me, again really thanks for the help Just for reference here I mention the part of the lazyvim defualts that might be conflicting but I dont know enough to know if they would collide, append each other, sorry I am somewhat new with lua/nvim configs |
Hi, just wanted to mention I also tried this version of the rust-analyzer.json, as to avoid duplication of keys in case the name of the file is taken as one {
"cargo.targetDir": true,
"rustfmt.overrideCommand": ["leptosfmt", "--stdin", "--rustfmt"],
"checkOnSave": true
} |
LazyVim has a lot of plugins that could potentially conflict with rustaceanvim. I also had a look at the extras.lang.rust module and saw that it sets It should be: config = function(_, opts)
vim.g.rustaceanvim = vim.tbl_deep_extend("keep", vim.g.rustaceanvim or {}, opts or {})
end, otherwise it will just overwrite whatever you set. I don't have the capacity to support every distro and configuration that comes with loads of plugins, because every configuration is different and very difficult to reproduce reliably. |
Sorry I missed the part about the minimal config, I am trying to get the minimal config tu run but sadly I get an error saying that module lazy has not been found,
mkdir -p /tmp/minimal/
NVIM_DATA_MINIMAL="/tmp/minimal" NVIM_APP_NAME="nvim-minimal" nvim -u NORC -u minimal.lua heres the full error
Am I missing a step? 😅 |
🤔 that's very strange. |
This PR may fix the |
Hey man, thanks a lot! |
@Alt-iOS were you able to solve your problem? |
Hiiii, thanks yeah, with the PR you so kindly submitted to LazyVim, the rust-analyzer.json worked again |
Neovim version (nvim -v)
NVIM v0.9.5
Operating system/version
macos 14
Output of :checkhealth rustaceanvim
How to reproduce the issue
The text was updated successfully, but these errors were encountered: