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

Error when .vscode/settings.json sets rust-analyzer.checkOnSave.* #538

Closed
axelkar opened this issue Oct 15, 2024 · 5 comments · Fixed by #539
Closed

Error when .vscode/settings.json sets rust-analyzer.checkOnSave.* #538

axelkar opened this issue Oct 15, 2024 · 5 comments · Fixed by #539

Comments

@axelkar
Copy link

axelkar commented Oct 15, 2024

attempt to index local 'tbl' (a boolean value)
stack traceback:
        ...ages/start/rustaceanvim/lua/rustaceanvim/config/json.lua:9: in function 'tbl_set'
        ...ages/start/rustaceanvim/lua/rustaceanvim/config/json.lua:7: in function 'tbl_set'
        ...ages/start/rustaceanvim/lua/rustaceanvim/config/json.lua:7: in function 'tbl_set'
        ...ages/start/rustaceanvim/lua/rustaceanvim/config/json.lua:18: in function 'override_tbl_values'
        ...ages/start/rustaceanvim/lua/rustaceanvim/config/json.lua:37: in function 'override_with_json_keys'
        ...ages/start/rustaceanvim/lua/rustaceanvim/config/json.lua:45: in function 'override_with_rust_a
nalyzer_json_keys'
        ...ackages/start/rustaceanvim/lua/rustaceanvim/lsp/init.lua:69: in function 'get_start_settings'
        ...ackages/start/rustaceanvim/lua/rustaceanvim/lsp/init.lua:127: in function 'start'
        ...ustaceanvim-5.11.0-1-unstable-5.11.0-1/ftplugin/rust.lua:56: in main chunk

The default config has checkOnSave = false, but the VSCode config file sets checkOnSave.allTargets = false. Could rustaceanvim read the VSCode config as check.allTargets = false?

https://archive.is/JJKBW#rust-analyzer.checkOnSave.allTargets
https://rust-analyzer.github.io/manual.html#rust-analyzer.check.allTargets

@mrcjkb
Copy link
Owner

mrcjkb commented Oct 15, 2024

hey 👋

As per the documentation, the correct config is to use check.* and to set checkOnSave as a boolean.

Vscode may allow parsing checkOnSave as a json object for backward compatibility reasons, but I see no reason to do this in rustaceanvim. It just adds complexity and users can simply correct their json config files.
If vscode persists checkOnSave as a json object, then that's likely a bug in the rust-analyzer vscode extension.

@mrcjkb mrcjkb closed this as not planned Won't fix, can't repro, duplicate, stale Oct 15, 2024
@axelkar
Copy link
Author

axelkar commented Oct 15, 2024

I understand that and I certainly hope to have all projects fix their configs but there are lots of repos with .vscode/settings.json files that haven't been migrated over yet. I see not supporting the same fixup as VSCode as a bug in rustaceanvim. At the least, rustaceanvim should just ignore the VSCode config and not crash.

@axelkar
Copy link
Author

axelkar commented Oct 15, 2024

https://github.com/search?q=checkOnSave.allTargets&type=code

There's more than 1.2k results here

@mrcjkb
Copy link
Owner

mrcjkb commented Oct 15, 2024

At the least, rustaceanvim should just ignore the VSCode config and not crash.

Fair. I'm fine with issuing a health check warning if the config is invalid or can't be parsed.

There's more than 1.2k results here
[...] I see not supporting the same fixup as VSCode as a bug in rustaceanvim.

It's not like a single individual is going to have to migrate 1.2k project configs.
I agree that crashing on invalid configs can be considered a bug, but not adding complexity to support undocumented/deprecated features definitely isn't.

@axelkar
Copy link
Author

axelkar commented Oct 18, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants