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

fix(javascript) fix set/get issue, add set/clear...Timeout/Interval keywords (#2514) #2515

Merged
merged 10 commits into from Apr 28, 2020
2 changes: 2 additions & 0 deletions CHANGES.md
Expand Up @@ -13,6 +13,8 @@ Deprecations:

Language Improvements:

- enh(javascript) setTimeout|setInterval now highlighted (#2514) [Vania Kucher][]
- fix(javascript) prevent setter keyword `set` conflicting with setTimeout|setInterval (#2514) [Vania Kucher][]
joshgoebel marked this conversation as resolved.
Show resolved Hide resolved
- fix(cpp) Fix highlighting of unterminated raw strings (#2261) [David Benjamin][]
- fix(javascript) `=>` function with nested `()` in params now works (#2502) [Josh Goebel][]
- fix(typescript) `=>` function with nested `()` in params now works (#2502) [Josh Goebel][]
Expand Down
4 changes: 2 additions & 2 deletions src/languages/javascript.js
Expand Up @@ -33,7 +33,7 @@ export default function(hljs) {
'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' +
'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' +
'module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect ' +
'Promise'
'Promise setInterval setTimeout'
joshgoebel marked this conversation as resolved.
Show resolved Hide resolved
};
var NUMBER = {
className: 'number',
Expand Down Expand Up @@ -263,7 +263,7 @@ export default function(hljs) {
beginKeywords: 'constructor', end: /\{/, excludeEnd: true
},
{
begin:'(get|set)\\s*(?=' + IDENT_RE+ '\\()',
begin: '(get|set)\\s+(?=" + IDENT_RE + "\\()',
joshgoebel marked this conversation as resolved.
Show resolved Hide resolved
end: /{/,
keywords: "get set",
contains: [
Expand Down
@@ -0,0 +1,2 @@
<span class="hljs-keyword">setTimeout</span>();
<span class="hljs-keyword">setInterval</span>();
joshgoebel marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions test/markup/javascript/keyword-as-part-of-method-name.txt
@@ -0,0 +1,2 @@
setTimeout();
setInterval();