This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 238988 - Errors in parsing URL in SCSS, LESS
Summary: Errors in parsing URL in SCSS, LESS
Status: NEW
Alias: None
Product: web
Classification: Unclassified
Component: CSS Preprocessors (SASS, LESS, ...) (show other bugs)
Version: 8.1
Hardware: All All
: P3 normal with 1 vote (vote)
Assignee: Milutin Kristofic
URL:
Keywords:
: 233038 241480 246822 248898 256496 258158 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-11-29 23:50 UTC by squarestar
Modified: 2016-05-03 13:52 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
screenshot of ide text editor (17.92 KB, image/jpeg)
2013-11-29 23:50 UTC, squarestar
Details
screen shot of hint about unexpected COLON (74.15 KB, image/png)
2015-09-14 22:56 UTC, rweaver
Details

Note You need to log in before you can comment on or make changes to this bug.
Description squarestar 2013-11-29 23:50:32 UTC
Created attachment 142736 [details]
screenshot of ide text editor

Many SCSS files display "Unexpected token" errors of different kinds. This would not be critical except that it prevents Netbeans from using editor colours, document links, folding and all other IDE enhancements for any code after the errors (in some cases).

This code is one such error:

@each $ord in 1, 2, 3, 4 {
	
	body._#{$ord} #page {
		background: $page-bg url(#{$scssDir}/images/bg#{$ord}-squares-blue.png);
	}
	
}

This produces valid CSS when parsed by scssphp, but prevents Netbeans from implementing any advanced text editing features after it, as can be seen in the attached image.

Here is the list of unexpected tokens found in the code (all but 'RBRACE' are from the 'background: ...' line):
ERROR, WS, SOLIDUS, INDENT, RPAREN, SEMI, RBRACE

Let me know if you require any more detailed information from me
Comment 1 Vladimir Riha 2013-12-02 09:42:33 UTC
Reproducible, thank you for reporting. As a workaround, you can close it in quotes

background: $page-bg url('#{$scssDir}/images/bg#{$ord}-squares-blue.png');



Product Version: NetBeans IDE Dev (Build 201312020002)
Comment 2 Vladimir Riha 2014-02-13 08:03:36 UTC
*** Bug 241480 has been marked as a duplicate of this bug. ***
Comment 3 Milutin Kristofic 2015-04-17 10:40:21 UTC
*** Bug 248898 has been marked as a duplicate of this bug. ***
Comment 4 Milutin Kristofic 2015-04-17 10:40:35 UTC
@function oj-image-url($path){
 @return url($imageDir + $path);
}
Comment 5 Milutin Kristofic 2015-04-17 10:40:59 UTC
*** Bug 246822 has been marked as a duplicate of this bug. ***
Comment 6 Milutin Kristofic 2015-04-17 10:41:34 UTC
$imagesDir: "../../style/images/";
.xxx {
    content: url($imagesDir + "functional/func_back_24_ena.png"); 
}
Comment 7 Milutin Kristofic 2015-04-17 10:42:20 UTC
*** Bug 233038 has been marked as a duplicate of this bug. ***
Comment 8 Milutin Kristofic 2015-04-17 10:42:48 UTC
Please try this in sass file:

@function composeURL($a, $b)
{
    @return url($a + $b);
}

=> line with url(..) is underlined, with unexpected token ERROR, SEMI and RPAREN. If I remove white spaces to

@function composeURL($a, $b)
{
    @return url($a+$b);
}

then error is gone but it is not recognized as variables (different color of $a and $b in braces, mark occurrences does not work
Comment 9 Milutin Kristofic 2015-04-17 10:43:21 UTC
https://netbeans.org/bugzilla/show_bug.cgi?id=233038#c5
Comment 10 rweaver 2015-09-14 22:56:26 UTC
Another example from my LESS file:

li {
    background: transparent url(@{img_path}list-bullet.png) no-repeat 0 0;
				padding-left: 14px;
				margin-bottom: 5px;
}

The hint shows up on the background tag.
Comment 11 rweaver 2015-09-14 22:56:45 UTC
Created attachment 156167 [details]
screen shot of hint about unexpected COLON
Comment 12 Milutin Kristofic 2015-09-16 10:41:48 UTC
Yes, thank you for more examples. I know that are many problems with how url doesn't parse in LESS, SASS. I will find a way in next release.
Comment 13 Milutin Kristofic 2015-10-20 13:28:43 UTC
*** Bug 256049 has been marked as a duplicate of this bug. ***
Comment 14 Milutin Kristofic 2015-11-10 14:36:49 UTC
*** Bug 256496 has been marked as a duplicate of this bug. ***
Comment 15 Milutin Kristofic 2015-12-01 13:27:51 UTC
I made quick fix for url, so we accept almost anything in url(). It is not ideal solution, but better than having always error.http://hg.netbeans.org/web-main/rev/b31bee6809d7The only case this doesn't fix is following:url(add($a,$b)This change means that it parses some strings it should not. I will leave this open for better solution.
Comment 16 Quality Engineering 2015-12-03 02:24:53 UTC
Integrated into 'main-silver', will be available in build *201512030002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/b31bee6809d7
User: Milutin Kristofic <mkristofic@netbeans.org>
Log: #238988 - Errors in SCSS pasing: "Unexpected Token" in url()
Comment 17 senendds 2016-02-02 17:15:43 UTC
Another error, not related with url().

The code

  .serif(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) {
    #font > .shorthand(@size, @weight, @lineHeight);
  }


produces an "Unexpected token GREATER found" warning in the last line.
Comment 18 Christian Lenz 2016-02-17 13:31:22 UTC
Same for the src attribute for font faces when there is an "if" inside the url:

@font-face {
    font-family: 'myFont';
    src: url(if($bootstrap-sass-asset-helper, twbs-font-path('#{$icon-font-path}#{$icon-font-name}.eot'), '#{$icon-font-path}#{$icon-font-name}.eot'));
    font-weight: normal;
    font-style: normal;
}
Comment 19 Milutin Kristofic 2016-02-29 12:53:08 UTC
*** Bug 258158 has been marked as a duplicate of this bug. ***
Comment 20 _ gtzabari 2016-05-03 13:52:49 UTC
Resetting Target Milestone since it has passed.