Closed lukashermansson closed 4 months ago
Hi, I think it would be a good idea to add this to the readme as an alternative way to set up, including an admonition that warns users that this is an experimental feature of rust_analyzer
.
When this becomes stable, I would say this is the superior way of setting up leptosfmt
(as it is editor agnostic)
Hey! thanks for the feedback, sounds like a good plan.
I was able to conclude under what editors this feature seems to currently work under all with the env configured to have the binary: rust-analyzer 1.81.0-nightly (6292b2a 2024-07-02) available
rust-analyzer
- worksAny other setup that is common enough to leave a comment about?
If nothing else I will begin drafting a pr with documentation on how to set it up and the caveats surrounding the feature tomorrow!
Hi,
You don't have to mention specific editors, you could place the documentation under "Usage with Rust Analyzer", any editor that uses the new version rust_analyzer
LSP will work out of the box. As you mentioned, Rust Rover is an IntelliJ based editor, and they don't use Rust Analyzer but have built their alternative (that does not implement the language server protocol).
That said, here are a few other noteworthy editors that have LSP support (out of my head): Helix, Zed, Lapce, Fleet (Jetbrains editor that does use Rust Analyzer)
any editor that uses the new version
rust_analyzer
LSP will work out of the box.
Yes, that is correct, I was trying to find out if any editor bundles a version that does not have this feature built in already, but that might be overkill, it does feel like the standard is to rely on the rust_analyzer
available on the path. It lead to some interesting insights about vscode
however so maybe the effort is not completely wasted.
Thanks for the help, expect to see a pr in the next couple of days with additions to the readme on how to set it up using this alternative way.
This pr: https://github.com/rust-lang/rust-analyzer/pull/17058 adds support for project based rust-analyzer configuration file.
Adding the below section to rust-analyzer.toml in any leptos project you want to format with leptosfmt:
does in my experience make rust-analyzer use leptosfmt for formatting my specific setup is based on neovim, so not sure if it integrates with other editors.
Not sure if its stable enough to document it as a way to have our editors run leptosfmt. As can be noted in the referenced pr:
If you feel like its a worthwhile addition to the readme regardless of its stability I could attempt a pr with documentation. For this I suppose I would have to find out under what setups this works with, (calling out to any readers, if you can figure out if this feature is available under your setup it would be awesome)