-
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
(TypeScript) Camel-case type parameters: only first component is highlighted #3403
Comments
Yeah I'd say that's a bug with our camelcase class name detection. And some typescript keywords we should probably add. |
Are there other TS keywords we need to add? |
Kind of a tangent, but some keywords are context-sensitive. For example, const type = 'abc';
type X = string; This is also true for other keywords, e.g. Not sure if highlight.js can be enhanced to support this kind of thing, but it appears GitHub's highlighting does. |
Depends... the Short of doing that we can either highlight none of them or highlight them always regardless. |
FYI: We do only turn these on for TS code, so they don't false highlight JS code - only TS code. |
I have no idea how much work it is but just in case it's helpful, here's the TS source code that defines the list of "reserved words" vs "contextual keywords": |
This isn't super helpful though, what might be more useful is a literal list (not a list of named symbols). I don't even see Contextual keywords are always something we're going to struggle with... if there was an absolute list we should probably just not include any of them (rather than suffer false positives). I may just back out my keyword changes and then close this with the PR that addresses only the camel-case, as that was the bulk of this issue. contextual keywords is a whole other thing. |
Sorry, I got that link from another GH issue and it pointed to an older version of the file. Here's the latest version link (includes And here's the list that maps the literal to the code identifier: link I agree that it's a good idea to limit this PR to address just the camel-case thing. Maybe it's worth opening a new issue for this keyword discussion? |
Describe the issue
In the type parameter "OutT", the "Out" is highlighted differently from the "T".
Which language seems to have the issue?
typescript
Are you using
highlight
orhighlightAuto
?Not sure. I noticed this issue on StackOverflow and reproduced with your JSFiddle template.
Sample Code to Reproduce
https://jsfiddle.net/650rLwyd/
Screenshot:
Expected behavior
GitHub's highlighting in markdown code fences looks better:
Screenshot, just in case it changes:
Additional context
The text was updated successfully, but these errors were encountered: