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
Closed
Labels
Milestone

Comments

@boanergies
Copy link
Contributor

@boanergies 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
Contributor

@birkenfeld birkenfeld commented Oct 28, 2020

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

@boanergies
Copy link
Contributor Author

@boanergies 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
Contributor

@birkenfeld birkenfeld commented Oct 28, 2020

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

@Anteru Anteru added the lexing label Oct 28, 2020
@Anteru Anteru added this to the 2.7.3 milestone Oct 28, 2020
@boanergies
Copy link
Contributor Author

@boanergies boanergies commented Oct 29, 2020

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

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

Successfully merging a pull request may close this issue.

3 participants