-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
(R) Numbers a not highlighted in multiple circumstances #3194
Comments
You might try two variants of number using multi-match (I'm not sure how ugly it will be): variants:
[
{ match: [
operator_re
regex.either(number_types)
],
scope: { 1: "operator", 2: "number" }
},
{ match: [
not_identifier
regex.either(number_types)
]},
] IE, combining the operator into the number matcher. |
That would probably be incorrect then, though sometimes context matters... like perhaps it's invalid in a certain scope, but valid in others... |
OK, I think I’ve got it. PR coming in 3…2…1… |
Talk about anti-climatic. :) |
This change adds highlighting for operators and punctuation, and fixes the issues described in highlightjs#3194.
This change adds highlighting for operators and punctuation, and fixes the issues described in #3194. * Give R a relevance boost from arrow-assign * Make `<-` less of a signal boost for R * Rebalance relevance of common syntactic constructs * Fix Vala having too much relevance for `^#` (meta/comment)
Describe the issue
<-
(and possibly after other constructs)->
is declared as illegal (to distinguish it from Haskell) despite being legal in R; this might be an OK heuristic, but the documentation makes it sound as ifillegal
is more than just a gentle nudge in the weighting, and this wouldn’t be appropriate.Which language seems to have the issue?
R
Are you using
highlight
orhighlightAuto
?highlight
Sample Code to Reproduce
Expected behavior
I’ve got a PR to fix these issues and also implements operators and punctuation highlighting at the same time. But, alas, it now fails to highlight numbers directly after operators/punctuation, because the rule for numbers eats the preceding character. I thought we had a solution for this that didn’t require look-behind, but that solution was removed in 0e9fb35 (ostensibly this shouldn’t have caused a behavioural change, so it’s possible that the previous version already had the errors described above).
Here’s the patch I used to add operators (which fixes problem (2)) and allow numbers at the beginning of the document, but this now causes numbers directly after operators to fail highlighting.
The text was updated successfully, but these errors were encountered: