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
4 changes: 4 additions & 0 deletions CHANGES.md
Expand Up @@ -13,6 +13,9 @@ Deprecations:

Language Improvements:

- enh(typescript) add setInterval, setTimeout, clearInterval, clearTimeout (#2514) [Josh Goebel][]
- enh(javascript) add setInterval, setTimeout, clearInterval, clearTimeout (#2514) [Vania Kucher][]
- fix(javascript) prevent `set` keyword conflicting with setTimeout, etc. (#2514) [Vania Kucher][]
- 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 All @@ -21,6 +24,7 @@ Language Improvements:
[Josh Goebel]: https://github.com/yyyc514
[Peter Plantinga]: https://github.com/pplantinga
[David Benjamin]: https://github.com/davidben
[Vania Kucher]: https://github.com/qWici


## Version 10.0.1
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 clearInterval clearTimeout'
};
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 + '\\()',
end: /{/,
keywords: "get set",
contains: [
Expand Down
3 changes: 2 additions & 1 deletion src/languages/typescript.js
Expand Up @@ -25,7 +25,8 @@ export default function(hljs) {
'TypeError URIError Number Math Date String RegExp Array Float32Array ' +
'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' +
'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' +
'module console window document any number boolean string void Promise'
'module console window document any number boolean string void Promise ' +
'setInterval setTimeout clearInterval clearTimeout'
};
var DECORATOR = {
className: 'meta',
Expand Down
@@ -0,0 +1,2 @@
<span class="hljs-built_in">setTimeout</span>();
<span class="hljs-built_in">setInterval</span>();
2 changes: 2 additions & 0 deletions test/markup/javascript/keyword-as-part-of-method-name.txt
@@ -0,0 +1,2 @@
setTimeout();
setInterval();