-
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
enh(typescript): highlight obvious user defined type names (interface
, etc)
#3903
enh(typescript): highlight obvious user defined type names (interface
, etc)
#3903
Conversation
Build Size ReportChanges to minified artifacts in 7 files changedTotal change +275 B View Changes
|
Hi @joshgoebel, this is my suggested solution and I hope to review it. |
@joshgoebel, is there any opportunity to review these changes? |
src/languages/typescript.js
Outdated
params.contains = params.contains.concat(PROPERTY_TYPE) | ||
} | ||
|
||
const returnedFuncParams = contains.find(cc => cc.scope === 'function' || cc.className === 'function')?.contains?.find(cc => cc.scope === 'params' || cc.className === 'params').variants[2]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function
scope is deprecated and will be removed in the future... though I'm not sure this is necessary at all once you follow the other suggestions.
src/languages/typescript.js
Outdated
if ( | ||
contains | ||
) { | ||
const params = contains.find(cc => cc.scope === 'params' || cc.className === 'params'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really need params here or just access to params_contains? See the already exported tsLanguage.exports.PARAMS_CONTAINS
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, thanks for your review.
Yes, I want to access the params_contains.
I will modify the code now and commit the changes.
Build Size ReportChanges to minified artifacts in 7 files changedTotal change +87 B View Changes
|
src/languages/typescript.js
Outdated
@@ -11,7 +11,7 @@ import * as ECMAScript from "./lib/ecmascript.js"; | |||
import javascript from "./javascript.js"; | |||
|
|||
/** @type LanguageFn */ | |||
export default function(hljs) { | |||
export default function (hljs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the linting/spacing only changes.
Build Size ReportChanges to minified artifacts in 6 files changedTotal change +82 B View Changes
|
Co-authored-by: Josh Goebel <[email protected]>
Build Size ReportChanges to minified artifacts in 7 files changedTotal change +86 B View Changes
|
Now we just need a changelog entry I think. |
interface
, etc)
Build Size ReportChanges to minified artifacts in 7 files changedTotal change +86 B View Changes
|
Looks like markup tests aren't all passing? |
I tested them and all have been passed before creating the PR and after modification at Typescript and all passed. If you have found any failed test comment it to fix it. |
See the failure here: https://github.com/highlightjs/highlight.js/actions/runs/6872592218/job/18691291704?pr=3903 Are you saying they all pass for you locally? Is your working tree clean? |
You are right, I am sorry. This is happening because I am running an And the result of I will commit changing at |
Build Size ReportChanges to minified artifacts in 7 files changedTotal change +83 B View Changes
|
Build Size ReportChanges to minified artifacts in 7 files changedTotal change +86 B View Changes
|
I have fixed highlighting params at JS and these params types such as (interfaces, types, etc) at TS.
The related issue is #3269
Changes
My changes are concat the params regex contains with class reference regex and attribute regex to highlight props keys and types.
While I working on this issue, I noted that the params didn't highlight if it separated with space before and solved that also.
Checklist