The default bug view has changed. See this FAQ.

Source Editor syntax highlighting for CSS is a bit confusing

RESOLVED FIXED in Firefox 11

Status

()

Firefox
Developer Tools
P2
normal
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: cedricv, Unassigned)

Tracking

unspecified
Firefox 11
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [sourceeditor][orion])

(Reporter)

Description

6 years ago
SourceEditor in CSS mode does not highlight according to CSS syntax.


/* comment */ is not highlighted at all
but //comment is (whereas this is not valid CSS)

Some/most property names are not highlighted, eg.:
border-collapse, -moz-border-radius, ...

It probably makes sense _not_ to highlight properties through some property list but through a pattern (eg. "[a-z-]+\:").
The highlighting should be about syntax, not about potential support of property (which anyways is difficult to do since there is frequently new properties and also -webkit- or even -ms- prefixed properties should be highlighted as usual).
The CSS highlighting code from upstream, Orion, is unfortunately still "experimental". Indeed, it needs more work.

When this bug is prioritized, I'll look into updating the upstream code and fixing it as necessary. Thanks for your report!

Comment 2

6 years ago
Please don't highlight obsolete -moz-prefixed properties like -moz-border-radius.
(Reporter)

Comment 3

6 years ago
(In reply to j.j. from comment #2)
> Please don't highlight obsolete -moz-prefixed properties like
> -moz-border-radius.

Why? It's still valid CSS syntax (and supported for older browsers).
And there is still more valid properties added every other month... having a static list of words does not scale.


The fact it is obsolete (and/or unknown) could be visible in another way, for instance red underline like http://onjava.com/onjava/2004/07/28/graphics/eclipse1.gif or in a symbol in the gutter :)

In fact, we'll have a tool (called the CSS Doctor) who should be able to provide diagnostics such as this, and much more.

Comment 4

6 years ago
(In reply to Cedric Vivier [cedricv] from comment #3)
> Why? It's still valid CSS syntax (and supported for older browsers).

If there is a property list, we should remove those properties ASAP. 
IMHO there is consensus that we should not spam the web with -moz-prefixes an should not encourage people to use it.

If the highlighting is syntax driven, ok then. A special highlighting for common vendor prefixes -ms, -webkit, -o, -moz, might be useful.

(just my 0,02 Euro, ask David Baron for a more sound view)

Comment 5

6 years ago
BTW, maintaining a CSS property list is not trivial.
Maintaining a property list including all important vendor specific properties seems nearly impossible.
(Reporter)

Comment 6

6 years ago
Good idea :)
With syntax/pattern driven highlighting, \-[a-z-]+\: (notice the prefix "-") could be highlighted a bit differently [and we do not have to keep track of all CSS prefixes that exists out there]

Comment 7

6 years ago
You will miss the very common mso-prefix (notice the missing "-"), which spams the world since MS Office is able to create HTML files.
That's probably fine, because it does nothing in web browsers (I hope and assume).

Updated

6 years ago
Whiteboard: [sourceeditor][orion]
The situation is mostly unchanged upstream with the latest Orion. They now recognize /* comments */ in CSS mode, but the rest of the problems mentioned in comment 0 are still valid.

Comment 9

6 years ago
We're doing developer tool prioritization, filter on 'brontozaur'
to ignore the spam.
Priority: -- → P2
Bug reported upstream:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=362337

Updated

5 years ago
Depends on: 702331
This is fixed now by bug 702331.

Please note that support for highlighting more properties and an improved CSS parser will come at a later date. Upstream is preparing a rewrite of the CSS syntax highlighting code.
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED

Updated

5 years ago
Target Milestone: --- → Firefox 11
You need to log in before you can comment on or make changes to this bug.