diff options
author | Luke Granger-Brown <git@lukegb.com> | 2020-11-27T17·39+0000 |
---|---|---|
committer | lukegb <lukegb@tvl.fyi> | 2020-11-29T02·26+0000 |
commit | 77be22549a436d0869d8f8c91c09e5b3219567b7 (patch) | |
tree | 8765087c25d6867723dcf00c3dd4df5c18907cf2 /third_party/gerrit/0003-Syntax-highlight-rules.pl.patch | |
parent | 36cf7bef24bbd5ffccc8bac47a8c4d10dd5a265c (diff) |
chore(3p/gerrit): update to latest upstream HEAD r/1957
Change-Id: Ia7b17ca83ace164881a4dd8b0288741489bc467c Reviewed-on: https://cl.tvl.fyi/c/depot/+/2164 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi> Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'third_party/gerrit/0003-Syntax-highlight-rules.pl.patch')
-rw-r--r-- | third_party/gerrit/0003-Syntax-highlight-rules.pl.patch | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/third_party/gerrit/0003-Syntax-highlight-rules.pl.patch b/third_party/gerrit/0003-Syntax-highlight-rules.pl.patch index 3b87dc14f2bc..a3165444237c 100644 --- a/third_party/gerrit/0003-Syntax-highlight-rules.pl.patch +++ b/third_party/gerrit/0003-Syntax-highlight-rules.pl.patch @@ -1,44 +1,46 @@ -From a8dad8e63a1be32f473e96c6c7530a70d368369f Mon Sep 17 00:00:00 2001 +From 9358b1cdd5f13e6638030446880f731785ca38f1 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown <git@lukegb.com> Date: Thu, 2 Jul 2020 23:02:43 +0100 -Subject: [PATCH 3/7] Syntax highlight rules.pl +Subject: [PATCH 3/6] Syntax highlight rules.pl --- - .../elements/diff/gr-syntax-layer/gr-syntax-layer.js | 10 ++++++++++ - 1 file changed, 10 insertions(+) + .../diff/gr-syntax-layer/gr-syntax-layer.ts | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) -diff --git a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js -index 480d2946c3..b2020c24bd 100644 ---- a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js -+++ b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js -@@ -103,6 +103,10 @@ const LANGUAGE_MAP = { - }; +diff --git a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.ts b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.ts +index 0c3bb40ce4..ace253da30 100644 +--- a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.ts ++++ b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.ts +@@ -109,6 +109,10 @@ const LANGUAGE_MAP = new Map<string, string>([ + ]); const ASYNC_DELAY = 10; -+const FILENAME_OVERRIDES = { -+ 'rules.pl': 'prolog', -+}; ++const FILENAME_OVERRIDES = new Map<string, string>([ ++ ['rules.pl', 'prolog'], ++]); + - const CLASS_SAFELIST = { - 'gr-diff gr-syntax gr-syntax-attr': true, - 'gr-diff gr-syntax gr-syntax-attribute': true, -@@ -234,10 +238,16 @@ class GrSyntaxLayer extends GestureEventListeners( + const CLASS_SAFELIST = new Set<string>([ + 'gr-diff gr-syntax gr-syntax-attr', + 'gr-diff gr-syntax gr-syntax-attribute', +@@ -258,10 +262,17 @@ export class GrSyntaxLayer } } -+ _basename(filename) { ++ _basename(filename: string): string { + const pieces = filename.split(/\//); + return pieces[pieces.length-1]; + } + - _getLanguage(diffFileMetaInfo) { + _getLanguage(metaInfo: DiffFileMetaInfo) { // The Gerrit API provides only content-type, but for other users of // gr-diff it may be more convenient to specify the language directly. - return diffFileMetaInfo.language || -+ FILENAME_OVERRIDES[this._basename(diffFileMetaInfo.name)] || - LANGUAGE_MAP[diffFileMetaInfo.content_type]; +- return metaInfo.language ?? LANGUAGE_MAP.get(metaInfo.content_type); ++ return metaInfo.language ?? ++ FILENAME_OVERRIDES.get(this._basename(metaInfo.name)) ?? ++ LANGUAGE_MAP.get(metaInfo.content_type); } + /** -- -2.27.0 +2.29.2 |