[jsx mode] Support trailing-comma generics syntax in JSX with TS
Issue https://github.com/codemirror/codemirror5/pull/7073
This commit is contained in:
parent
2329ebb19b
commit
bcb86262e8
|
@ -103,7 +103,7 @@
|
|||
}
|
||||
|
||||
function jsToken(stream, state, cx) {
|
||||
if (stream.peek() == "<" && jsMode.expressionAllowed(stream, cx.state)) {
|
||||
if (stream.peek() == "<" && !/,\s*>/.test(stream.string) && jsMode.expressionAllowed(stream, cx.state)) {
|
||||
state.context = new Context(CodeMirror.startState(xmlMode, jsMode.indent(cx.state, "", "")),
|
||||
xmlMode, 0, state.context)
|
||||
jsMode.skipExpression(cx.state)
|
||||
|
|
|
@ -95,4 +95,6 @@
|
|||
"[bracket&tag <][tag MyComponent] [attribute foo]=[string \"bar\"] [bracket&tag />]; [comment //ok]",
|
||||
"[bracket&tag <][tag MyComponent] [attribute foo]={[number 0]} [bracket&tag />]; [comment //error]")
|
||||
|
||||
TS("tsx_react_generics",
|
||||
"[variable x] [operator =] [operator <] [variable T],[operator >] ([def v]: [type T]) [operator =>] [variable-2 v];")
|
||||
})()
|
||||
|
|
Loading…
Reference in New Issue