From 46b93a27f88b865c24ce87b7f4af80ad36d6fe7b Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke <marijn@haverbeke.nl> Date: Fri, 5 Aug 2016 14:00:03 +0200 Subject: [PATCH] [javascript mode] Support for TypeScript object types Closes #4149 --- mode/javascript/javascript.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mode/javascript/javascript.js b/mode/javascript/javascript.js index da6b760f7..79239ef46 100644 --- a/mode/javascript/javascript.js +++ b/mode/javascript/javascript.js @@ -525,6 +525,15 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { } function typeexpr(type) { if (type == "variable") {cx.marked = "variable-3"; return cont(afterType);} + if (type == "{") return cont(commasep(typeprop, "}")) + } + function typeprop(type, value) { + if (type == "variable" || cx.style == "keyword") { + cx.marked = "property" + return cont(typeprop) + } else if (type == ":") { + return cont(typeexpr) + } } function afterType(type, value) { if (value == "<") return cont(commasep(typeexpr, ">"), afterType) -- GitLab