Bug 27747 - Add CodeMirror custom syntax highlighting for column placeholders
Summary: Add CodeMirror custom syntax highlighting for column placeholders
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Owen Leonard
QA Contact: Nick Clemens
URL:
Keywords:
Depends on: 27643
Blocks:
  Show dependency treegraph
 
Reported: 2021-02-22 12:33 UTC by Owen Leonard
Modified: 2021-07-30 15:14 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Text to go in the release notes:
This patch modifies the configuration of the reports module's SQL editor so that column placeholders have their own syntax highlighting, setting them apart by color from other parts of the SQL code.
Version(s) released in:
21.11.00


Attachments
Bug 27747: Add CodeMirror custom syntax highlighting for column placeholders (4.23 KB, patch)
2021-02-22 12:43 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 27747: Add CodeMirror custom syntax highlighting for column placeholders (4.34 KB, patch)
2021-05-11 16:24 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 27747: Add CodeMirror custom syntax highlighting for column placeholders (4.39 KB, patch)
2021-07-23 13:07 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 27747: (QA follow-up) Make code consistent and add explicit brackets (2.30 KB, patch)
2021-07-23 13:07 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2021-02-22 12:33:57 UTC
I propose we add a basic syntax highlighting configuration for column placeholders (Bug 23390), defined as any string surrounded by square brackets: [[itemnumber|Item number]].
Comment 1 Owen Leonard 2021-02-22 12:43:03 UTC
Created attachment 117146 [details] [review]
Bug 27747: Add CodeMirror custom syntax highlighting for column placeholders

This patch adds some additional configuration to CodeMirror so that
column placeholders have a distinct color in the CodeMirror SQL editor.

To test, apply the patch and create or edit an SQL report which contains
one or more column placeholders, e.g. [[itemnumber|Item number]],
[[borrowernumber|Borrower number]], etc.

Confirm that when editing the SQL, these placeholders should appear as
red text. Save your report and view it. The syntax highlighting should
be updated in this view too.
Comment 2 Lucas Gass 2021-05-11 16:24:08 UTC
Created attachment 120849 [details] [review]
Bug 27747: Add CodeMirror custom syntax highlighting for column placeholders

This patch adds some additional configuration to CodeMirror so that
column placeholders have a distinct color in the CodeMirror SQL editor.

To test, apply the patch and create or edit an SQL report which contains
one or more column placeholders, e.g. [[itemnumber|Item number]],
[[borrowernumber|Borrower number]], etc.

Confirm that when editing the SQL, these placeholders should appear as
red text. Save your report and view it. The syntax highlighting should
be updated in this view too.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 3 Nick Clemens 2021-07-23 13:07:56 UTC
Created attachment 123108 [details] [review]
Bug 27747: Add CodeMirror custom syntax highlighting for column placeholders

This patch adds some additional configuration to CodeMirror so that
column placeholders have a distinct color in the CodeMirror SQL editor.

To test, apply the patch and create or edit an SQL report which contains
one or more column placeholders, e.g. [[itemnumber|Item number]],
[[borrowernumber|Borrower number]], etc.

Confirm that when editing the SQL, these placeholders should appear as
red text. Save your report and view it. The syntax highlighting should
be updated in this view too.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 4 Nick Clemens 2021-07-23 13:07:59 UTC
Created attachment 123109 [details] [review]
Bug 27747: (QA follow-up) Make code consistent and add explicit brackets

The while statements were including the next statement, I add brackets to make it
more obvious

Also the highlighting was applying to [[borrowernumber|Borrow number]
I removed the break to match code above and only highlight when syntax complete and correct

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 5 Jonathan Druart 2021-07-26 10:47:27 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 6 Kyle M Hall 2021-07-30 15:14:22 UTC
Enhancement not backported for 21.05