diff options
| author | Frank LENORMAND <lenormf@gmail.com> | 2018-02-17 11:53:56 +0300 |
|---|---|---|
| committer | Frank LENORMAND <lenormf@gmail.com> | 2018-02-17 11:53:56 +0300 |
| commit | f25e8640b8a5194d155675d9f31f71b4a35f283d (patch) | |
| tree | 01a918e7f68e50d48d01eca3ff60f34e37581175 /rc/base/javascript.kak | |
| parent | f5e39972eb525166dc5b1d963067f79990991a75 (diff) | |
base javascript: Tweak variable highlighting
This commit avoids false positives when highlighting literals such as
`$window`, which is a regular variable but still highlighted as a
special value.
Special highlighting of variables that start with a dollar sign `$`
was also removed, as not all variables start with a dollar sign,
and we don't have a reliable way yet to detect variables.
Diffstat (limited to 'rc/base/javascript.kak')
| -rw-r--r-- | rc/base/javascript.kak | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/rc/base/javascript.kak b/rc/base/javascript.kak index 59f1f746..bda5396b 100644 --- a/rc/base/javascript.kak +++ b/rc/base/javascript.kak @@ -64,8 +64,7 @@ define-command -hidden init-javascript-filetype -params 1 %~ add-highlighter "shared/%arg{1}/literal" fill string add-highlighter "shared/%arg{1}/literal" regex \$\{.*?\} 0:value - add-highlighter "shared/%arg{1}/code" regex \$\w* 0:variable - add-highlighter "shared/%arg{1}/code" regex \b(document|false|null|parent|self|this|true|undefined|window)\b 0:value + add-highlighter "shared/%arg{1}/code" regex [^$_]\b(document|false|null|parent|self|this|true|undefined|window)\b 1:value add-highlighter "shared/%arg{1}/code" regex "-?\b[0-9]*\.?[0-9]+" 0:value add-highlighter "shared/%arg{1}/code" regex \b(Array|Boolean|Date|Function|Number|Object|RegExp|String|Symbol)\b 0:type |
