codemirrorcodemirror-modes

How to make double quotes and single quotes be handled the same


We have an issue finding a way to make codemirror behave the same for single and double quote strings.

enter image description here

It would have been been a quick css hack but, for double quotes the css generated has no tags around it.

The single quotes have a class called "cm-string" that would be nice to have on both.


Solution

  • For me it is like this. I use the theme light, in the theme / light.css file line: .cm-s-light span.cm-string {color: # 3ad900; } it displays me like on the screen "" and "the same in green Search in your theme file. enter image description here

    AND for file sql.js in line 57:

     } else if (ch == "'" || (ch == '"' && support.doubleQuote)) {
    

    remove:

     && support.doubleQuote
    

    so that it stays:

     } else if (ch == "'" || (ch == '"')) {
    

    and you will get the desired effect in SQL mode.

    enter image description here

    For TCL Replace line 45 tcl.js:

       if ((ch == '"' || ch == "'") && state.inParams) {
    

    such as line:

       if ((ch == '"' || ch == "'")) {