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

enh(cpp) Highlight all function dispatches #3005

Merged
merged 8 commits into from Mar 7, 2021

Conversation

joshgoebel
Copy link
Member

@joshgoebel joshgoebel commented Feb 14, 2021

Work towards resolving #2973.

Related: #2500.

Changes

  • Highlights all function dispatch as function.dispatch, which aliases
    to built_in for now

Checklist

  • Added markup tests, or they don't apply here because...
  • Updated the changelog at CHANGES.md
  • Added myself to AUTHORS.txt, under Contributors

@allejo
Copy link
Member

allejo commented Feb 22, 2021

Should _ be a keyword for an "only used for relevancy" list (or was this just a temporary name)? And for the Arduino grammar, was your split of built_in keywords arbitrary was there some meaning to how you split them?

@joshgoebel
Copy link
Member Author

joshgoebel commented Feb 23, 2021

Should _ be a keyword for an "only used for relevancy" list (or was this just a temporary name)?

It's a convention now (hence the patch to avoid emitting HTML for them), though I also considered _* as in _builtins, _something, _whatever to allow for better naming.

And for the Arduino grammar, was your split of built_in keywords arbitrary was there some meaning to how you split them?

It's split cleanly between built-in classes (still highlighted as built-in keywords) and built-in functions (highlighted via the blahBlah( rule now).

@joshgoebel joshgoebel added this to the 10.7 milestone Feb 23, 2021
@joshgoebel
Copy link
Member Author

Ping.

@allejo
Copy link
Member

allejo commented Mar 5, 2021

It's a convention now (hence the patch to avoid emitting HTML for them), though I also considered _* as in _builtins, _something, _whatever to allow for better naming.

Yea I noticed the patch in the core changes. I'm not convinced that _ is the best name for this. I'd lean towards using something like _relevancy. Then in the future, _* could be used for future internal or special behavior stuff.

@joshgoebel
Copy link
Member Author

joshgoebel commented Mar 5, 2021

Then in the future, _* could be used for future internal or special behavior stuff.

I like free naming too much so I codified _* and added it to docs. I do think it's an improvement from the magic _ key. We always have __ or $ (and we have precedent for using $ with $pattern) or all sort of options for adding future functionality including passing an object:

keywords: {
  delicious: { extraSpecialHighlighting: true, list: "for if def when" }
}

I don't want to worry too much about saving the namespace for the future.

src/languages/cpp.js Show resolved Hide resolved
@joshgoebel joshgoebel merged commit d2f3ab5 into highlightjs:master Mar 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants