You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't provide a useful code sample link, because this is a filetype detection bug, not a highlighting bug.
Additional context
The problem is that the disambiguation rules for Pascal are too keen to decide in favour of Pascal when determining whether a file is Pascal or not. The code above is Puppet, which also uses the .pp filetype. Since #1845, Rouge decides that any file containing var is Pascal: https://github.com/tancnle/rouge/blob/master/lib/rouge/guessers/disambiguation.rb#L136. This causes a lot of conflicts, because var is a common FHS component, so pops up in Puppet code very frequently.
Looking for \bvar\s instead of \bvar\b would reduce a lot of false positives, while still being the same semantically - Pascal var keywords have to be followed by a space, from what I can tell. Another approach, which could be used in combination, would be to add a disambiguation rule that declares a file Puppet if it sees a :: - a very common feature of Puppet code, but a rare feature of Pascal (I think - I'm not a Pascal writer).
The text was updated successfully, but these errors were encountered:
Thanks for reporting the issue @jamespwilliams 👍🏼 I think it is a fair assessment regarding var. PROGRAM might not be applicable to free pascal. I would propose to:
Drop the var keyword or enforce the following space
Add disambiguation rule for Puppet, rocket => and class definition foo::bar
Name of the lexer
Pascal
Code sample
I can't provide a useful code sample link, because this is a filetype detection bug, not a highlighting bug.
Additional context
The problem is that the disambiguation rules for Pascal are too keen to decide in favour of Pascal when determining whether a file is Pascal or not. The code above is Puppet, which also uses the
.pp
filetype. Since #1845, Rouge decides that any file containingvar
is Pascal: https://github.com/tancnle/rouge/blob/master/lib/rouge/guessers/disambiguation.rb#L136. This causes a lot of conflicts, becausevar
is a common FHS component, so pops up in Puppet code very frequently.Looking for
\bvar\s
instead of\bvar\b
would reduce a lot of false positives, while still being the same semantically - Pascalvar
keywords have to be followed by a space, from what I can tell. Another approach, which could be used in combination, would be to add a disambiguation rule that declares a file Puppet if it sees a::
- a very common feature of Puppet code, but a rare feature of Pascal (I think - I'm not a Pascal writer).The text was updated successfully, but these errors were encountered: