pawelsalawa / sqlitestudio

A free, open source, multi-platform SQLite database manager.
https://sqlitestudio.pl
Other
4.67k stars 571 forks source link

Syntax cheker in Functions editor #5081

Open marcpley opened 3 weeks ago

marcpley commented 3 weeks ago

Details

It seems that the syntax checker work in all windows except the SQL Functions editor. It don't detect Unbalanced brackets. Is there a raison to that ?

SQLiteStudio version

3.4.4

pawelsalawa commented 3 weeks ago

Functions Editor, Collations Editor, Code Snippets - in all these it does not work (at least I checked these). Apparently bracket pair highlighting feature is somehow not active there. Let's keep this issue to track it.

marcpley commented 2 weeks ago

It works here: ../guiSQLiteStudio/windows/editorwindow.ui line 50 <widget class="SqlEditor" name="sqlEdit"> line 154

  <customwidget>
   <class>SqlEditor</class>
   <extends>QPlainTextEdit</extends>
   <header>sqleditor.h</header>
  </customwidget>

and not here ../guiSQLiteStudio/windows/functionseditor.ui line 304 <widget class="QPlainTextEdit" name="initCodeEdit">

highlightCurrentCursorContext is never called, probably because initCodeEdit is not SqlEditor.

pawelsalawa commented 1 week ago

I've looked into this and yes, you are right about why it doesn't work. I also found out why it is how it is. Functions editor, Collations Editor - they can have different programming language implementations, therefore SqlEditor is not necessarily best fit for all of them.

Brackets matching code should ideally be moved out of SqlEditor class and made usable for any syntax highligter (as each function language can provide its own syntax highligter). Syntax Highligters are generic objects for all QPlainTextEdit, so that should work, although it's potentially big effort. If you're willing to try and do it - let me know. Otherwise I will reschedule this issue into 3.5.0 or 3.6.0.

marcpley commented 1 week ago

I'm not crawling easily into classes. at this time it is too difficult for me. Perhaps if you show me an action that I would have to reproduce on several files, I could try.

pawelsalawa commented 1 week ago

No no, we don't want to reproduce (repeat) such big chunks of code. This needs extraction int separate class and then re-usage from various points. I think it's not a good issue to work on when you're getting familiar with the project. Leave it to me - at least for now.