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 247881 - @import at top of .scss produces "unexpected token IMPORT_SYM found"
Summary: @import at top of .scss produces "unexpected token IMPORT_SYM found"
Status: RESOLVED DUPLICATE of bug 161015
Alias: None
Product: web
Classification: Unclassified
Component: CSS Editor (show other bugs)
Version: 8.0.1
Hardware: PC Windows 8 x64
: P3 normal (vote)
Assignee: Milutin Kristofic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-13 03:15 UTC by beany
Modified: 2014-10-13 11:43 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Wrong hint shown (4.90 KB, image/png)
2014-10-13 03:15 UTC, beany
Details
Wrong hint is NOT shown if there's some CSS class above the @import (4.43 KB, image/png)
2014-10-13 03:15 UTC, beany
Details
IDE log + sample file (12.30 KB, application/zip)
2014-10-13 08:47 UTC, beany
Details

Note You need to log in before you can comment on or make changes to this bug.
Description beany 2014-10-13 03:15:02 UTC
Created attachment 149855 [details]
Wrong hint shown

NetBeans produces an undeserved parsing error when it finds @import at the top of a .scss file and produces an irrelevant. Adding a dummy empty CSS class above it makes this disappear.

See screen shots of editing a simple .scss file in NetBeans8.0.1
Comment 1 beany 2014-10-13 03:15:46 UTC
Created attachment 149856 [details]
Wrong hint is NOT shown if there's some CSS class above the @import
Comment 2 Vladimir Riha 2014-10-13 04:52:26 UTC
I'm sorry but it works for me. Could you please attach the file and IDE log (see http://wiki.netbeans.org/FaqLogMessagesFile ) ? Perhaps there is some non-printable character or something. Thank you


Product Version: NetBeans IDE 8.0.1 (Build 201408251540)
Updates: NetBeans IDE is updated to version NetBeans 8.0.1 Patch 1.1
Java: 1.8.0_25; Java HotSpot(TM) Client VM 25.25-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_25-b17
System: Linux version 3.13.0-35-generic running on i386; UTF-8; en_US (nb)
Comment 3 beany 2014-10-13 08:47:16 UTC
Created attachment 149861 [details]
IDE log + sample file

Log and file attached in a password protected file. Password jdk9393
Comment 4 Vladimir Riha 2014-10-13 09:09:31 UTC
Thank you, the problem seems to be encoding of the file, UTF-8 with BOM which is afaik not supported in NetBeans (see issue 161015). 

I'm on linux and IDE displays a "empty space" right before beginning of the comment on line 1. What seems to work for me is to e.g. delete first few characters at the beginning of line 1 and type them again. Or save the file with different encoding which could though cause weird/incorrect characters - in my case there was ? mark before the beginning of the comment.

*** This bug has been marked as a duplicate of bug 161015 ***
Comment 5 beany 2014-10-13 09:36:14 UTC
Thanks for explaining. Problem is that when compiling SASS that is not UTF8+BOM, instead of adding
@charset "UTF-8";

at the top of the resulting .CSS, it adds

@charset "IBM437";

and even trying to have the directive inside the .scss doesn't help.

As this is a bug in NetBeans, the meanwhile workaround for me was to add
.dummy{} /* Dummy needed due to NetBeans bug - to be removed */
at the top of the class which for some reason makes all error disappear.

I personally didn't see any ?

Files were converted to UTF8+BOM using Notepad++

Thanks
Comment 6 Vladimir Riha 2014-10-13 10:36:06 UTC
(In reply to beany from comment #5)
> Thanks for explaining. Problem is that when compiling SASS that is not
> UTF8+BOM, instead of adding
> @charset "UTF-8";
> 
> at the top of the resulting .CSS, it adds
> 
> @charset "IBM437";
> 
> and even trying to have the directive inside the .scss doesn't help.
> 

I'm sorry, how the files is compiled is up to the Sass compiler (https://github.com/sass/sass). I don't know how it handles UTF-8 BOM. Maybe it has some command line parameter, if so you can then add it in NetBeans in project properties.

> As this is a bug in NetBeans, the meanwhile workaround for me was to add
> .dummy{} /* Dummy needed due to NetBeans bug - to be removed */
> at the top of the class which for some reason makes all error disappear.
> 
> I personally didn't see any ?
> 
> Files were converted to UTF8+BOM using Notepad++
> 

I'm not expert on encoding, but I guess ? could happen only when encoding to some encoding. Another "workaround" would be not to use UTF-8 BOM unless it is necessary
Comment 7 beany 2014-10-13 11:43:39 UTC
I left the additional info as a temp workaround for those who might face the same situation. When NetBeans get the UTF8+BOM bug fixed, it'll resolve the matter.
SASS compliation was done using Koala on Windows8. It handles any encoding well but adds the @charset based on the file's encoding.
Thank you for marking the relevant duplicate and I hope it'll be resolved soon.