-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
overrideCommand with a relative path (./miri
/./x.py
) does not work very well, and that is very hard to debug
#10793
Comments
This comment has been minimized.
This comment has been minimized.
The stderr of cargo is read but never presented to the user: https://github.com/rust-analyzer/rust-analyzer/blob/d1e756e05aab5410f6176fce26bf021453708b9b/crates/flycheck/src/lib.rs#L292 |
Also, running This is also a regression, the same configuration used to work fine a few months ago. |
This excerpt from the log might be interesting though it does not tell me much
Could it be the case that it starts |
It sees two workspaces: One for |
That is new behavior though I think? We had two workspaces for a while. I don't remember exactly why but I do remember that making them one workspace did not work the way I wanted it to.
|
I confirmed @bjorn3's theory by creating a dummy script Unfortunately, vscode still does not show errors or warnings for the cargo-miri crate -- it used to be enough to add it to But it looks like |
hack to work around RA quirk This is a gross hack to work around rust-lang/rust-analyzer#10793: calling `cargo-miri/miri` does the same thing as calling `./miri`. `@oli-obk` this is the best I could come up with... not sure if we want to have this in the repo. I am also okay with carrying `cargo-miri/miri` locally.
10875: minor: Don't discard flycheck error messages r=Veykril a=Veykril cc #10793 bors r+ Co-authored-by: Lukas Wirth <[email protected]>
Current status: pretty much unchanged.
Part of the problem here is that I expected the overrideCommand to be a single global setting, not something that RA uses separately for each project. #13065 should help a bit with that, at least. For Miri, we have a pretty decent work-around with rust-lang/miri#2495. But for |
./miri
/./x.py
) does not work very well, and that is very hard to debug
So here's a possible plan:
I think together this should mean that the existing recommended override command for rustc will actually work as intended even when adding Cc @jyn514 for |
document interaction of checkOnSave.overrideCommand and multiple linked projects Cc #10793 r? `@Veykril`
So I've been brain storming a bit. First up, this also affects build-scripts (and proc-macro building as well therefore), not just checkOnSave. I believe there are 3 variants of what people might want from this:
Does this seem right? |
Yeah sounds good -- though if the per-workspace command is needed, then also having a global command does not seem that useful. I was thinking of global commands mostly because I was sure the command would be global (an implicit assumption I did not even realize I was making), and the documentation did not indicate anything else, so I was taken by surprise when I realized that it is per-workspace. But doing this per-workspace makes sense, it'd just be good to find a way to do that that does not involve changing the working directory, while also working around rust-lang/cargo#11007. |
The working dir switching was done for cargo I imagine since that just works, but it might break for custom commands. I think offering both version, switching working dir or passing the project path offers the most flexibility for users in regards to override commands, so I don't think offering both hurts. The main problem is really implementing the first point, running it once for the entire project in regards to diagnostic paths as you've said with rust-lang/cargo#11007 |
Also #8937 is probably related to this |
Yeah, I don't think there even is a reliable way to take the file paths that come out of But I think a per-workspace command that stays in the project root is 'good enough'. The command might ignore the |
Why not do the same workaround you had for miri, have a symlink in
I don't understand why that would help; the least work we can do after a full |
Dunno, that symlink seems like a pretty big hack to me. Also that won't work for
Yes, and similar for the cranelift workspace -- "only check that workspace". It would do less work, wouldn't it? No need to recheck all of rustc if we just changed bootstrap. (Though what I'd really want is that when I work on |
You can tell RA that by changing the command to
x.py won't rebuild rustc if you've only modified bootstrap. So an unconditionally
ah, well, fair enough. I guess ignoring |
I know. But I also often work on the compiler and then I of course want it to check the compiler.
Yeah, that first run can take minutes though. But I agree it's probably not a big deal in practice. Changing things in the compiler will also rebuild cranelift, but that's probably a good thing -- RA seems to assume that changes to one workspace cannot cause errors in other workspaces (so it is enough to run the check-build for the workspace that changed), which is just a wrong assumption in general. |
Maybe we can have the server interpolate into the override command, so that you could just pass
This should not be the case, basically if you save a file, we fetch all crates that make use of this file, then collect all transwitive reverse dependency crates of those crates and finally we kick off the checkOnSave logic for all workspaces that contain at least on of those crates. Only if the file does not belong to some workspace we unconditionally trigger checkOnSave for all workspaces. At least that's how this is supposed to work. |
Yeah, interpolation makes sense, though there also needs to be some way to control the working directory behavior (or else existing That won't help with me having to edit the vscode config when doing library vs compiler work, as those are in the same workspace. But that's just a separate issue, sorry for bringing it up here.
Oh nice, that is a lot more clever than I expected. So we'll have to do some tests once the working directory part lands on the RA side. |
Implement invocation strategy config Fixes #10793 This allows to change how we run build scripts (and `checkOnSave`), exposing two configs: - `once`: run the specified command once in the project root (the working dir of the server) - `per_workspace`: run the specified command per workspace in the corresponding workspace This also applies to `checkOnSave` likewise, though `once_in_root` is useless there currently, due to rust-lang/cargo#11007
The current status her as far as I know:
|
With recent developments (rust-lang/miri#3798, rust-lang/rust#128904), I think the options RA provides are entirely sufficient, and documentation has also been improved to explain the working directory situation. So this can be closed; what's left is possibly simplifying the implementation (#17848). |
I am using the following workspace settings for working on Miri with vscode:
Whenever I save a file, an error pops up saying
That's all it says. I have no idea which file it is talking about, or what is even going wrong -- the
cargo check
seems to be working fine, I am getting the errors I am expected highlighted as they should. The only sign that anything going wrong is this error message, and the error is not giving any details that would be helpful in determining what is happening.The text was updated successfully, but these errors were encountered: