-
Notifications
You must be signed in to change notification settings - Fork 164
Incorrectly reports missing Cargo.toml if it's not in the root #222
Comments
Yes... It also happens to me... |
I think the error message has been changed to
(cf. #207) meaning that rls-vscode expects cargo.toml to be at the root of your workspace. Sadly, this implies we have to find a workaround for multi-lang projects (for example, use the "Add folder to workspace" feature in vscode) 🤔
|
What about a feature instead that instead allows you to sepcify what folder the |
I perused some of the extension's code but could not find how to hack it so that the 'root_path' for Cargo.toml is different from The commit message says:
Maybe we need it back? 😊 Update: I misunderstood the first intent of } else if (rls_root) {
const env = await makeRlsEnv();
console.info('running `cargo run` in ' + rls_root);
childProcessPromise = Promise.resolve(child_process.spawn(
CONFIGURATION.rustupPath, ['run', CONFIGURATION.channel, 'cargo', 'run', '--release'],
{ cwd: rls_root, env })
);
} Update: I think I went a bit fast; Update2: setting cwd at the |
Yup! Seems like that's it. Especially with neon/ffi-like modules I think people would like this customized instead of having two VS Code workspaces open at the same time to have rls functionality. |
Fixes rust-lang#222. This patch is quite hacky and may reveal my lack of knowledge on the RLS or LSP architectures. My idea was to give the user the opportunity using the variable `rust-client.cargoSubdir` to select a subdirectory as the root for the Cargo.toml file. To do that, I hacked the vscode's workspaceFoldervariable; my hack won't work with multi-workspaces. Alternate solutions: - (not so good idea) add a new setting to the initialize JSON-RPC (similar to the existing `omitInitBuild` in the rls server) that would set a different path that the one given by vscode's workspaceFolder. - (better) we add support for multi-root workspaces in the RLS server; (mentionned in <rust-lang/rls#608>) but this does not really help when we want to open a general project where one of the subfolders is a rust project. - we tell people that in order to get RLS working in a subdirectory, they must use the 'Multi-crate projects' feature or the 'rlsCommandOverride' feature (see README at <https://github.com/mehcode/atom-ide-rust>).
Any progress on this feature? |
This issue is really annoying when working with a rust, rarely is rust my sole project. |
You are right, my hack does not really help in these scenarios. Let us imagine we have open vscode in an hypothetical
Now, let's imagine a scenario:
@jannickj Does this scenario fit your expectation of how the extension should operate? |
@maelvalais yes that's exactly how I would love it to operate :) |
#457 implements what @maelvalais proposed |
@nrc, I'm really looking forward to having this feature, do you know when you have time to look at it? |
I'm working on a small multi-lang project where the
Cargo.toml
is in a child of the root directory:It incorrectly reports that:
Of course,
Cargo.toml
is in the workspace…The text was updated successfully, but these errors were encountered: