Closed Bug 960987 Opened 10 years ago Closed 8 years ago

Show me the diff of what I've changed in the style editor and inspector.

Categories

(DevTools :: Style Editor, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 794237

People

(Reporter: bwinton, Assigned: gl)

References

Details

Attachments

(4 files, 1 obsolete file)

I like to poke around in the Inspector, and I just watched shorlander poke around in the Style Editor for an hour, and it would be nice for both of us to have an easy way to see (and save) what we've changed so that we can back-port it to the source files.
By inspector, you mean the style-inspector (i.e. the rule-view), right? Cause you can make changes to the HTML markup tree too, but back-porting changes from there might be more complex since in many cases, the markup is generated and/or modified client-side via javascript.
When it comes to the rule-view, I think we could definitely find ways to save a diff or something.
When it comes to the style-editor, you can save on disk the file you changed directly from that tool, were you thinking of something different?
I did mean the rule-view, yes.

Darrin also pointed out that I could save the file directly.  (He's sitting beside me right now!  ;)  But…

If the original file was in SASS or LESS, or if it was one of the pre-processed files from the Firefox source tree, then saving the original file isn't as helpful as seeing what I changed.
I should be done with my source outline patch today. I would like to work on this next.
Source outline requires a bit more work, but I will still be interested in working on this later.
(In reply to Gabriel L (:gluong) from comment #4)
> Source outline requires a bit more work, but I will still be interested in
> working on this later.

Thank you Gabriel! Your work is much appreciated :)
Assignee: nobody → gabriel.luong
Status: NEW → ASSIGNED
The current plan is to implement diff annotations in the Style Editor followed by the ability to save a diff patch. The diff annotations would look similar to GitGutter (https://raw.githubusercontent.com/jisaacks/GitGutter/master/screenshot.png) which would put an icon next to the line numbers illustrating whether or not the line has been changed, added or deleted. 

I am leaning towards using google-diff-match-patch (https://code.google.com/p/google-diff-match-patch/) as the diff library due to the fact that it was used in the merge addon for codemirror (http://codemirror.net/demo/merge.html). I have not looked into any of the diff libraries too deeply, but some concerns would be licenses, performance and integration with codemirror. The libraries I have found so far:
https://github.com/kpdecker/jsdiff
https://github.com/cemerick/jsdifflib
One other consideration is how would the diff patch be generated in presentable manner.
Attached patch 960987.patch [WIP] (obsolete) — Splinter Review
This patch ports most of CodeMirror's merge addon, and google-diff-match-patch library. In the screenshot (https://cloudup.com/clRryAXj-ic), you can see that the single empty line illustrates a chunk of code that was deleted. In addition, lines that are modified are highlighted, and values that are modified/added also has a green underline.

The next step we are planning is to remove the line markers and show markers in the line number gutter. This is illustrated in the screenshot of GitGutter for Sublime Text (https://github.com/jisaacks/GitGutter).

Any feedback or suggestions before I make additional changes are very welcome.
Attachment #8433725 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: