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

Doxygen comments in django/javascript code creating weird behaviour from lexer #1588

Closed
boanergies opened this issue Oct 28, 2020 · 4 comments · Fixed by #1589
Closed

Doxygen comments in django/javascript code creating weird behaviour from lexer #1588

boanergies opened this issue Oct 28, 2020 · 4 comments · Fixed by #1589
Labels
A-lexing area: changes to individual lexers
Milestone

Comments

@boanergies
Copy link
Contributor

boanergies commented Oct 28, 2020

With the following code as an example

/**
  * @param {*} cool
  */
func = function(cool) {
};

/**
 * @param {*} stuff
 */
fun = function(stuff) {
};

For some reason the first '*' in '{*}' causes everything after it to be marked a Token.Comment until you hit the second '{*}'. The weirder thing is the behaviour only happens if both '{*}' are present. Remove either one of the '{*}' and it works as expected. Is there a formatter, filter, or another lexer I'm supposed to use to help with doxygen comments?

I confirmed this by running it through the demo you have on your website.

Just to clarify I'm using the javascriptDjangoLexer and I see the behaviour already happen before my filters run so its not any of my custom filters or formatters making something weird happen.

For reference of the correctness of the commenting you can look at JSDoc here

@birkenfeld
Copy link
Member

Well, {* ... *} and {# ... #} are comments for the Django template language.

@boanergies
Copy link
Contributor Author

boanergies commented Oct 28, 2020

the second statement is true as I found here but I don't see docs supporting that {* ... *} are comments, do you have a link supporting your claim?

@birkenfeld
Copy link
Member

It looks like the lexer is mistaken there. Do you want to make a PR to fix it?

@Anteru Anteru added the A-lexing area: changes to individual lexers label Oct 28, 2020
@Anteru Anteru added this to the 2.7.3 milestone Oct 28, 2020
@boanergies
Copy link
Contributor Author

Sure I can do that, it looks like it will be a one line fix from the code

@Anteru Anteru added the changelog-update Items which need to get mentioned in the changelog label Oct 30, 2020
@Anteru Anteru removed the changelog-update Items which need to get mentioned in the changelog label Dec 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lexing area: changes to individual lexers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants