General Questions
git diff
and the GNU diffutils
being 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 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.
SemanticDiff currently supports most programming languages relevant for web development. We plan to add more languages based on the user feedback we receive. Supported programming languages and data exchange formats are:
- C#
- CSS / SCSS
- Go
- HTML
- Java
- JavaScript / JSX
- JSON
- PO (gettext)
- Python
- Rust
- Swift (GitHub App only)
- TypeScript / TSX
- Vue
VS Code Extension
No. All computations are performed locally on your machine. Our extension also works if you are offline.
If you have telemetry enabled, we will send the file extensions of the files you diffed to our server, but no information about their contents. See our privacy policy for more information about telemetry and how to disable it.
You can review pull requests with our Visual Studio Code extension, but some review features may not be available.
To review a PR, open the corresponding code diff, either by using the VS Code extension provided by your Git hoster or by checking out the code locally and manually opening the diff in VS Code. Then switch to SemanticDiff by clicking on our logo in the top right corner. Some review features, such as adding comments, are not available because VS Code doesn’t provide the necessary API for a seamless integration and our feature request has been closed.
If you use GitHub, we recommend that you check out our GitHub App, which provides SemanticDiff with the relevant review features.
Your question was not answered?
Do not hesitate to contact us if you have any questions or feedback.
We look forward to hearing from you.