Skip to content

languages/rust: move rustaceanvim to extensions submodule#1624

Open
sjcobb2022 wants to merge 45 commits into
NotAShelf:mainfrom
sjcobb2022:feat/rustaceanvim
Open

languages/rust: move rustaceanvim to extensions submodule#1624
sjcobb2022 wants to merge 45 commits into
NotAShelf:mainfrom
sjcobb2022:feat/rustaceanvim

Conversation

@sjcobb2022

@sjcobb2022 sjcobb2022 commented Jun 3, 2026

Copy link
Copy Markdown

Hi all,

Quick PR to migrate the rust away from a rustaceanvim-first config, and move it to be extension based. Related to #1195.

There are a few of caveats with this approach which I would appreciate comments on. Those being:

  • For some reason rustaceanvim is unable to pick up vim.lsp.config.["rust-analyzer"].cmd even though from my reading of the source code it should be able to do so. Therefore it is set manually for now. See https://github.com/mrcjkb/rustaceanvim/blob/8727e34809a7448b10ebc660c1425c3e808a0004/lua/rustaceanvim/lsp/init.lua#L166-L173.

  • rust-analyzer is inherently, and by design, dependent on rustc and cargo. The nvim-lspconfig settings use them, and rust-analyzer itself is dependent on these tools for its own operation. If they are not in PATH, rust-analyzer is quite limited in its capabilities. My question is whether we should include them in vim.extraPackages perhaps? (or place a warning message if they are not present and a rust file is loaded).

  • I have used mkForce in 1 area to ensure that we let rustaceanvim do root_dir and on_attach functions. I do not think that this is the most idiomatic. Perhaps setting the default lsp.servers.rust-analyzer.root_dir to a very low mkOverride priority, and then making rustaceanvim override it? I feel like we would then need a warning or assertion because of the wacky priorities.

  • Should we add a warning that is present on build saying that we no longer use rustaceanvim by default, or is the changelog enough?

Made with love and without AI.

Sanity Checking

  • I have updated the changelog as per my changes
  • I have tested, and self-reviewed my code
  • My changes fit guidelines found in hacking nvf
  • Style and consistency
    • I ran Alejandra to format my code (nix fmt)
    • My code conforms to the editorconfig configuration of the project
    • My changes are consistent with the rest of the codebase
  • If new changes are particularly complex:
    • My code includes comments in particularly complex areas
    • I have added a section in the manual
    • (For breaking changes) I have included a migration guide
  • Package(s) built:
    • .#nix (default package)
    • .#maximal
    • .#docs-html (manual, must build)
    • .#docs-linkcheck (optional, please build if adding links)
  • Tested on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin

Add a 👍 reaction to pull requests you find important.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

🚀 Live preview deployed from 11985bb

View it here:

Debug Information

Triggered by: sjcobb2022

HEAD at: feat/rustaceanvim

Reruns: 3441

@sjcobb2022 sjcobb2022 changed the title feat(rust): move rustaceanvim to regular module feat(rust): move rustaceanvim to rust extension Jun 3, 2026
Comment thread modules/plugins/lsp/presets/rust-analyzer.nix Outdated
Comment thread modules/plugins/lsp/presets/rust-analyzer.nix
Comment thread modules/plugins/lsp/presets/rust-analyzer.nix Outdated
Comment thread modules/plugins/lsp/presets/rust-analyzer.nix Outdated
Comment thread modules/plugins/lsp/presets/rust-analyzer.nix Outdated
Comment thread modules/plugins/lsp/presets/rust-analyzer.nix Outdated
Comment thread modules/plugins/languages/rust.nix
Comment thread modules/plugins/languages/rust.nix
Comment thread modules/plugins/languages/rust.nix Outdated
Comment thread modules/plugins/languages/rust.nix Outdated
@NotAShelf NotAShelf changed the title feat(rust): move rustaceanvim to rust extension languages/rust: move rustaceanvim to extensions submodule Jun 3, 2026
github-actions Bot pushed a commit that referenced this pull request Jun 3, 2026
Comment thread modules/plugins/languages/rust.nix Outdated
Comment thread modules/plugins/lsp/presets/rust-analyzer.nix Outdated
@sjcobb2022

Copy link
Copy Markdown
Author

@NotAShelf @snoweuph I did have a quick question that I think is quite interesting. The current block of nvim-lspconfig settings purely is to get it working with cargo workspaces. rustaceanvim has all of the cargo workspace stuff built in.

Perhaps we could go a different approach, and use rust-analyzer without any of the cargo workspace funk in our preset, and then rely on rustaceanvim for workspace + all its other stuff.

In that way, we could keep the rust-analyzer preset super minimal, and rely on rustaceanvim to do the rest of the cool stuff.

I would appreciate any comments.

@snoweuph

snoweuph commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

@NotAShelf @snoweuph I did have a quick question that I think is quite interesting. The current block of nvim-lspconfig settings purely is to get it working with cargo workspaces. rustaceanvim has all of the cargo workspace stuff built in.

Perhaps we could go a different approach, and use rust-analyzer without any of the cargo workspace funk in our preset, and then rely on rustaceanvim for workspace + all its other stuff.

In that way, we could keep the rust-analyzer preset super minimal, and rely on rustaceanvim to do the rest of the cool stuff.

I would appreciate any comments.

I dont like the Idea of relying only partial on the LSP.
The Changes are fine, but the important info is:

The current block of settings purely is to get it working with cargo workspaces.

Basically add t hat as a comment and im fine.

@sjcobb2022

Copy link
Copy Markdown
Author

Basically add t hat as a comment and im fine.

Gotcha

Comment thread modules/extra/deprecations.nix Outdated
github-actions Bot pushed a commit that referenced this pull request Jun 25, 2026
Comment thread modules/plugins/debugger/nvim-dap/presets/codelldb.nix Outdated
Comment thread modules/plugins/languages/rust.nix
Comment thread modules/plugins/languages/rust.nix
@sjcobb2022

sjcobb2022 commented Jun 25, 2026

Copy link
Copy Markdown
Author

I have updated and added codelldb as an alternative. I couldn't get it to work with the descriminant type so I updated to using inline lua at 98b0371.

Another note is that perhasp we should have enableDAP on the maximal config by default?

Also here aresome screenshots of it working for prosterity:

raw rust:

20260625_032420

rustaceanvim:
20260625_033107

@sjcobb2022

Copy link
Copy Markdown
Author

Sorry tagged wrong person earlier oops

Comment thread modules/plugins/languages/rust.nix Outdated
Comment thread modules/plugins/languages/rust.nix
Comment thread modules/plugins/languages/rust.nix
github-actions Bot pushed a commit that referenced this pull request Jun 28, 2026
@sjcobb2022

Copy link
Copy Markdown
Author

ready for re-review btw, sorry should have said something sooner

@snoweuph

snoweuph commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator
image

just use those buttons next time:

image

:3

@snoweuph snoweuph requested review from horriblename and snoweuph July 3, 2026 20:27
@snoweuph

snoweuph commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

could you please rebase this onto the latest main branch? we finally merged the big formatter rework :3

@sjcobb2022

Copy link
Copy Markdown
Author

I gotchu

@snoweuph snoweuph left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM, please rebase on the latest main. Also, after you think something is finished please close the threads as resolved, im losing the overview xD

Also, I would prefer on this one, @horriblename giving the final go, as he did the DAP re:vamp

Thanks for your contribution and time :3

Comment thread modules/extra/deprecations.nix Outdated
Comment thread modules/extra/deprecations.nix Outdated
Comment thread modules/plugins/debugger/nvim-dap/presets/codelldb.nix Outdated
github-actions Bot pushed a commit that referenced this pull request Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants