From 6f7aa63ef2a0d6c332ced56538803fd6dded7a71 Mon Sep 17 00:00:00 2001 From: cyfung1031 <44498510+cyfung1031@users.noreply.github.com> Date: Wed, 13 Dec 2023 20:41:29 +0900 Subject: [PATCH] fix(javascript) incorrect function name highlighting --- CHANGES.md | 2 ++ src/languages/javascript.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 6957283bd0..c69428d731 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,6 +13,7 @@ Core Grammars: - enh(delphi) allow digits to be omitted for hex and binary literals [Jonah Jeleniewski][] - enh(delphi) add support for digit separators [Jonah Jeleniewski][] - enh(delphi) add support for character strings with non-decimal numerics [Jonah Jeleniewski][] +- fix(javascript) incorrect function name highlighting [CY Fung][] New Grammars: @@ -36,6 +37,7 @@ Developer Tool: [Robloxian Demo]: https://github.com/RobloxianDemo [Paul Tsnobiladzé]: https://github.com/tsnobip [Jonah Jeleniewski]: https://github.com/cirras +[CY Fung]: https://github.com/cyfung1031 ## Version 11.9.0 diff --git a/src/languages/javascript.js b/src/languages/javascript.js index a0adc24dbc..7ede395e75 100644 --- a/src/languages/javascript.js +++ b/src/languages/javascript.js @@ -388,8 +388,8 @@ export default function(hljs) { ...ECMAScript.BUILT_IN_GLOBALS, "super", "import" - ]), - IDENT_RE, regex.lookahead(/\(/)), + ].map(x => `${x}\\s*\\(`)), + IDENT_RE, regex.lookahead(/\s*\(/)), className: "title.function", relevance: 0 };