Skip to content
This repository was archived by the owner on Nov 18, 2022. It is now read-only.

Allow having Cargo.toml in a subdirectory with rust-client.cargoSubdir #334

Closed
wants to merge 1 commit into from

Conversation

maelvls
Copy link
Contributor

@maelvls maelvls commented Jun 7, 2018

Fixes #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 Implement Workspace Folders LSP protocol extension 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).

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>).
@nrc
Copy link
Member

nrc commented Jun 26, 2018

I recently landed support for multi-root workspaces in the VSCode extension (using one language server per workspace folder, rather than just one). Does that let you add a per-folder setting to do this?

I think that just having one setting for all projects is a bit of a blunt instrument for this.

@Xanewok
Copy link
Member

Xanewok commented Mar 19, 2019

Support has landed for the multi-root workspaces and it seems to work quite well now, so I'd like to close this PR if you don't mind.

@Xanewok Xanewok closed this Mar 19, 2019
@maelvls maelvls deleted the cargo-toml-in-subdir branch March 19, 2019 13:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants