Page MenuHomePhabricator

Quarry's indentation function is not completely functional
Closed, ResolvedPublicBUG REPORT


When you open a parenthesis in Quarry's SQL editor and go to the next line, it gets intended by two spaces. However, when you close the parenthesis it doesn't get de-intended back to the left. (It does it for the line after the close parenthesis, but not the close parenthesis itself, resulting in unaligned pairs of parentheses).

Also if you remove the indentation inside the parentheses (or change it to something other than 2 spaces), Quarry doesn't recognize that and still does it its own way. This really doesn't help with Tidy'ing the SQL statements.

I recommend either disabling this and allowing users to indent at will, or to use a fully functional mechanism (potentially, by using an existing Tidy algorithm).

Event Timeline

Huji raised the priority of this task from to Needs Triage.
Huji updated the task description. (Show Details)
Huji added a project: Quarry.
Huji subscribed.
Huji set Security to None.

So this is using the sql mode of the codemirror code editor, and this seems to be that one's behavior. I guess possible options are:

  1. Turn off autoindent for everyone
  2. Make it an editor option
  3. Switch off CodeMirror, on to some other Editor (ACE?)
  4. Add proper deindent functionality to the codemirror sql mode

Note sure which one I prefer, but I do not like adding more options so would prefer to avoid (3)

Change 368603 had a related patch set uploaded (by Zhuyifei1999; owner: Zhuyifei1999):
[analytics/quarry/web@master] view.js: Set electricChars: ')' for SQL

Change 368603 merged by jenkins-bot:
[analytics/quarry/web@master] view.js: Set electricChars: ')' for SQL

Huji claimed this task.
Huji removed a project: Patch-For-Review.

Mentioned in SAL (#wikimedia-cloud) [2017-07-31T01:01:35Z] <zhuyifei1999_> zhuyifei1999@quarry-main-01:/srv/quarry$ sudo git fetch; sudo git checkout 7dd8c60; sudo service uwsgi restart T101424

@zhuyifei1999 unsure if it should take effect in minutes or not, but I just checked now and it didn't solve the problem on yet. Re-opening for now.

Works for me. Have you cleared your browser cache?

It was a cache issue. Good catch! (No pun intended).

Aklapper changed the subtype of this task from "Task" to "Bug Report".Jul 18 2023, 12:20 PM