netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

[Rust] Rust workspaces support.

Open vieiro opened this issue 1 year ago • 11 comments

  • Embedded toml-java library to parse Cargo.toml files.
  • We open complex Rust projects with nested projects (workspaces).
  • Dropping the previous workspace node.
  • Some other refactoring and cleanups.

Screenshot of an open project:

  • Opened https://github.com/apache/arrow-rs project (a virtual workspace).
  • The "arrow" member (another rust project) can be seen as a nested "arrow-rs" subproject and as a top level project.

imagen

Let's see how our build pipelines work on this PR.

I'm afraid this is quite a big PR, but it requires changes in two modules (both cargo-support and cargo-projects), so I thought it could be sent for review before it gets bigger.

toml-java uses a highter "antlr4" runtime version, we could either upgrade NetBeans' or downgrade toml-java's.

vieiro avatar Dec 14 '23 18:12 vieiro

This is ready for review now!

vieiro avatar Dec 16 '23 10:12 vieiro

toml-java uses a highter "antlr4" runtime version, we could either upgrade NetBeans' or downgrade toml-java's.

fyi: I started with the update when I saw this in the antlr readme: "minor version updates may include minor breaking changes, the policy is to regenerate parsers with every release (4.11 -> 4.12)".

This was also discussed on the last update PR https://github.com/apache/netbeans/pull/4845, So I am going to put the update on hold since regenerating parsers across NB is not something I want to do right now :) (but if anyone wants to take over, feel free to start with the linked commit)

mbien avatar Dec 16 '23 12:12 mbien

I think I'll take a look to the ANTLRv4 upgrade during early 2024. Thanks for the commit!

vieiro avatar Dec 16 '23 19:12 vieiro

Hey, I was thinking I could downgrade toml-java to java 8 / antlr 4.11.1 for the time being. Let's do that.

vieiro avatar Dec 17 '23 18:12 vieiro

@vieiro or: you bundle antl runtime just for rust using the version you need, until the rest of NB catches up and we can deduplicate again. Its just two jars I think.

edit: analog to maven-indexer which uses latest lucene while many editor modules still use older versions due to public api issues.

mbien avatar Dec 17 '23 18:12 mbien

Modified toml-java to support Antlr 4.11.1. Cargo.toml files have now their own file-type with syntax highlighting and their own navigator, so we get rid of libs.tomlj misbehaviour on arrays with commas.

imagen

vieiro avatar Dec 31 '23 16:12 vieiro

Well, I think your toml-java workcould go into the ide cluster and eventually replace the libs.tomlj.

That would be actually a preferred way to, so we could upgrade the ANTLR4 runtime.

lkishalmi avatar Jan 06 '24 17:01 lkishalmi

Well, I think your toml-java workcould go into the ide cluster and eventually replace the libs.tomlj.

That would be actually a preferred way to, so we could upgrade the ANTLR4 runtime.

Ok. So let's drop libs.tomlj (the author has fixed my main concerns, but there's no new version in Maven Central) and let's upgrade antlr4 everywhere to newest versions. Meanwhile let's make this PR go to sleep.

vieiro avatar Jan 23 '24 21:01 vieiro

i caused a little conflict but the section was rewritten here so it is likely easy to resolve - sorry about that.

mbien avatar Feb 21 '24 15:02 mbien

i caused a little conflict but the section was rewritten here so it is likely easy to resolve - sorry about that.

Don't understand that! Wrong PR perhaps?

I'll try to move forward with the tomlj replacement as time permits, but time doesn't permit lately! :-/

vieiro avatar Feb 24 '24 19:02 vieiro

Don't understand that! Wrong PR perhaps?

right PR - but its was not important ;)

mbien avatar Feb 26 '24 21:02 mbien

I think it's better to close this one, after all we'll have to refactor it with the new Antlr/TOML runtimes.

Also we'll need to consider:

  • If we want to open workspace members as nested projects (as in this PR, expanding the member nodes) or with different projects (similar to what we do with Maven modules, this PR also supports that in some way).
  • Let's redo the Cargo.toml API. Cargo.toml files have many capabilities. We will need some sort of "Query API" for Cargo.toml files that makes it easier to add additional queries in the future more easily (queries such as is this a "lib" Cargo.toml? is it a workspace Cargo.toml? If so, how many members does it have? Does it have tests? What are the build dependencies?, etc., etc.).

Suggestions are welcome!

vieiro avatar Apr 19 '24 07:04 vieiro