Skip to content

Commit

Permalink
fix(nvim): Re-enable rust_analyzer optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjones2014 committed Jan 19, 2024
1 parent f4afea8 commit e29f99c
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions nvim/lua/my/lsp/rust.lua
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
return {
-- before_init = function(_, config)
-- -- Override clippy to run in its own directory to avoid clobbering caches
-- -- but only if target-dir isn't already set in either the command or the extraArgs
-- local checkOnSave = config.settings['rust-analyzer'].checkOnSave
-- local needle = '--target-dir'
-- if string.find(checkOnSave.command, needle, nil, true) then
-- return
-- end
--
-- checkOnSave.extraArgs = checkOnSave.extraArgs or {}
-- for _, v in pairs(checkOnSave.extraArgs or {}) do
-- if string.find(v, needle, nil, true) then
-- return
-- end
-- end
--
-- p({ 'before', checkOnSave.extraArgs, checkOnSave.command })
-- local target_dir = config.root_dir .. '/target/ide-clippy'
-- table.insert(checkOnSave.extraArgs, '--target-dir=' .. target_dir)
-- p({ 'after', checkOnSave.extraArgs })
-- end,
before_init = function(_, config)
-- Override clippy to run in its own directory to avoid clobbering caches
-- but only if target-dir isn't already set in either the command or the extraArgs
local checkOnSave = config.settings['rust-analyzer'].checkOnSave
local needle = '--target-dir'
if string.find(checkOnSave.command, needle, nil, true) then
return
end

checkOnSave.extraArgs = checkOnSave.extraArgs or {}
for _, v in pairs(checkOnSave.extraArgs or {}) do
if string.find(v, needle, nil, true) then
return
end
end

local target_dir = config.root_dir .. '/target/ide-clippy'
table.insert(checkOnSave.extraArgs, '--target-dir=' .. target_dir)
end,
settings = {
['rust-analyzer'] = {
checkOnSave = {
Expand Down

0 comments on commit e29f99c

Please sign in to comment.