Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meta feature tracking: Language server support for Cargo.toml file #15741

Open
17 tasks
tgross35 opened this issue Oct 10, 2023 · 9 comments
Open
17 tasks

Meta feature tracking: Language server support for Cargo.toml file #15741

tgross35 opened this issue Oct 10, 2023 · 9 comments
Labels
C-feature Category: feature request S-needs-toml issue requiring toml support

Comments

@tgross35
Copy link

tgross35 commented Oct 10, 2023

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 with toml and probably the best choice.

Potential features

See also the label S-needs-toml issue requiring toml support

@tgross35 tgross35 added the C-feature Category: feature request label Oct 10, 2023
@tgross35 tgross35 changed the title Meta feature: Language server support for Cargo.toml file Meta feature tracking: Language server support for Cargo.toml file Oct 10, 2023
@obsgolem
Copy link
Contributor

My issue #10117 needs the needs-toml label.

@lnicola lnicola added the S-needs-toml issue requiring toml support label Oct 13, 2023
@tgross35
Copy link
Author

My issue #10117 needs the needs-toml label.

Thanks for the link, I added it to the list

@alibektas
Copy link
Member

alibektas commented Nov 2, 2023

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 .tomls ( strictly speaking, from .rust-analyzer.toml files and cargo.toml files, each of which needing special care here and there).

@tgross35
Copy link
Author

tgross35 commented Nov 2, 2023

@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

@alibektas
Copy link
Member

alibektas commented Nov 2, 2023

👋

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.

@Veykril
Copy link
Member

Veykril commented Nov 10, 2023

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.

@alibektas
Copy link
Member

alibektas commented Nov 14, 2023

@tgross35 👋 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.

@wyatt-herkamp
Copy link
Contributor

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?

@Veykril
Copy link
Member

Veykril commented Dec 12, 2023

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 -> #15908

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: feature request S-needs-toml issue requiring toml support
Projects
None yet
Development

No branches or pull requests

6 participants