bug: VSCode settings break things when opening a subfolder
Did you check docs and existing issues?
- [X] I have read all the neoconf.nvim docs
- [X] I have searched the existing issues of neoconf.nvim
- [X] I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
0.9.1
Operating system/version
Linux or MacOS
Describe the bug
Relative paths in values within .vscode/settings.json files don't work if being pulled from a parent directory outside the scope/folder currently being opened in nvim.
My particular issue context
I have a nested folder structure containing multiple "projects" with the top-level containing a .vscode/settings.json file.
There is a setting for rust analyzer that goes into vscode's settings.json called LinkedProjects where you put an array of relative paths for vscode to pick up your projects properly.
This essentially keeps vscode working as expected when you have one or more rust projects not at the root folder.
How it's breaking
When opening one of these in nvim so that a single rust project is essentially the root folder, it breaks rust analyzer (oddly just all proc macros) with a pretty much un-Googleable error:
proc macro
mainnot expanded: proc macro crate is missing dylib
This is due to it going up beyond the root folder being opened, finding a .vscode/settings.json file up in a parent folder somewhere and applying those settings relative to the folder you have opened in nvim NOT relative to the .vscode folder it found the settings in.
Workaround
My current workaround after realising what was breaking it was to just have a .neoconf.json file inside each subfolder setting import -> vscode to false:
{
"import": {
"vscode": false
}
}
Not great if you actually need other settings from vscode's settings but at the moment I don't.
Steps To Reproduce
I imagine there is a much simpler way to reproduce the underlying issue but in my specific case:
-
Install rust with rustup.
-
Install nvim (I used LazyVim this time but all others I tried such as Astro etc all reproduced it).
-
Add rust-analyzer with Mason.
-
Quit nvim.
-
Create a new folder to act as the root folder and within it create the following
.vscode/settings.jsonfile:
{
"rust-analyzer.linkedProjects": [
"./stuff/Cargo.toml"
]
}
- Create a new sub project with
cargo new stuff - Add something to the dependencies that uses proc macros to the
Cargo.tomlfile, ie:
[dependencies]
tokio = { version = "1.32.0", features = ["full"]
- Then use it in
src/main.rs:
#[tokio::main]
async fn main() {
println!("Hello, world!");
}
-
Now the hierarchy should look like:
/.vscode/settings.json/stuff/Cargo.toml/stuff/src/main.rsother files created automatically bycargo newomitted. -
cdintostuffand run:
nvim .
- Go into
main.rs, wait for rust-analyzer to index and be greeted with an error on the#[tokio::main]line.
Expected Behavior
Ideally either:
- do not load .vscode/settings.json files from a parent outside the current folder scope.
- if loading values that are relative paths, change them to still be correct (maybe prepend /../ as needed).
Repro
I used the current out-the-box LazyVim