Skip to content

Commit ba2e65e

Browse files
authored
prevented setter keyword conflicting with setTimeout|setInterval and highlighted them (#2514) (#2515)
* fix(javascript) prevent setter keyword 'set' conflicting with setTimeout|setInterval (#2514) * enh(javascript) setTimeout|setInterval now highlighted (#2514) * enh (javascript) clearInterval and clearTimeout now highlighted * add keywords to TypeScript also
1 parent d4b047b commit ba2e65e

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Deprecations:
1313

1414
Language Improvements:
1515

16+
- enh(typescript) add setInterval, setTimeout, clearInterval, clearTimeout (#2514) [Josh Goebel][]
17+
- enh(javascript) add setInterval, setTimeout, clearInterval, clearTimeout (#2514) [Vania Kucher][]
18+
- fix(javascript) prevent `set` keyword conflicting with setTimeout, etc. (#2514) [Vania Kucher][]
1619
- fix(cpp) Fix highlighting of unterminated raw strings (#2261) [David Benjamin][]
1720
- fix(javascript) `=>` function with nested `()` in params now works (#2502) [Josh Goebel][]
1821
- fix(typescript) `=>` function with nested `()` in params now works (#2502) [Josh Goebel][]
@@ -21,6 +24,7 @@ Language Improvements:
2124
[Josh Goebel]: https://github.com/yyyc514
2225
[Peter Plantinga]: https://github.com/pplantinga
2326
[David Benjamin]: https://github.com/davidben
27+
[Vania Kucher]: https://github.com/qWici
2428

2529

2630
## Version 10.0.1

src/languages/javascript.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default function(hljs) {
3333
'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' +
3434
'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' +
3535
'module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect ' +
36-
'Promise'
36+
'Promise setInterval setTimeout clearInterval clearTimeout'
3737
};
3838
var NUMBER = {
3939
className: 'number',
@@ -263,7 +263,7 @@ export default function(hljs) {
263263
beginKeywords: 'constructor', end: /\{/, excludeEnd: true
264264
},
265265
{
266-
begin:'(get|set)\\s*(?=' + IDENT_RE+ '\\()',
266+
begin: '(get|set)\\s+(?=' + IDENT_RE + '\\()',
267267
end: /{/,
268268
keywords: "get set",
269269
contains: [

src/languages/typescript.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ export default function(hljs) {
2525
'TypeError URIError Number Math Date String RegExp Array Float32Array ' +
2626
'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' +
2727
'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' +
28-
'module console window document any number boolean string void Promise'
28+
'module console window document any number boolean string void Promise ' +
29+
'setInterval setTimeout clearInterval clearTimeout'
2930
};
3031
var DECORATOR = {
3132
className: 'meta',
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<span class="hljs-built_in">setTimeout</span>();
2+
<span class="hljs-built_in">setInterval</span>();
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
setTimeout();
2+
setInterval();

0 commit comments

Comments
 (0)