SQL Syntax highlighting

Issue #313 resolved
phpLiteAdmin repo owner created an issue

Syntax highlighting of SQL is some important missing feature I think. It seems easy to implement as nowadays there is lots of free open source stuff for this:

Would be also worth to check what phpMyAdmin uses.

Highlighting would be worth

  • in the SQL editor fields
  • in SQL output

Comments (8)

  1. phpLiteAdmin reporter

    phpMyAdmin uses Codemirror

    These features are interesting

    • highlighting SQLite fine (I think all do this good)
    • auto-completion of SQL keywords
    • auto-completion of table names and column names that already exists
    • this should work with names in "double quotes"! This does not work out-of-the-box in Codemirror, but phpMyAdmin can do it well in backticks, so it should be possible to adjust this
    • textarea-fallback solution for non-JS browsers (I read this is not easy with ACE, not sure if this is (still) true)
    • Syntax checking: phpMyAdmin marks lines with Syntax error. This uses the lint-addon of Codemirror. There is no sql-lint.js in Codemirror, though. The one that phpMyAdmin uses just runs an ajax request to a php script that checks the syntax. We could do the same.

    Generally, I like the way phpMyAdmin tweaked Codemirror. I think I will dig deeper in how they did it...

  2. phpLiteAdmin reporter

    With commit 61773432f8e21cc377181ec9cf670f4a65034757, CodeMirror was integrated.

    I also was successful to push improvements to CodeMirror to better handle SQLite:

    As we don't want to bloat the size of phpLiteAdmin with these things, I load CodeMirror from CDN. As the changes I pushed into the project have not yet made it into a release, I use rawgit's cdn for the changed files. Maybe we should make the CDN path configurable once there is a CodeMirror release that fits our needs.

    Still missing:

    • Syntax Check
    • syntax highlighting for SQL printed by PLA in confirm-messages
  3. phpLiteAdmin reporter

    I close this issue as the main feature is completed in 1.9.8. Remaining improvements may be addressed in separate issues.

  4. Log in to comment