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

vue: Improve syntax highlighting #11482

Merged
merged 2 commits into from
Jun 4, 2024
Merged

vue: Improve syntax highlighting #11482

merged 2 commits into from
Jun 4, 2024

Conversation

d1y
Copy link
Contributor

@d1y d1y commented May 7, 2024

close #8989

Before:

image

After:

image

Release Notes:

  • Improve vue highlighting

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label May 7, 2024
@d1y d1y marked this pull request as ready for review May 7, 2024 07:31
@maxdeviant maxdeviant changed the title Improve vue highlighting vue: Improve syntax highlighting May 7, 2024
@d1y
Copy link
Contributor Author

d1y commented May 16, 2024

@maxdeviant Do you have time to take a look at this PR?

@mikayla-maki mikayla-maki self-assigned this May 18, 2024
@icarusgk
Copy link

icarusgk commented May 23, 2024

Thank you so much for this PR, this is very much needed for the Vue community using Zed 💚

I was wondering if there is a possible way to make the color in an attribute binding a different color than the attribute name, as done in VSCode:

Group 481834

@d1y
Copy link
Contributor Author

d1y commented May 23, 2024

make the color in an attribute binding a different color than the attribute name

((directive_name) @keyword
(#match? @keyword "^v-"))

The directive name now only matches v-*, after changing it to * < ===> ((directive_name) @keyword) >
Should we make such changes?

syntax AS TO keyword

Before:
image

After:
image

@icarusgk
Copy link

Wow, it even makes the v-on shorthand '@' a different color as well.

support <script>

miss brackets

fix tsx jsx inject
@icarusgk
Copy link

Hello again @d1y, I'm having trouble building the extension manually on my machine (docker, tree-sitter, wasm, etc...) Could you please provide me the extension.wasm file so I can test the extension locally?

@d1y
Copy link
Contributor Author

d1y commented May 25, 2024

Hello again @d1y, I'm having trouble building the extension manually on my machine (docker, tree-sitter, wasm, etc...) Could you please provide me the extension.wasm file so I can test the extension locally?

If you just want to test my PR, I know a simpler method

  1. install vue by extension store

  2. download PR .scm file

cd ~/Library/Application\ Support/Zed/extensions/installed/vue/languages/vue
wget -O highlights.scm https://github.com/d1y/zed1/raw/vue1/extensions/vue/languages/vue/highlights.scm
wget -O injections.scm https://github.com/d1y/zed1/raw/vue1/extensions/vue/languages/vue/injections.scm

@icarusgk
Copy link

It worked perfectly this way, thank you! Sorry for the spam 😅 not very experienced in Rust or tree-sitter.

@christ-offer
Copy link

This is very nice! Just tried out the highlights/injections files and I am eagerly awaiting this to be merged :D

@icarusgk
Copy link

Been testing this for the last couple of days, and the syntax highlighting works great! 🚀

@maxbrunsfeld maxbrunsfeld merged commit 25050e8 into zed-industries:main Jun 4, 2024
8 checks passed
@maxbrunsfeld
Copy link
Collaborator

Thanks @d1y - and thanks @christ-offer and @icarusgk for the feedback. Since we don't use Vue internally, it's helpful to have others test.

@maxdeviant maxdeviant mentioned this pull request Jun 4, 2024
maxdeviant added a commit that referenced this pull request Jun 4, 2024
This PR bumps the Vue extension to v0.0.3.

Changes:

- #11482

Release Notes:

- N/A
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.

Treating Vue template prop binding and mustache text interpolation as JS/TS syntax (for highlighting)
8 participants