Deep Text and Code Comparison
- Lexical Comparison
- Lexical Comparison vs Text Comparison
- Additional Options
- Editing Compared Texts
Code Compare provides a convenient and easy way to compare differences in text files side by side. Even in its default mode, it will accomodate for most of your basic text comparison needs. However, when you're working with code, some additional features are often needed to properly check for differences in lines of code due to the nature of the process. For the most efficient way to compare code files, you can utilize Code Compare's Lexical Comparison mode. It is specifically geared towards working with code files and recognizes most popular languages. Let's look at Lexical Comparison and its functionality in more detail.
Below, we'll see examples of how Lexical Comparison is different from the default Text Comparison mode and how it can prove useful when you're working with code.
Lexical Comparison vs. Text Comparison
The Text Comparison mode in Code Compare can be inconvenient for source code comparison as it doesn't recognize language elements and looks for similar symbols in totally different lexemes.
With Lexical Comparison enabled, different lexeme types are never compared with each other.
With Lexical comparison enabled, Code Compare wiil always recognize and compare numbers wholly. You can see an example of this on the follwoing screenshot:
If you choose Text Comparison mode, the numbers will be compared digit-by-digit, which is very inconvenient in the context of source code comparison.
If you need Code Compare to ignore comments, you can turn this feature on in the Comparison options menu.
When this is enabled, the comparison tool will disregard any source code comments and highlight comment blocks as unchanged.
Editing Compared Texts
When you compare two files or diff text in Code Compare, you can also utilize the provided text editor functionality with syntax highlighting and various other features.
- Selecting Text and Code: You can select both continuous segments of code with SHIFT+arrows/mouse or rectangular sections with ALT+mouse
- Manipulating Text and Code: Code Compare has the basic text manipulation capabilities such as an overstrike mode accessible with the INSERT key
- Navigating Text and Code: In addition to the usual mouse-and-keys navigation method, you can create bookmarks, use incremental search and utilize Go To Line commands
- Indenting text and code: You can adjust code indenting by using the Decrease Line Indent or Increase Line Indent options
- Searching and replacing text: Code Compare allows to search and replace text both in the current file and in multiple files at once
For more details on the major feature set of our file diff and merge tool, feel free to refer to the main Code Compare page.