Configuring rust-analyzer via ls_specific_settings #1515
Replies: 2 comments
-
Yes, then Serena will use your IDE's code intelligence for its operations and not run any language server processes. So you will get a much more reliable and powerful integration, any symbols indexed by your IDE (including external dependencies) will be available to Serena and thereby to your agent. |
Beta Was this translation helpful? Give feedback.
-
|
Serena with the LSP backend is fundamentally a single-project approach. So while you may make some adjustment to make your use case work, it may not be trivial to get the full functionality. We generally expose many configuration options and document them extensively, please see our docs for that. If you want to work on a solution for this kind of setup (by enhancing our configuration), feel free to issue a PR. But the simplest thing for you personally is certainly to just use the JetBrains plugin. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm very new to this, still finding my way.
I have Claude Code, Serena, and a medium-sized mono-repository, with Python and Rust code. I've configured Serena for the Python parts, but I've run into issues with Rust.
The cause seems to be that my mono-repo consists of several Cargo workspaces, let's say in directories
sub1/rustandsub2/alt/rust. They are not independent (crates in one reference crates in the other), so they cannot really be considered separate projects, as refactoring changes tend to span both workspaces.Out of the box, Serena wasn't able to configure rust-analyzer for this configuration because of an assumption that the root of the project contains
Cargo.toml(and maybe I made a mistake here - should it be possible?). Instead, I manually patchedsolidlsp/language_servers/rust_analyzer.pyto recognise the following config snippet:The patch was simple:
This worked, and Serena was able to run rust-analyzer across both workspaces.
I continued with this for an hour or so before I ran into another problem - rust-analyzer needed to know about a feature flag in one of the workspaces, for both
cargoandcheck:Now this is starting to get complicated, and the patch needs to merge a larger tree into rust-analyzer's
initializationOptions.Unless I'm wrong, it seems that there is no support for configuring rust-analyzer (yet)? There doesn't seem to be any config plumbing from
ls_specific_settings.rustintoinitializationOptions, like there is ingopls.py.At this point I thought I'd better stop and ask for directions...
(I actually use JetBrains IDEA - if I use the plugin can I avoid rust-analyzer completely? Would still be good to understand how it all works at a lower level, though)
Note: I'm using the Claude Code system-prompt workaround for Opus 4.7.
Beta Was this translation helpful? Give feedback.
All reactions