danvk / codediff.js Goto Github PK
View Code? Open in Web Editor NEWTwo-column JavaScript diff visualization with syntax highlighting
License: BSD 2-Clause "Simplified" License
Two-column JavaScript diff visualization with syntax highlighting
License: BSD 2-Clause "Simplified" License
Need some way to stick arbitrary markup under a line to show inline comments.
This will make balancing left/right sides more difficult. (Would require either table layout or JS-based layout).
It's silly to show "2 lines omitted". There should be a minimum, say 20 by default, below which we'll just show the code.
github shows the function that the diff you're looking at is part of, even if its declaration is many lines outside of the diffhunk:
I'm not sure how this is implemented, or if it requires language support. git diff
does this, too:
$ git diff d5ce61bccb2
diff --git a/extras/synchronizer.js b/extras/synchronizer.js
index cbe26d2..f39209b 100644
--- a/extras/synchronizer.js
+++ b/extras/synchronizer.js
@@ -200,7 +200,7 @@ function dygraphsBinarySearch(g, xVal) {
var low = 0,
high = g.numRows() - 1;
- while (low <= high) {
+ while (low < high) {
var idx = (high + low) >> 1;
var x = g.getValue(idx, 0);
if (x < xVal) {
Critique, github and others do this. codediff.js should as well.
Current behavior is to scroll both panels horizontally.
This will require some reworking of the markup to keep the left/right side balanced.
codediff.js often makes poor choices about how to present character diffs. For example, in this three line diff:
Before:
<ImageDiffModeSelector filePair={filePair}
mode={this.state.imageDiffMode}
changeHandler={this.changeImageDiffModeHandler}/>
After:
<DiffView filePair={filePair}
imageDiffMode={this.state.imageDiffMode}
changeImageDiffModeHandler={this.changeImageDiffModeHandler} />
it shows these character diffs:
All three of these have problems, and all three would be improved by making the intra-line diffs operate at the word level, rather than the character level. In other words, rather than applying the diffing algorithm to line.split('')
(which splits the line into individual characters), it should be applied to a list containing the words in the line. These are broken by whitespace, symbols and capital/lowercase transitions.
The mocha test runner uses this to get character-by-character wrapping w/o adding soft breaks everywhere.
coveralls.io is pretty nice!
Would be helpful for jumping to a comment (e.g. #7)
In hammerlab/cycledash, diffing ef8764395079dfc2ab5b9c70db9ad9b735d5e0cd..6bbc1747de05b4cadfb4e900928047d8c8bad15c produces a really bad diff in cycledash/views.py
. One small function (start_workers_for_run
) moves, while the rest of the file is modified in small ways. codediff.js aligns on start_workers_for_run
, whereas GitHub shows it moving while the rest of the file stays relatively motionless.
The screenshot in README.md is getting increasingly out of step with the current UI.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.