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

Javascript Class #934

Closed
ZatsuneNoMokou opened this issue Mar 5, 2016 · 20 comments
Closed

Javascript Class #934

ZatsuneNoMokou opened this issue Mar 5, 2016 · 20 comments

Comments

@ZatsuneNoMokou
Copy link

ES6 have added class system like it is shown in Mozilla Doc page, could it be possible to have syntax highlight and all?

@b4n
Copy link
Member

b4n commented Mar 5, 2016

Possible of course, needs someone doing it :)

For the highlighting part, it should be very easy, a mere matter of updating the keywords in data/filetypes.javascript to include the new ones. Grammar didn't change so much AFAIK, so it should be enough.

For the tagging part it'll be a little more works as it'll require updating the parser to really understand those new syntaxes, but it's something that will likely be done by Somebody at some point in the (probably not so distant) future. S/A universal-ctags/ctags#780

@ZatsuneNoMokou
Copy link
Author

It would be interesting to support texts like foo1 ${var1} foo2 too

@b4n
Copy link
Member

b4n commented Mar 6, 2016

I implemented support for template strings in Universal-CTags, but apparently I never updated the parser in Geany (??).
Will have to backport those indeed.

@ZatsuneNoMokou
Copy link
Author

I guess, because if I put thing like I don't know the quote will be considered as a string start but it does not work like that.
Maybe the parser for Javascript haven't been updated, I dunno

@b4n
Copy link
Member

b4n commented Mar 6, 2016

I guess, because if I put thing like I don't know the quote will be considered as a string start but it does not work like that.

Well, if the example I don't lnow it's actually fine to consider it a string -- so long as it doesn't contain ${}s :)

The highlighting part might be missing completely though, I'm not sure -- that'd be Scintilla.

@ZatsuneNoMokou
Copy link
Author

It gonna take time to do these 2 things?

@b4n
Copy link
Member

b4n commented Mar 6, 2016

Importing the CTags fixes should be relatively easy. Fixing the highlighter will be a lot trickier, esp. because template strings are tricky in the sense they basically require running the parser recursively.

I will import the CTags change "soon", but probably not before next week.

@ZatsuneNoMokou
Copy link
Author

You'll close this issue when the fix will be done?

@b4n
Copy link
Member

b4n commented Mar 6, 2016

Yeah, sure.

@ZatsuneNoMokou
Copy link
Author

I can see the classes are coming soon I guess, there's some news about the quotes?

@ZatsuneNoMokou
Copy link
Author

The classes have now the color thing, but not displayed in the "classes" part?

@xuhcc
Copy link

xuhcc commented Aug 31, 2016

There is an issue on Scintilla bug tracker for template strings support: https://sourceforge.net/p/scintilla/feature-requests/1112/
Someone mentions the lexer.cpp.backquoted.strings setting, and it actually works.
Just add this code to your filetypes.javascript:

[lexer_properties]
lexer.cpp.backquoted.strings=1

@Proberts
Copy link

Proberts commented Dec 9, 2016

ES6 keywords
filetypes.javascript.txt

@ZatsuneNoMokou
Copy link
Author

Can expect backquote support some day?

@b4n
Copy link
Member

b4n commented Dec 12, 2016

@ZatsuneNoMokou proper one would need someone to take the task and implement it in Scintilla. If setting lexer.cpp.backquoted.strings=1 is good enough though, as suggested by @xuhcc, we can do that easily (and you can do that in your own configuration).

I would be interesting to get some testing of using lexer.cpp.backquoted.strings=1 to see if it's good enough for now, or just confuses a little further.

@ZatsuneNoMokou
Copy link
Author

Just did it, at least there won't be any annoying effects with stuff like where the quote was considered as a string begin.

`L'exemple`

b4n added a commit that referenced this issue Dec 18, 2016
This doesn't support nested templates or escaped `es, but at least
handles the most obvious cases for now.

Part of #934.
@b4n
Copy link
Member

b4n commented Dec 18, 2016

@ZatsuneNoMokou okay thanks. This is added in 9fdb014

@nahidakbar
Copy link

nahidakbar commented Sep 25, 2017

+1

Not sure if this is still an issue. I am using geany from ubuntu repo. But geany 1.27 seems to be several versions of javascript out of date. Class is an ES6 feature. It's up to ES8 now.

Not a single element in the sidebar is accurate:
image

@elextr
Copy link
Member

elextr commented Sep 25, 2017

@nahidakbar 1.27 is too old to include the change referenced above, you need at least 1.30.1.

@b4n
Copy link
Member

b4n commented Sep 29, 2017

Even current master doesn't have support for ES6 classes in the symbols tree, we still have to import the changes I made in U-CTags.

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

No branches or pull requests

6 participants