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

health check reports .vscode settings loaded on empty directory #653

Open
mrcjkb opened this issue Jan 9, 2025 · 0 comments
Open

health check reports .vscode settings loaded on empty directory #653

mrcjkb opened this issue Jan 9, 2025 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@mrcjkb
Copy link
Owner

mrcjkb commented Jan 9, 2025

Looking at this:

local function find_vscode_settings(bufname)
local settings = {}
local found_dirs = vim.fs.find({ '.vscode' }, { upward = true, path = vim.fs.dirname(bufname), type = 'directory' })
if vim.tbl_isempty(found_dirs) then
return settings
end

If I run this:

vim.fs.find({ '.vscode' }, { upward = true, path = vim.fs.dirname(bufname), type = 'directory' })

It returns an empty table. Which then returns an empty table here:

if vim.tbl_isempty(found_dirs) then
return settings
end

That is used here:

if config.server.load_vscode_settings then
local json_settings = find_vscode_settings(bufname)
require('rustaceanvim.config.json').override_with_rust_analyzer_json_keys(evaluated_settings, json_settings)
end

Which triggers this:

function M.override_with_rust_analyzer_json_keys(tbl, json_tbl)
M.override_with_json_keys(tbl, json_tbl, function(key)
return vim.startswith(key, 'rust-analyzer')
end)
end

Which triggers this:

function M.override_with_json_keys(tbl, json_tbl, key_predicate)
is_json_config_loaded = true
for json_key, value in pairs(json_tbl) do
if not key_predicate or key_predicate(json_key) then
override_tbl_values(tbl, json_key, value)
end
end
end

Which then sets is_json_config_loaded = true, even though it was an empty table because there was no JSON.

That then triggers the "loaded vscode json" message in the healthcheck. So I don't believe that's relevant in this case, unless the fact that it things an (empty) vscode file was loaded makes it not inject the check config, but I haven't checked if that's the case.

Originally posted by @JeanMertz in #652 (reply in thread)

@mrcjkb mrcjkb added bug Something isn't working good first issue Good for newcomers labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant