Skip to content

include basic syntax coloring support for javascript vue files#8367

Merged
matthiasblaesing merged 1 commit intoapache:masterfrom
haidubogdan:t_javascript_vue_support
Apr 1, 2025
Merged

include basic syntax coloring support for javascript vue files#8367
matthiasblaesing merged 1 commit intoapache:masterfrom
haidubogdan:t_javascript_vue_support

Conversation

@haidubogdan
Copy link
Copy Markdown
Contributor

@haidubogdan haidubogdan commented Mar 28, 2025

Basic coloring syntax support for javascript vue files

The pull request proposes a new Language for vue files with a coloring lexer implemented in Antlr.
At the current stage it also includes embedding support for Html & Css.
For javascript it will be just coloring embedding for the moment.

image

As learned from a previous pull request, maybe it's better to have simple merges for language support features.
In time, parser, completion, declaration finder features can be included as future updates, for which I can contribute.

More info about the template syntax can be found on their official site : https://vuejs.org/guide/essentials/template-syntax

Copy link
Copy Markdown
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

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

I made a first pass and left a few inline comments.

I'm correct, that this is only concerned with .vue files, aka single-file components?

Comment thread webcommon/javascript2.vue/licenseinfo.xml
Comment thread webcommon/javascript2.vue/build.xml
@haidubogdan
Copy link
Copy Markdown
Contributor Author

I'm correct, that this is only concerned with .vue files, aka single-file components?

Yes, exactly.
It would be the first step to introduce support in netbeans.

@matthiasblaesing
Copy link
Copy Markdown
Contributor

Apart from the two remaining comments from yesterday, I forgot to add:

  • the javascript2.vue module should be added to the dependency list of javascript2.kit, so that it gets activated together with it
  • the spec versions of the modules, that gained changed friends, should be bumped (yeah I know this is under discussion, but we are still weaks from branch point, so should not be problematic).

@neilcsmith-net
Copy link
Copy Markdown
Member

the spec versions of the modules, that gained changed friends, should be bumped (yeah I know this is under discussion, but we are still weaks from branch point, so should not be problematic).

The timing related to branch points has nothing to do with the problematic aspects of this. The problem occurs if there's a need to revert any feature during branch. That discussion is for another place - personally I'd prefer no spec change in any feature PR, but not stopping it.

The other thing to consider looking at this, but also probably not to resolve here, is that the number of friend dependencies in web.common is ridiculous!

@haidubogdan
Copy link
Copy Markdown
Contributor Author

Apart from the two remaining comments from yesterday, I forgot to add:

  • the javascript2.vue module should be added to the dependency list of javascript2.kit, so that it gets activated together with it
  • the spec versions of the modules, that gained changed friends, should be bumped (yeah I know this is under discussion, but we are still weaks from branch point, so should not be problematic).

Ah, yes, my bad, I got inspired from "jade" implementation, and I included webcommon, and css.editor without checking if it's really used.
I've removed them + removed the used friend dependencies spec version.
Thanks.

@mbien mbien added JavaScript [ci] enable web job and extra JavaScript tests (webcommon/javascript2.editor) Editor web [ci] enable web job labels Mar 30, 2025
@matthiasblaesing matthiasblaesing added this to the NB26 milestone Mar 31, 2025
@apache apache locked and limited conversation to collaborators Mar 31, 2025
@apache apache unlocked this conversation Mar 31, 2025
@haidubogdan haidubogdan force-pushed the t_javascript_vue_support branch from abd9aa8 to c65b02d Compare March 31, 2025 19:56
@Chris2011
Copy link
Copy Markdown
Contributor

@haidubogdan awesome!!! Thx for this great enhancement. I would like to suggest some more things for this MVP.

  1. Please change the icon for a more common one. It is just the V that everyone knows it from using vue: https://www.google.com/search?sca_esv=c4730c0d5f6ba8e9&rlz=1C1GCEA_deDE1066DE1066&q=vue&udm=2. Of course we need to find a licensed image that fits. The extension and this icon should be enough to recocknice it and it fits better in the NetBeans icon set.
  2. Could you pleaes also add more default support like TypeScript, sass, less, scss? NetBeans also can handle all of them more or less good so those should be added as defaults for the first run as wall. I think jade maybe too? I also think that jade/pug should work in the lang attribute for the template but I'm not sure.

@haidubogdan
Copy link
Copy Markdown
Contributor Author

@haidubogdan awesome!!! Thx for this great enhancement. I would like to suggest some more things for this MVP.

  1. Please change the icon for a more common one. It is just the V that everyone knows it from using vue: https://www.google.com/search?sca_esv=c4730c0d5f6ba8e9&rlz=1C1GCEA_deDE1066DE1066&q=vue&udm=2. Of course we need to find a licensed image that fits. The extension and this icon should be enough to recocknice it and it fits better in the NetBeans icon set.
  2. Could you pleaes also add more default support like TypeScript, sass, less, scss? NetBeans also can handle all of them more or less good so those should be added as defaults for the first run as wall. I think jade maybe too? I also think that jade/pug should work in the lang attribute for the template but I'm not sure.

Sure, I will give it a try.
Embeddings can be picky for some languages and I hope the parametric lang lexer to go smooth.

@matthiasblaesing
Copy link
Copy Markdown
Contributor

@haidubogdan this looks good to me. Of course more could be done, but I suggest to ensure this gets in and is not lost in the quest to do more. Would you please squash the commits into one? Once that is pushed, I'll reauthrorize running unittests and once they come back clean, I'd merge.

@haidubogdan haidubogdan force-pushed the t_javascript_vue_support branch from c65b02d to 311ae06 Compare April 1, 2025 18:46
@haidubogdan
Copy link
Copy Markdown
Contributor Author

@haidubogdan this looks good to me. Of course more could be done, but I suggest to ensure this gets in and is not lost in the quest to do more. Would you please squash the commits into one? Once that is pushed, I'll reauthrorize running unittests and once they come back clean, I'd merge.

Yes, the evolution can be added afterwards. Branch rebased and commits squashed.

@matthiasblaesing
Copy link
Copy Markdown
Contributor

@haidubogdan thank you for your contribution. Merging.

@matthiasblaesing matthiasblaesing merged commit 8978630 into apache:master Apr 1, 2025
31 checks passed
@haidubogdan
Copy link
Copy Markdown
Contributor Author

haidubogdan commented Apr 6, 2025

Hi @Chris2011
I'm preparing an update for your observation :
aab0b8f

Unfortunately typescript doesn't have a classic language lexer, so it can't be used for a basic embedding.
From a first check pug eq to jade.
I will continue with sass, less, scss embedding. (I see that we don't have stylus yet), + an icon update.

@Chris2011
Copy link
Copy Markdown
Contributor

@haidubogdan thx for your info. TypeScript is using the generic textmate grammar registration and LSP functionality. Just a hint. I dunno what needs to be done to also add textmate lexers as embeddings. Maybe the embedding provider needs to be changed but this is a whole different topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Editor JavaScript [ci] enable web job and extra JavaScript tests (webcommon/javascript2.editor) web [ci] enable web job

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants