Open tgross35 opened 1 year ago
My issue https://github.com/rust-lang/rust-analyzer/issues/10117 needs the needs-toml label.
My issue #10117 needs the needs-toml label.
Thanks for the link, I added it to the list
I want to point out that I am indirectly working on this issue. I am trying to implement a .rust-analyzer.toml
(#13529) file support. I hope to end up with an integrated TOML parser in ra although it is not my primary concern ( RATOML's first prototype won't be needing a TOML parser, ser-de should be enough for now). I would be happy if contributors to this issue could reach out to me so that we can talk about its implementation.
At the very least I will be making some changes to the core DBs of ra to distinguish .rs
files from .toml
s ( strictly speaking, from .rust-analyzer.toml
files and cargo.toml
files, each of which needing special care here and there).
@alibektas that sounds very cool!
I think that toml-edit
is more or less a drop in for toml
and works with the same structs with Serde. The difference is that the untyped representation (toml_edit::Document
, a strict superset of toml::Value
) has support for format preservation. Maybe it makes sense to prototype with toml-edit
instead of the usual toml
just so its use can be expanded in the future?
Not that I expect RA would be editing .rust-analyzer.toml
ever, but it could make sense for any framework that will eventually be shared with Cargo.toml
:wave:
There are couple of things that I first need to look into before giving you an answer.
1) Will RA maintainers be OK with toml-edit
being included in RA? The impression that I got thus far is that we are very conservative when it comes to using external crates. ( This I will be asking Veykril next week )
2) How well will toml-edit
be compatible with RA's incremental computation principles? ( This is a concern that goes beyond the prototyping phase. )
For the prototype your proposition seems to be the way to go, but this is just me speaking without having really looked at toml-edit
in depth. I will get back to you with a more detailed answer possibly next week, but let me at least say that I agree toml-edit
being better in this regard than toml
.
Fwiw, we most likely want to end up with a toml parser thats built on top of rowan, which kind of exist https://docs.rs/taplo/latest/taplo/ so we probably want to strip that down / adjust to our needs.
@tgross35 :wave: I think Veykril's reply answers the greater part of your question, but I think it comes down to determining how long it will take us to integrate the said taplo crate to RA.
This is a feature I would really like to see. I was debating building a separate plugin to some of the features listed.
Is this a feature that RA will accept into its code base?
if So I would be interesting in starting to add it to RA?
Definitely something we want to have, its just a lot of work and requires some other things to be done first, like creating / integrating a rowan based syntax library for toml -> https://github.com/rust-lang/rust-analyzer/pull/15908
This issue is an attempt to put all information regarding potential
Cargo.toml
support in one place.Blockers
There is no TOML support in RA, and needs a format-preserving parser.
toml-edit
is maintained along withtoml
and probably the best choice.Potential features
edition
,rust-version
,license
license-file
,readme
,build
crates
extension)dev-dependencies
/dependencies
/build-dependencies
"no-default-features
Cargo.toml
from a use statement #10904crates
extension: https://github.com/rust-lang/rust-analyzer/issues/13532Even better TOML
does it well, but there are some good general suggestions in the issueSee also the label https://github.com/rust-lang/rust-analyzer/labels/S-needs-toml