Want to test it yourself? Go ahead and try the online demo which supports a subset of the features provided by the VS Code Extension.
Understand code changes faster without missing critical details, no matter if you are checking your own code before committing or when reviewing a pull request.
Why spend time on reviewing the output of your code formatter? Let the CI validate the code style, while you concentrate on the logic changes.
When moving a lot of code, it is easy to overlook that print statement you added while debugging. It is buried in a huge hunk of red and green lines. Wouldn’t it be great if your diff tool would highlight such modifications?
Refactorings are often simple but can affect many lines of code. Checking all the individual changes is often too tedious so that other unintended changes get overlooked. SemanticDiff assists you by automatically separating refactorings from other code changes.
SemanticDiff will soon enter private beta.
Enter your email to be the first to get access.
Learn more about SemanticDiff.
git diffand the GNU
diffutilsbeing the most popular ones.
Common diffs treat source code as text files, and generate a visualization based on a simple line-by-line comparison. This is far from perfect: There are many types of code changes, such as inserting line breaks between function arguments, that don’t have any effect on the software but are displayed as changes. This adds a lot of visual noise and makes it difficult for developers to spot the relevant changes.
In contrary, a semantic diff (or also called structural diff) understands the meaning of the change. It can, for example, distinguish between relevant and irrelevant changes, and recognizes when changes correspond to a typical refactoring pattern, like moving code or renaming a function. Instead of showing lot of changed lines, a semantic diff will show an abstract description of the change, e.g., that a function has been renamed.
SemanticDiff works similar to a compiler or interpreter. Given two source codes to compare, they are first converted to Abstract Syntax Trees (ASTs). This step adds additional information that enables us to filter out various style changes, like adding optional semicolons or commas in an array initialization.
In a second step, we match both trees to find out what has changed. Additional rules are applied to filter out more complex invariances. Afterwards the detected changes are translated back into a text diff representation.
The online demo contains only a subset of the programming languages that the Visual Studio Code extension will support. We haven’t finalized the list yet, as we want to take feedback from the beta phase into account. The following languages are currently on our list:
There are very few other tools that can generate structural/semantic diffs. The ones we know of focus on supporting a wide variety of programming languages at the expense of accuracy and not supporting advanced features.
In contrast, our goal is to develop software that delivers correct results that developers can rely on. This is also an important requirement for advanced features, like detecting refactorings. We therefore support only a small number of programming languages at the moment, for which we want to improve support together with our beta testers.