-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
minor: Read workspace root ratomls on startup #17661
Conversation
crates/load-cargo/src/lib.rs
Outdated
if !matches!(ws.kind, ProjectWorkspaceKind::DetachedFile { .. }) { | ||
let ws_root = ws.workspace_root(); | ||
file_set_roots.push(VfsPath::from(ws_root.to_owned())); | ||
entries.push(ws_root.to_owned()); | ||
register = true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should specifically push the rust-analyzer.toml
file path here, not the workspace root itself. We only want to watch that one file there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry ofc I meant to write that. 😞
crates/load-cargo/src/lib.rs
Outdated
res.load.push(entry); | ||
local_filesets.push(fsc.len() as u64); | ||
fsc.add_file_set(file_set_roots) | ||
if register { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
register
can be replaced by checking whether entries
and/or file_set_roots
is empty or not
@bors r+ |
☀️ Test successful - checks-actions |
Given #17246, it's still not being read early enough -- there is a pretty big chicken/egg problem with configs like this: [workspace.discoverConfig]
... We don't read rust-analyzer.toml until workspaces have already been discovered (to find the root), and we can't discover a workspace because haven't read it. I think we need to search upwards from the current working directory to find a rust-analyzer.toml to use on startup. For rust-analyzer.toml users, these configs will never be populated in src/bin/main.rs: rust-analyzer/crates/rust-analyzer/src/bin/main.rs Lines 268 to 273 in f46af90
|
Well, we should actually not allow We are in general planning a slight restructuring of config grouping as the current structure has some problems. |
Configuring a repo to discover non-cargo workspaces for anyone who opens it is one of the main difficulties I was hoping rust- analyzer.toml would solve, so I really hope we can break the chicken/egg somehow. |
We definitely want to have some solution there, but the current implementation isn't sufficient for that (its really just an MVP atm). |
That's a valid point to which I have no answer atm. But I am making a separate issue from this and I will find a way to address this |
No description provided.