zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
47.81k stars 2.8k forks source link

Improve Dart syntax highlighting #8151

Open erf opened 7 months ago

erf commented 7 months ago

Check for existing issues

Describe the feature

Awesome to have Dart support in https://github.com/zed-industries/zed/pull/7220 !

I did notice however that the syntax highlighting is somewhat lacking compared to VSCode as seen in these screenshots:

VSCode

Screenshot 2024-02-21 at 21 48 39

Zed

Screenshot 2024-02-21 at 21 46 19

Would it be possible to improve this?

Hope you don't mind if i ping you in this issue @agent3bood as you made the initial Dart PR

If applicable, add mockups / screenshots to help present your vision of the feature

No response

TENX-S commented 7 months ago

and this case: JetBrains IDEA:

image

Zed:

image
caleb654 commented 7 months ago

Just to add to this. I noticed when I have const on something it is highlighted correctly but not when const is missing:

image
hfghulam12 commented 6 months ago

Yes please

steevedevops commented 5 months ago

Is this issue ready to use guys ?

matthewnitschke commented 5 months ago

The upstream's, highlights.scm has seen a fair amount of improvements since dart was originally implemented within zed

I might suggest just updating the highlights.scm file which is specified over here, with what UserNobody14/tree-sitter-dart is using

Syntax highlighting for the provided example, on the latest changes, looks like the following:

tree-sitter-dart
erf commented 5 months ago

@matthewnitschke I tried to copy that highlights.scm file to Library/Application Support/Zed/extensions/installed/dart/languages/dart/ but that just made the syntax highlighting very minimal like this:

Screenshot 2024-05-03 at 11 18 15
matthewnitschke commented 4 months ago

@erf Ah shoot, that's unfortunate, zed must implement differences from what tree-sitter's default highlighting implements

My above example is the output of just running tree-sitter highlight ./your_file.dart

Looking at the original PR that introduced dart, some modifications must be necessary: https://github.com/zed-industries/zed/pull/7220#discussion_r1486572158 (specifically updating @function to @function.method, and maybe some of the other updates on what max suggested)