- edited description
SQL Syntax highlighting
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:
- ACE: https://ace.c9.io/
- Codemirror: http://codemirror.net/index.html
- Monaco https://github.com/Microsoft/monaco-editor
- Others: https://en.wikipedia.org/wiki/Comparison_of_JavaScript-based_source_code_editors
Would be also worth to check what phpMyAdmin uses.
Highlighting would be worth
- in the SQL editor fields
- in SQL output
Comments (8)
-
reporter -
reporter - edited description
-
reporter - edited description
-
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...
-
reporter With commit 61773432f8e21cc377181ec9cf670f4a65034757, CodeMirror was integrated.
I also was successful to push improvements to CodeMirror to better handle SQLite:
- https://github.com/codemirror/CodeMirror/commit/65c70cf5d18ac3a0c1a3fe717d90a81ff823aa9f
- https://github.com/codemirror/CodeMirror/commit/c4387d6073b15ccf0f32773eb71a54f3b694f2f0
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
-
reporter - changed status to open
-
reporter - changed milestone to 1.9.8
-
reporter - changed status to resolved
I close this issue as the main feature is completed in 1.9.8. Remaining improvements may be addressed in separate issues.
- Log in to comment