| Summary: | Ruby string interpolation ignored in percent literals | ||
|---|---|---|---|
| Product: | [Frameworks and Libraries] frameworks-syntax-highlighting | Reporter: | Marián Konček <koncek.marian> |
| Component: | syntax | Assignee: | KWrite Developers <kwrite-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | walter.von.entferndt |
| Priority: | NOR | ||
| Version First Reported In: | 5.115.0 | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | https://invent.kde.org/frameworks/syntax-highlighting/-/commit/994c8cc92598a9dac20aa99a89a75b50e21ae3f0 | Version Fixed/Implemented In: | |
| Sentry Crash Report: | |||
OBSERVED RESULT
The syntax highlighter displays the content inside for example this string `%W(#{foo})` in string color.
EXPECTED RESULT
The syntax highlighter should color the string `%W(#{foo})` like it would color this string `"#{foo}"`.
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/657 Git commit 994c8cc92598a9dac20aa99a89a75b50e21ae3f0 by Christoph Cullmann, on behalf of Jonathan Poelen. Committed on 18/09/2024 at 21:50. Pushed by cullmann into branch 'master'. Ruby: fix %W, dot member, some parenthesis ; add ?c, escape char, etc - fix `(` in `test(if ...)` (should be Normal Text, not Keyword) - fix exponent number (1e3) - fix constants followed by ? or ! (they are not constants) - fix some context that expects values (regex in `def foo() /reg/...`) - fix percent literal with `_` as separator (`%_..._`) - fix %W literal - fix `alias / +` - add %s literal - add ?c literal - add 0dnnn literal - add 0Onnn literal - add 'Number Suffix' style: 123r, 123i and 123ri - add 'String Char' style for escaped sequence: \xHH, \unnnnn, etc M +17 -17 autotests/folding/highlight.haml.fold M +140 -69 autotests/folding/highlight.rb.fold M +54 -54 autotests/html/highlight.haml.dark.html M +54 -54 autotests/html/highlight.haml.html M +285 -214 autotests/html/highlight.rb.dark.html M +285 -214 autotests/html/highlight.rb.html M +100 -29 autotests/input/highlight.rb M +60 -60 autotests/reference/highlight.haml.ref M +203 -132 autotests/reference/highlight.rb.ref M +5 -5 data/syntax/haml.xml M +3 -3 data/syntax/jira.xml M +3 -3 data/syntax/latex.xml M +3 -3 data/syntax/markdown.xml M +3 -3 data/syntax/orgmode.xml M +975 -503 data/syntax/ruby.xml https://invent.kde.org/frameworks/syntax-highlighting/-/commit/994c8cc92598a9dac20aa99a89a75b50e21ae3f0 |
SUMMARY Syntax highlighter correctly distinguishes string interpolation in normal strings like: "#{foo}". But in Ruby there are more types of string literals, see: https://docs.ruby-lang.org/en/master/syntax/literals_rdoc.html#label-Percent+Literals Percent literals which use an uppercase letter allow interpolation whereas lowercase letter do not: %w(#{foo}) # no interpolation, string is taken literally %W(#{foo}) # foo is interpolated. STEPS TO REPRODUCE 1. 2. 3. OBSERVED RESULT EXPECTED RESULT SOFTWARE/OS VERSIONS Windows: macOS: Linux/KDE Plasma: 6.8.10-200 (available in About System) KDE Plasma Version: 5.27.11 KDE Frameworks Version: 5.115.0 Qt Version: 5.15.13 ADDITIONAL INFORMATION