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

Dart support #7220

Merged
merged 26 commits into from
Feb 19, 2024
Merged

Dart support #7220

merged 26 commits into from
Feb 19, 2024

Conversation

agent3bood
Copy link
Contributor

@agent3bood agent3bood commented Feb 1, 2024

This is my first contribution, feedback is welcome.

Release Notes:

  • Added Dart language support (#5343).

Copy link

cla-bot bot commented Feb 1, 2024

We require contributors to sign our Contributor License Agreement, and we don't have @agent3bood on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@agent3bood
Copy link
Contributor Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 1, 2024
Copy link

cla-bot bot commented Feb 1, 2024

The cla-bot has been summoned, and re-checked this pull request!

@Aarush-Acharya
Copy link

Hey @agent3bood thanks a lot , was really waiting for it

@huwaireb huwaireb mentioned this pull request Feb 2, 2024
7 tasks
@agent3bood agent3bood mentioned this pull request Feb 3, 2024
@domesticmouse
Copy link

Like the CI, I am having issues building:

$ cargo run --release

    Updating crates.io index
    Updating git submodule `git@github.com:tree-sitter/tree-sitter`
error: failed to get `tree-sitter-dart` as a dependency of package `zed v0.122.0 (/Users/brettmorgan/Documents/GitHub/zed/crates/zed)`

@imujtaba8488
Copy link

This is my first contribution, feedback is welcome.

Release Notes:

  • Added Dart language support (#5343).

Waiting for this to be merged soon, hopefully!

@TheGlorySaint
Copy link

can't wait for the merge and then to use flutter with ZED.

@agent3bood
Copy link
Contributor Author

Building works on my machine, could it be related to CI not having github in known_hosts? Or ssh key not setup?

@domesticmouse
Copy link

Building works on my machine, could it be related to CI not having github in known_hosts? Or ssh key not setup?

Yeah, I don't have SSH keys setup. The more interesting question is, why is the CI failing? Surely they have SSH keys setup for the CI bots?

@@ -230,6 +230,7 @@ tree-sitter-clojure = { git = "https://github.com/prcastro/tree-sitter-clojure",
tree-sitter-c-sharp = { git = "https://github.com/tree-sitter/tree-sitter-c-sharp", rev = "dd5e59721a5f8dae34604060833902b882023aaf" }
tree-sitter-cpp = { git = "https://github.com/tree-sitter/tree-sitter-cpp", rev = "f44509141e7e483323d2ec178f2d2e6c0fc041c1" }
tree-sitter-css = { git = "https://github.com/tree-sitter/tree-sitter-css", rev = "769203d0f9abe1a9a691ac2b9fe4bb4397a73c51" }
tree-sitter-dart = { git = "https://github.com/agent3bood/tree-sitter-dart", rev = "48934e3bf757a9b78f17bdfaa3e2b4284656fdc7" }
Copy link

@HenriqueNas HenriqueNas Feb 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope this can be merged and released asap !!

but, just for curiosity:
why did you linked your fork of "official" Dart tree-sitter repository instead of it self?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no official package for Dart, the website links to "https://github.com/UserNobody14/tree-sitter-dart", which I forked to fix some issues on it.

@murshid1988
Copy link

Wow. Finally. <3

Copy link
Collaborator

@maxbrunsfeld maxbrunsfeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some suggestions on the highlight query. Also, could you grab a screenshot of the outline query? Thank you!

; Methods
; --------------------
(function_type
name: (identifier) @method)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs to be function or function.method for us to pick it up.

(getter_signature
(identifier) @method)
(setter_signature
name: (identifier) @method)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with these usages of @method.

; Parameters
; --------------------
(formal_parameter
name: (identifier) @parameter)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we give special highlighting @parameter, because in general, we don't have a way of highlighting all of the occurrences of the parameter consistently. Could you remove these parameter ones?


; Keywords
; --------------------
["import" "library" "export"] @include
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we highlight this group either. Maybe just use keyword for these? Or if you want to allow themes to target them specifically, you could do keyword.include.

"catch"
"finally"
(break_statement)
] @exception
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing with conditional, repeat, and exception: I think just use keyword. You could add a suffix like keyword.conditional, but we usually don't do that in our queries, so I don't think any themes will target that.

["do" "while" "continue" "for"] @repeat

; Error
(ERROR) @error
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove this? We usually don't highlight errors in our highlight queries, because sometimes there are false positives. Also, I don't think themes target this.

@LiamHockley
Copy link

Huge thanks for this effort!

As soon as this gets merged in, I am poised to give Zed a try.
Getting a bit tired of the slowness of VSCode.

@agent3bood
Copy link
Contributor Author

@maxbrunsfeld Updated the highlights as suggested. Also check the file outline view bellow.

Screenshot 2024-02-13 at 11 12 08

@ebsangam
Copy link

LGTM

@ebabhi
Copy link

ebabhi commented Feb 14, 2024

Let's gooo 🚀🚀🚀

@imujtaba8488
Copy link

Let's gooo 🚀🚀🚀

repeat > Lets' go 🚀🧨

@ebsangam
Copy link

When ship? 🚢🚢🚢

@imujtaba8488
Copy link

imujtaba8488 commented Feb 16, 2024

When ship? 🚢🚢🚢

with extensions in pre (love it) - Lets' go for Flutter! 🚀🚀🚀

@user-23xyz
Copy link

we all agree that this will change the course of the human timeline right ?

@erf
Copy link

erf commented Feb 16, 2024

As Dart developers we're all excited about this. Please stop spamming the issue - and in general only comment on Github issues if you contribute to solving it in some meaningful way.

@castletaste
Copy link

ready 🚀
CleanShot 2024-02-19 at 5  01 04@2x

@d1y
Copy link
Contributor

d1y commented Feb 19, 2024

@agent3bood Just my opinion: downgrade to a extensions: https://github.com/zed-industries/extensions

@agent3bood
Copy link
Contributor Author

@agent3bood Just my opinion: downgrade to a extensions: https://github.com/zed-industries/extensions

Looks like that will be the better option, just need a couple of days to check it out.

@agent3bood
Copy link
Contributor Author

Looks like zed extensions does not support adding language server to the editor, we will wait for this to be merged.

Languages
Extensions may provide languages to extend Zed with support for a particular language.
Currently this is used for things like syntax highlighting and outlining.
Support for defining language servers in extensions will be coming in the future.

@maxbrunsfeld
Copy link
Collaborator

Yes, we can move this into an extension later, once we have the extension APIs needed for adding new language servers. Thanks for your work on this @agent3bood.

@maxbrunsfeld maxbrunsfeld merged commit f4bafd5 into zed-industries:main Feb 19, 2024
6 checks passed
@maxbrunsfeld
Copy link
Collaborator

This will ship in Zed 0.124.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.