ignatov / intellij-erlang

Erlang IDE
https://www.jetbrains.com/help/idea/2018.2/getting-started-with-erlang.html
Other
735 stars 120 forks source link

Incorrect `end` highlighted for "fun Mod:Name/Arity" #990

Open gustawlippa opened 2 years ago

gustawlippa commented 2 years ago

Please see the issue here:

image

This is the correct end for this fun, and it works when the cursor is on it:

image

However, what is worst, when we highlight the end, the wrong fun is highlighted:

image

This is not a huge issue, but may be pretty confusing with nested funs, or different indentation. I don't know anything about plugin development, so I'm not sure where the issue comes from.

kvakvs commented 1 year ago

The explanation is in the parser output. Parser produces ERL_FUN_EXPRESSION which also contains 'fun' keyword (but shouldn't) then 'fun' will be matched with 'end' keyword by the matching token highlighter. Solution is to not output 'fun' in the token stream, or rename it, if it is recognized as ERL_FUN_EXPRESSION. I will see what can be done about this.

gustawlippa commented 1 year ago

Great, thanks for the reply, I must admit I even forgot I filed this issue. I would love to help, although I have no idea how, and I'm not familiar with developing IntelliJ plugins.