about summary refs log tree commit diff
path: root/third_party
diff options
context:
space:
mode:
authorLuke Granger-Brown <git@lukegb.com>2020-06-14T11·36+0100
committerlukegb <lukegb@tvl.fyi>2020-06-14T17·24+0000
commit5ae0e44d1b02231dff67388a7ac57cf82a14926b (patch)
tree7573a5379673cab643ca3a0db2319800a334bada /third_party
parentc05803ff14f7d7c911bdc91383703b5cd9342396 (diff)
feat(gerrit): Syntax highlight .nix files. r/951
highlight.js supports syntax highlighting .nix files, but the Gerrit
diff components doesn't map the .nix mimetype onto the nix language.

.nix appears to already be taken by another mimetype that isn't
Nix-related, but we just map that onto nix anyway.

https://usercontent.irccloud-cdn.com/file/AVhoPvrb/highlighted.png

Change-Id: I842b29c78355e5bec580e711e25d693284ab6f59
Reviewed-on: https://cl.tvl.fyi/c/depot/+/253
Reviewed-by: tazjin <mail@tazj.in>
Reviewed-by: q3k <q3k@q3k.org>
Diffstat (limited to 'third_party')
-rw-r--r--third_party/gerrit/default.nix5
-rw-r--r--third_party/gerrit/syntax_highlight_nix.patch12
2 files changed, 16 insertions, 1 deletions
diff --git a/third_party/gerrit/default.nix b/third_party/gerrit/default.nix
index de2fb71576..1db37afedc 100644
--- a/third_party/gerrit/default.nix
+++ b/third_party/gerrit/default.nix
@@ -39,7 +39,10 @@ pkgs.buildBazelPackage {
     sha256 = "1xrckiqc2l07dib22rn6iicgvph8iyxjrzr15bs5x6jdg9cic1s8";
     fetchSubmodules = true;
   };
-  patches = [ ./use_detzip.patch ];
+  patches = [
+    ./use_detzip.patch
+    ./syntax_highlight_nix.patch
+  ];
 
   bazelTarget = "release";
   inherit bazel;
diff --git a/third_party/gerrit/syntax_highlight_nix.patch b/third_party/gerrit/syntax_highlight_nix.patch
new file mode 100644
index 0000000000..2a7791c756
--- /dev/null
+++ b/third_party/gerrit/syntax_highlight_nix.patch
@@ -0,0 +1,12 @@
+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 1a0bbd9f50..0f2786a911 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
+@@ -99,6 +99,7 @@ const LANGUAGE_MAP = {
+   'text/x-vhdl': 'vhdl',
+   'text/x-yaml': 'yaml',
+   'text/vbscript': 'vbscript',
++  'application/x-mix-transfer': 'nix',
+ };
+ const ASYNC_DELAY = 10;
+