nix-community / nixos-vscode-server

Visual Studio Code Server support in NixOS
MIT License
387 stars 75 forks source link

Rust-analyzer support #72

Open chrisguida opened 9 months ago

chrisguida commented 9 months ago

How can I add extensions to vscode-server such as rust-analyzer?

This would be amazing as I would be able to use rust-analyzer while coding on a remote machine.

samuela commented 5 months ago

You can already do this just as with any other extension installation. Go to the "Extension Marketplace" and enable the rust-analyzer extension. It will auto-detect NixOS and make the appropriate adjustments.

chrisguida commented 4 months ago

Hmm, this definitely didn't work when I tested. Is this a new feature?

N-T-K commented 4 months ago

@chrisguida in your configuration.nix

environment.systemPackages = with pkgs; [
    vscode-extensions.rust-lang.rust-analyzer

  ];

https://search.nixos.org/packages?channel=23.11&show=vscode-extensions.rust-lang.rust-analyzer&from=0&size=50&sort=relevance&type=packages&query=vscode-extensions.rust-lang.rust-analyzer

chrisguida commented 4 months ago

@N-T-K thanks, that seems to have gotten me partly there

I now have this:

2024-04-25T19:19:36.599526Z ERROR rust_analyzer::main_loop: FetchWorkspaceError:
rust-analyzer failed to load workspace: Failed to load the project at /home/cguida/work/smaug/Cargo.toml: Failed to query rust toolchain version at /home/cguida/work/smaug, is your toolchain setup correctly?: cd "/home/cguida/work/smaug" && "cargo" "--version" failed: No such file or directory (os error 2)

cargo doesn't exist because it's inside nix develop. how can i fix this?