haidubogdan commented on code in PR #8401: URL: https://github.com/apache/netbeans/pull/8401#discussion_r2127472563
########## ide/css.lib/src/org/netbeans/modules/css/lib/nbparser/CssParser.java: ########## @@ -81,24 +81,40 @@ public void parse(Snapshot snapshot, Task task, SourceModificationEvent event) t if (snapshot == null) { return; } - + this.snapshot = snapshot; FileObject fo = snapshot.getSource().getFileObject(); - String fileName = fo == null ? "no file" : fo.getPath(); //NOI18N - String mimeType = topLevelSnapshotMimetype != null ? topLevelSnapshotMimetype : (fo == null ? null : fo.getMIMEType()); + String fileName; + String mimeType; + if (fo != null) { + fileName= fo.getPath(); + MimePath mimePath = snapshot.getMimePath(); + + //scss, less mime embedding is a top layer for text/css + //positioned at the penultimate position + if (mimePath != null && mimePath.size() > 2) { + mimeType = mimePath.getMimeType(mimePath.size() - 2); + } else { + mimeType = fo.getMIMEType(); + } + } else { + fileName = "no file"; + mimeType = topLevelSnapshotMimetype; + } Review Comment: It's a tricky situation with the proposed code as it will fail on tests. if (topLevelSnapshotMimetype == null) { fileName= fo.getPath();  and adding `if (topLevelSnapshotMimetype == null && fo != null) { ` is more or less a different version of the refactor. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For additional commands, e-mail: notifications-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists