Skip to content

Commit

Permalink
fix(nvim): Comment out config breaking rust-analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjones2014 committed Oct 31, 2023
1 parent 194ef38 commit 8656a94
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions nvim/lua/my/lsp/rust.lua
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
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) then
return
end

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

local target_dir = config.root_dir .. '/target/ide-clippy'
table.insert(checkOnSave.extraArgs, '--target-dir=' .. target_dir)
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
--
-- 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,
settings = {
['rust-analyzer'] = {
checkOnSave = {
Expand Down

0 comments on commit 8656a94

Please sign in to comment.