Frozen codemirror when user add new line into brackets


#1

I have problem with codemirror and matchingbrackets.js addon (i use simplemode for my own language specification).

function(arg,arg,arg)

function(arg
,arg,arg)

When user add new line into brackets space, the whole browser window was frozen. And i give this error log in console:
Error: Script terminated by timeout at:
getLine@http://localhost:7002/_web/resources/js/codemirror/lib/codemirror.js:6088:1
CodeMirror.prototype[prop]@http://localhost:7002/_web/resources/js/codemirror/lib/codemirror.js:9648:31
scanForBracket@http://localhost:7002/_web/resources/js/codemirror/addon/edit/matchbrackets.js:58:18
findMatchingBracket@http://localhost:7002/_web/resources/js/codemirror/addon/edit/matchbrackets.js:36:17
matchBrackets@http://localhost:7002/_web/resources/js/codemirror/addon/edit/matchbrackets.js:81:40
doMatchBrackets/<@http://localhost:7002/_web/resources/js/codemirror/addon/edit/matchbrackets.js:111:53
runInOp@http://localhost:7002/_web/resources/js/codemirror/lib/codemirror.js:3872:26
operation@http://localhost:7002/_web/resources/js/codemirror/lib/codemirror.js:8536:35
doMatchBrackets@http://localhost:7002/_web/resources/js/codemirror/addon/edit/matchbrackets.js:106:5
fireCallbacksForOps@http://localhost:7002/_web/resources/js/codemirror/lib/codemirror.js:2115:13
finishOperation@http://localhost:7002/_web/resources/js/codemirror/lib/codemirror.js:2124:9
endOperation@http://localhost:7002/_web/resources/js/codemirror/lib/codemirror.js:3746:3
docMethodOp/<@http://localhost:7002/_web/resources/js/codemirror/lib/codemirror.js:3902:15
CodeMirror.prototype[prop]@http://localhost:7002/_web/resources/js/codemirror/lib/codemirror.js:9648:31

Is there any solution how to fix this issue? I use latest stable version of codemirror (5.40)
I trying change some parameters in matching brackets.js but this changes has no effects :frowning:


#2

I can’t seem to reproduce this on a plain CodeMirror instance using your example (for example, https://codemirror.net/mode/javascript/ has bracket matching enabled). Can you give more specific instructions?


#3

Ok, i understand. It seems like problem that by caused SimpleMode addon. I think the solution can be write match brackets functionality in language specification?


#4

If the problem is caused by simple mode, how is matchbrackets relevant?