codemirror / codemirror5

In-browser code editor (version 5, legacy)
http://codemirror.net/5/
MIT License
26.77k stars 4.97k forks source link

The problem is about SQL schema parenthesis nested line breaks #6738

Open NAN0916 opened 3 years ago

NAN0916 commented 3 years ago

codemirror@5.37.0 mode: x-mysql

When parentheses are nested within a line

There are problems with line wrapping

image

I don't expect that so i update /codemirror/mode/sql/sql.js
line 184

 const temp = stream.string.slice(stream.start+1, stream.string.length);
  if (tok == "(" && temp.indexOf('(') === -1)
        pushContext(stream, state, ")");
      else if (tok == "[" &&  temp.indexOf('[') === -1)
        pushContext(stream, state, "]");

It looks fine

image

so Can we change the code like this?

marijnh commented 3 years ago

I cannot reproduce this problem. If I put a text similar to what you show in your screenshot into http://cm/mode/sql/?mime=text/x-mysql , each line is indented 0 units, as expected.