Register a language handler for the given file extensions. * @param {function (Object)} handler a function from source code to a list * of decorations. Takes a single argument job which describes the * state of the computation. The single parameter has the form * {@
(handler, fileExtensions)
| 1237 | * @param {Array.<string>} fileExtensions |
| 1238 | */ |
| 1239 | function registerLangHandler(handler, fileExtensions) { |
| 1240 | for (var i = fileExtensions.length; --i >= 0;) { |
| 1241 | var ext = fileExtensions[i]; |
| 1242 | if (!langHandlerRegistry.hasOwnProperty(ext)) { |
| 1243 | langHandlerRegistry[ext] = handler; |
| 1244 | } else if (win['console']) { |
| 1245 | console['warn']('cannot override language handler %s', ext); |
| 1246 | } |
| 1247 | } |
| 1248 | } |
| 1249 | function langHandlerForExtension(extension, source) { |
| 1250 | if (!(extension && langHandlerRegistry.hasOwnProperty(extension))) { |
| 1251 | // Treat it as markup if the first non whitespace character is a < and |
no outgoing calls
no test coverage detected