-
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
(c) add whitelist for atomic_init
, atomic_xyz
, etc. types, not regex wildcard rule
#3837
Comments
Two easy paths:
#2 seems easily doable for the short list I found following your link... I swear we've talked about this before... maybe double check |
I've looked into it, and |
So remind me again what is the ask/thinking here now? |
To change the highlighting rule for Is there anything still unclear from the issue? |
atomic_init
, atomic_xyz
, etc. are all treated as types, but shouldn't beatomic_init
, atomic_xyz
types, not regex wildcard rule
atomic_init
, atomic_xyz
types, not regex wildcard ruleatomic_init
, atomic_xyz
, etc. types, not regex wildcard rule
Ok updated the name to reflect that. :) |
Describe the issue
This rule is overly aggressive:
highlight.js/src/languages/c.js
Lines 24 to 31 in 5c1bc1e
As a result, atomic operations such as
atomic_store
,atomic_load
,atomic_init
, etc. are also highlighted as types. Instead of a general rule such asatomic_
being a type,Which language seems to have the issue?
c
Are you using
highlight
orhighlightAuto
?This is just based off of observations on Discord, which, to my knowledge uses highlight.js. Presumably
highlight
.Sample Code to Reproduce
Expected behavior
Only actual typedef-names such as
atomic_int
should be highlighted as types. Functions should not be highlighted as types.Additional context
A list of types and functions can be found here https://en.cppreference.com/w/c/atomic. To fix this, it would not be sufficient to add negative lookahead to the pattern (to exclude function calls), since it is reasonable to write code such as:
To avoid false positives, it would be better to add special cases for all the known
atomic
type aliases (there aren't that many anyway).The text was updated successfully, but these errors were encountered: