Bug 376005 - [PATCH] SCSS Highlighting fails with variables in @media rules
Summary: [PATCH] SCSS Highlighting fails with variables in @media rules
Status: RESOLVED FIXED
Alias: None
Product: frameworks-syntax-highlighting
Classification: Frameworks and Libraries
Component: syntax (show other bugs)
Version: unspecified
Platform: Other All
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 369254 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-02-04 15:12 UTC by Gary Pendergast
Modified: 2017-07-23 09:23 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: KDE Frameworks 5.32
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gary Pendergast 2017-02-04 15:12:58 UTC
To reproduce, open an SCSS file with the following content:

@media (min-width: $var) {}

Here's how I fixed it in my local repo, though I'm not certain this is the best way. :-)

https://github.com/PonyEdit/PonyEdit/commit/d8e153029433f088239cad779efc46d8cc091d1b
Comment 1 Dominik Haumann 2017-02-05 14:12:47 UTC
Could you attach a sample .SCSS file here that we can use for unit testing?
Best under MIT license.

And: I saw you have an own implementation in your PonyEdit text editor. You should consider simply using the KSyntaxHighlighting framework, see here:
https://kate-editor.org/2016/11/15/ksyntaxhighlighting-a-new-syntax-highlighting-framework/
This way, you get updates for free and you don't have to maintain it.
Comment 2 Dominik Haumann 2017-02-12 16:36:30 UTC
@Gary: ping
Comment 3 Dominik Haumann 2017-02-12 19:08:24 UTC
Git commit f92238c5cd210b4887fbd9f0c9cfe153361f292b by Dominik Haumann.
Committed on 12/02/2017 at 19:07.
Pushed by dhaumann into branch 'master'.

Update SCSS and CSS syntax highlight

Changes:
- Use less and more simple context rules.
- Support complex SCSS structures, e.g. variables in @media, nesting, variable define.
- Support SCSS functions.
- Support CSS @keyframes structure and @media conditions.
- Different highlight colors for id, class, attribute and pseudo selectors.
- Reduce highlight errors.

FIXED-IN: KDE Frameworks 5.32
REVIEW: 128925
Related: bug 368730

M  +2    -2    autotests/folding/highlight.css.fold
M  +8    -8    autotests/folding/review128925-1.css.fold
M  +28   -28   autotests/folding/review128925-1.scss.fold
M  +5    -5    autotests/folding/review128925-2.css.fold
M  +14   -14   autotests/folding/review128925-2.scss.fold
M  +41   -41   autotests/html/highlight.css.html
M  +57   -57   autotests/html/review128925-1.css.html
M  +132  -132  autotests/html/review128925-1.scss.html
M  +20   -20   autotests/html/review128925-2.css.html
M  +35   -35   autotests/html/review128925-2.scss.html
M  +6    -6    autotests/html/test.css.html
M  +2    -2    autotests/html/test.htm.html
M  +30   -30   autotests/reference/highlight.css.ref
M  +56   -56   autotests/reference/review128925-1.css.ref
M  +131  -131  autotests/reference/review128925-1.scss.ref
M  +19   -19   autotests/reference/review128925-2.css.ref
M  +34   -34   autotests/reference/review128925-2.scss.ref
M  +6    -6    autotests/reference/test.css.ref
M  +2    -2    autotests/reference/test.htm.ref
M  +79   -136  data/syntax/css.xml
M  +229  -171  data/syntax/scss.xml

https://commits.kde.org/syntax-highlighting/f92238c5cd210b4887fbd9f0c9cfe153361f292b
Comment 4 Dominik Haumann 2017-07-23 08:59:55 UTC
*** Bug 369254 has been marked as a duplicate of this bug. ***