summaryrefslogtreecommitdiffstats
path: root/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js
diff options
context:
space:
mode:
Diffstat (limited to 'polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js')
-rw-r--r--polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js108
1 files changed, 73 insertions, 35 deletions
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 91e62874fb..8bf42b79e1 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
@@ -1,85 +1,123 @@
-// Copyright (C) 2016 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+/**
+ * @license
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
(function() {
'use strict';
const LANGUAGE_MAP = {
'application/dart': 'dart',
'application/json': 'json',
+ 'application/x-powershell': 'powershell',
'application/typescript': 'typescript',
+ 'application/xml': 'xml',
+ 'application/xquery': 'xquery',
'application/x-erb': 'erb',
'text/css': 'css',
'text/html': 'html',
'text/javascript': 'js',
+ 'text/jsx': 'jsx',
'text/x-c': 'cpp',
'text/x-c++src': 'cpp',
'text/x-clojure': 'clojure',
+ 'text/x-cmake': 'cmake',
+ 'text/x-coffeescript': 'coffeescript',
'text/x-common-lisp': 'lisp',
+ 'text/x-crystal': 'crystal',
'text/x-csharp': 'csharp',
'text/x-csrc': 'cpp',
'text/x-d': 'd',
+ 'text/x-diff': 'diff',
+ 'text/x-django': 'django',
+ 'text/x-dockerfile': 'dockerfile',
+ 'text/x-ebnf': 'ebnf',
+ 'text/x-elm': 'elm',
+ 'text/x-erlang': 'erlang',
+ 'text/x-fortran': 'fortran',
'text/x-go': 'go',
+ 'text/x-groovy': 'groovy',
+ 'text/x-haml': 'haml',
'text/x-haskell': 'haskell',
+ 'text/x-haxe': 'haxe',
+ 'text/x-ini': 'ini',
'text/x-java': 'java',
+ 'text/x-julia': 'julia',
'text/x-kotlin': 'kotlin',
+ 'text/x-latex': 'latex',
+ 'text/x-less': 'less',
'text/x-lua': 'lua',
- 'text/x-markdown': 'markdown',
+ 'text/x-mathematica': 'mathematica',
+ 'text/x-nginx-conf': 'nginx',
+ 'text/x-nsis': 'nsis',
'text/x-objectivec': 'objectivec',
'text/x-ocaml': 'ocaml',
'text/x-perl': 'perl',
+ 'text/x-pgsql': 'pgsql', // postgresql
'text/x-php': 'php',
+ 'text/x-properties': 'properties',
'text/x-protobuf': 'protobuf',
'text/x-puppet': 'puppet',
'text/x-python': 'python',
+ 'text/x-q': 'q',
'text/x-ruby': 'ruby',
'text/x-rustsrc': 'rust',
'text/x-scala': 'scala',
+ 'text/x-scss': 'scss',
+ 'text/x-scheme': 'scheme',
'text/x-shell': 'shell',
+ 'text/x-spreadsheet': 'excel',
'text/x-sh': 'bash',
'text/x-sql': 'sql',
'text/x-swift': 'swift',
+ 'text/x-systemverilog': 'sv',
+ 'text/x-tcl': 'tcl',
+ 'text/x-twig': 'twig',
+ 'text/x-vb': 'vb',
+ 'text/x-verilog': 'v',
'text/x-yaml': 'yaml',
+ 'text/vbscript': 'vbscript',
};
const ASYNC_DELAY = 10;
const CLASS_WHITELIST = {
- 'gr-diff gr-syntax gr-syntax-literal': true,
- 'gr-diff gr-syntax gr-syntax-keyword': true,
- 'gr-diff gr-syntax gr-syntax-selector-tag': true,
+ 'gr-diff gr-syntax gr-syntax-attr': true,
+ 'gr-diff gr-syntax gr-syntax-attribute': true,
'gr-diff gr-syntax gr-syntax-built_in': true,
- 'gr-diff gr-syntax gr-syntax-type': true,
- 'gr-diff gr-syntax gr-syntax-selector-pseudo': true,
- 'gr-diff gr-syntax gr-syntax-template-variable': true,
- 'gr-diff gr-syntax gr-syntax-number': true,
- 'gr-diff gr-syntax gr-syntax-regexp': true,
- 'gr-diff gr-syntax gr-syntax-variable': true,
- 'gr-diff gr-syntax gr-syntax-selector-attr': true,
- 'gr-diff gr-syntax gr-syntax-template-tag': true,
- 'gr-diff gr-syntax gr-syntax-string': true,
- 'gr-diff gr-syntax gr-syntax-selector-id': true,
- 'gr-diff gr-syntax gr-syntax-title': true,
'gr-diff gr-syntax gr-syntax-comment': true,
+ 'gr-diff gr-syntax gr-syntax-function': true,
+ 'gr-diff gr-syntax gr-syntax-keyword': true,
+ 'gr-diff gr-syntax gr-syntax-link': true,
+ 'gr-diff gr-syntax gr-syntax-literal': true,
'gr-diff gr-syntax gr-syntax-meta': true,
'gr-diff gr-syntax gr-syntax-meta-keyword': true,
- 'gr-diff gr-syntax gr-syntax-tag': true,
'gr-diff gr-syntax gr-syntax-name': true,
- 'gr-diff gr-syntax gr-syntax-attr': true,
- 'gr-diff gr-syntax gr-syntax-attribute': true,
- 'gr-diff gr-syntax gr-syntax-emphasis': true,
- 'gr-diff gr-syntax gr-syntax-strong': true,
- 'gr-diff gr-syntax gr-syntax-link': true,
+ 'gr-diff gr-syntax gr-syntax-number': true,
+ 'gr-diff gr-syntax gr-syntax-params': true,
+ 'gr-diff gr-syntax gr-syntax-regexp': true,
+ 'gr-diff gr-syntax gr-syntax-selector-attr': true,
'gr-diff gr-syntax gr-syntax-selector-class': true,
+ 'gr-diff gr-syntax gr-syntax-selector-id': true,
+ 'gr-diff gr-syntax gr-syntax-selector-pseudo': true,
+ 'gr-diff gr-syntax gr-syntax-selector-tag': true,
+ 'gr-diff gr-syntax gr-syntax-string': true,
+ 'gr-diff gr-syntax gr-syntax-tag': true,
+ 'gr-diff gr-syntax gr-syntax-template-tag': true,
+ 'gr-diff gr-syntax gr-syntax-template-variable': true,
+ 'gr-diff gr-syntax gr-syntax-title': true,
+ 'gr-diff gr-syntax gr-syntax-type': true,
+ 'gr-diff gr-syntax gr-syntax-variable': true,
};
const CPP_DIRECTIVE_WITH_LT_PATTERN = /^\s*#(if|define).*</;
@@ -438,7 +476,7 @@
},
_loadHLJS() {
- return this.$.libLoader.get().then(hljs => {
+ return this.$.libLoader.getHLJS().then(hljs => {
this._hljs = hljs;
});
},