diff --git a/mode/javascript/javascript.js b/mode/javascript/javascript.js index 7d62e929444e97cb0eaa860a41e01fedaf5a71ed..77bd59c3725fe42b25a9ebdf4c67966ac87f469d 100644 --- a/mode/javascript/javascript.js +++ b/mode/javascript/javascript.js @@ -491,6 +491,9 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { } else if (type == "variable" || cx.style == "keyword") { cx.marked = "property"; if (value == "get" || value == "set") return cont(getterSetter); + var m // Work around fat-arrow-detection complication for detecting typescript typed arrow params + if (isTS && cx.state.fatArrowAt == cx.stream.start && (m = cx.stream.match(/^\s*:\s*/, false))) + cx.state.fatArrowAt = cx.stream.pos + m[0].length return cont(afterprop); } else if (type == "number" || type == "string") { cx.marked = jsonldMode ? "property" : (cx.style + " property"); diff --git a/mode/javascript/test.js b/mode/javascript/test.js index f110b5c263d9004d8fc397d33582eb5ae1b986aa..8b6ca41128816f24b6d3472bad630d58421beeab 100644 --- a/mode/javascript/test.js +++ b/mode/javascript/test.js @@ -352,6 +352,9 @@ " [property constructor]([keyword readonly] [keyword private] [def x]) {}", "}") + TS("arrow prop", + "({[property a]: [def p] [operator =>] [variable-2 p]})") + var jsonld_mode = CodeMirror.getMode( {indentUnit: 2}, {name: "javascript", jsonld: true}