-
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
Fix/issue 3972 #3989
Fix/issue 3972 #3989
Conversation
Build Size ReportChanges to minified artifacts in 5 files changedTotal change +40 B View Changes
|
src/languages/typescript.js
Outdated
], | ||
beginScope: { | ||
1: "keyword", | ||
3: "variable" |
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.
From the examples (https://www.typescriptlang.org/docs/handbook/namespaces.html) it looks like namespaces are class-like and CamelCase in their naming... so I think title.class
would be more appropriate here than variable.
src/languages/typescript.js
Outdated
end: /\{/, | ||
excludeEnd: true, | ||
contains: [ tsLanguage.exports.CLASS_REFERENCE ] | ||
contains: [tsLanguage.exports.CLASS_REFERENCE] |
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.
Not sure we need any of this anymore - the match rule should be enough to highlight the keyword and namespace name... but should IDENT_RE used above to recognize namespace perhaps be CLASS_REFERENCE[:match]
instead - if the same names rules apply.
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.
const NAMESPACE = {
begin: [
/namespace/,
/\s+/,
hljs.IDENT_RE
],
beginScope: {
1: "keyword",
3: "title.class"
}
};
Is the above change enough or i should change something else.
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.
I think I was suggesting tsLanguage.exports.CLASS_REFERENCE
instead of IDENT_RE... but yes that's looking good.
Build Size ReportChanges to minified artifacts in 5 files changedTotal change +31 B View Changes
|
Build Size ReportChanges to minified artifacts in 3 files changedTotal change +24 B View Changes
|
@@ -0,0 +1,4 @@ | |||
|
|||
<span class="hljs-keyword">const</span> message = <span class="hljs-string">'foo'</span>; | |||
<span class="hljs-keyword">const</span> <span class="hljs-keyword">namespace</span> = <span class="hljs-string">'bar'</span>; |
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.
This isn't the desire behavior... We'll also need to remove it from TS_SPECIFIC_KEYWORDS
(lets just comment it out - and mention it has a separate rule below).
Build Size ReportChanges to minified artifacts in 3 files changedTotal change +12 B View Changes
|
Build Size ReportChanges to minified artifacts in 3 files changedTotal change +12 B View Changes
|
Problem: When I use namespace as the name of the variable, everything that follows is highlighted incorrectly. While namespace is a TS keyword it's fine to use it as a variable name too.
Solution: Used a multimatcher to solve it
Before:
After:
Resolves #3972
Changes
Before:
After:
Checklist
CHANGES.md