JavaScript & CSS syntax highlighting

Bug #869516 reported by Fred
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Mozilla Firefox
Confirmed
Unknown
SeaMonkey
Confirmed
Unknown
chromium (Ubuntu)
Invalid
Undecided
Unassigned
chromium-browser (Ubuntu)
Confirmed
Wishlist
Unassigned
firefox (Ubuntu)
Confirmed
Undecided
Unassigned
seamonkey (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Add JavaScript & CSS syntax highlighting to source code viewer.

Tags: css javascript
Revision history for this message
In , Ian-ianmacfarlane (ian-ianmacfarlane) wrote :

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-UK; rv:1.8.1b2) Gecko/20060821 Firefox/2.0b2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-UK; rv:1.8.1b2) Gecko/20060821 Firefox/2.0b2

View source does not currently appear to know how to do syntax highlighting CSS. This would be a very useful feature for web developers. Lots of open source editors can do this already, so it probably wouldn't be too hard to find a suitable highlighting method to copy.

I guess this could possibly extend to viewing text/css or .css files as well without using View Source.

(I find it hard to believe that there is not already a bug for this, but I really couldn't find anything like it in Bugzilla)

Reproducible: Always

Revision history for this message
In , Sciguyryan (sciguyryan) wrote :

Marking this as new because I didn't find any simmilar matches after a few searches. If this is a duplicate them please re-mark it.

-- Ryan

Revision history for this message
In , Ehsan-mozilla (ehsan-mozilla) wrote :

It would also be nice if the syntax highlighting is extended to the CSS content embedded in HTML source.

Revision history for this message
In , L. David Baron (dbaron) wrote :

*** Bug 510532 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Irakli Gozalishvili (rfobic) wrote :

Currently veiw-source: on .js .json and .css files is absolutely useless in fact there is no diff between two:

view-source:https://github.com/Gozala/graphquire/raw/v0.3.0/graphquire.js
https://github.com/Gozala/graphquire/raw/v0.3.0/graphquire.js

Small improvements like syntax highlighting and line numbers would make a huge difference!

tags: added: css javascript
Revision history for this message
Gabe Gorelick (gabegorelick) wrote :

The correct package is chromium-browser.

Changed in chromium (Ubuntu):
status: New → Invalid
Changed in seamonkey:
importance: Unknown → Wishlist
status: Unknown → Confirmed
Changed in firefox:
importance: Unknown → Medium
status: Unknown → Confirmed
Revision history for this message
In , Rcampbell-mozilla (rcampbell-mozilla) wrote :

I'm going to move this into the source editor component. This is still an issue.

Revision history for this message
In , Jordan-i (jordan-i) wrote :

Discussion of using codemirror for this was had, which would solve this with nice syntax highlighting.

Revision history for this message
In , Jgriffiths-t (jgriffiths-t) wrote :

If we do this, are we considering doing it for html view source as well? It would be great if the syntax highlighting matched the user's theme settings.

Revision history for this message
In , J. Ryan Stinnett (jryans) wrote :

(In reply to Jeff Griffiths (:canuckistani) from comment #3)
> If we do this, are we considering doing it for html view source as well? It
> would be great if the syntax highlighting matched the user's theme settings.

That would be my assumption: we would likely transition to the same (read-only) editor-like thing (most likely our source editor widget) for all file types, including HTML, and highlighting, etc. would be based on whatever that editor does for different file types.

The current HTML view source tool is not easily extensible for other file types at all. It's a special mode of Gecko's HTML parser, so there's no obvious way to just "enable" JS, etc. support. Something would need to parse the JS, emit tags for highlighting, etc. which editors already know how to do.

One problem we'd have to contend with is that the current HTML view source is able to handle very large documents efficiently because of its design. Some people (at least bz, IIRC) would be sad if the new approach was slow for these cases.

Some day this could also tie into our plans for a resources view in the toolbox, in which case it could be a true editor, not just read-only.

Revision history for this message
In , J. Ryan Stinnett (jryans) wrote :

Switching to an editor in general would not be too hard here, but I've learned there are many edge cases with view source and extra features I wasn't originally aware of. Also, we need to be sure of the perf, as in comment 4.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in chromium-browser (Ubuntu):
status: New → Confirmed
Changed in firefox (Ubuntu):
status: New → Confirmed
Changed in seamonkey (Ubuntu):
status: New → Confirmed
Changed in chromium-browser (Ubuntu):
importance: Undecided → Wishlist
Changed in firefox:
importance: Medium → Unknown
Changed in seamonkey:
importance: Wishlist → Unknown
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.