Comparing files in eclipse show same whitespaces as different - eclipse

Why does the compare files in Eclipse show difference between an identical line that starts and/or stops with white spaces?
Why would anyone ever want this "feature" anyway, all lines become marked as different. Must be a bug.
I know I can use the ignore white spaces setting, but then it ignores the differens in block indentation as well and I don't want that.

Forgot to answer this one.
It was an extra carriage return on one side (PC newline, and the other had Mac/*nix), that would make it ignore the "ignore whitespace" setting for those lines.

Related

Display larger indentation for files that are indented with just two spaces

I'm working on a project that is using 2 spaces as indentation.
I have a hard time reading code with such small indentation, so my question is:
Question: Can I make vscode show the two spaces as if they were wider (for example double the width)?
(I could of course solve it in a hackish way, by converting each file on checkout, and convert it back before i commit it, but that would be very tedious and error prone. I could also try to convince the project to convert the whole project to tabs, so that everyone can use their own preferred indentation. But I don't want to go into that discussion for every project I work on :) )
I have written the extension Indent Whitespace that decorates each space used in indentation with additional spaces (cursor will skip the decoration).
The decorated spaces are colored with a very transparent red.
With a setting you can change the number of spaces to add, default 1.
If you delete spaces with Delete it looks funny because the selection does not change, use the Arrow keys to update the decorations.
In a later version I will make the decoration color a setting, and also only update the decoration when the file changes (only important for large files, and fix the delete-update rendering).
I think you can't.
There is no such setting in VS Code. As of version 1.13, you can change the kerning, but this changes the spacing between all characters. You cannot do this only for a single character (or a set of characters).
The space width is a property of the font. Microsoft has a guideline that defines what is the ideal space size for a font. But this does not mean you cannot change it yourself when designing one. So I created a version of Roboto Mono which space character is 4x the original one.
This works on Notepad and MS Word, we can see the space is quite big. However, using the exact same font in VS Code, the space is still small, independently of the font being monospaced or not.
Illustration
Somehow, it looks like VS Code ignores space size in the font and decides by itself what is the best value.

How do I prevent Visual Studio Code from automatically deleting whitespace in blank lines

When I move the cursor from a line without typing anything on it, VS Code seems to automatically delete the whitespace from that line so that, when I put the cursor back on that line, it ends up flush to the left, forcing me to tab to the desired indentation level again. What setting do I change to make it not do that? I tried Googling this problem but all the answers were about removing blank lines with regular expressions, which is not my issue at all.
/* Automatically remove indentation in empty lines on save */
"emptyIndent.removeIndent": true,

How to remove trailing whitespace *from selection* in Eclipse

The question is as simple as stated in the title - how to remove the whitespace in Eclipse, but only from the selected lines.
There are a lot of answers on SO how to remove trailing whitespace in Eclipse. Most of them focus on automatically removing it on save and all of them concern removing all of the trailing whitespace in the file.
I want none of these, as I am working on large JS files that are awfully formatted and very frequently committed; removing all the trailing whitespaces in the file would easily cause merge conflicts and a lot of noise from the people.
So I want to select specific parts of the files and fix them, in the way that this is possible with Source -> Format (Alt+Shift+F).
Shift-Ctrl-Right arrow will highlight whitespace to the right until next non-whitespace character (which may be newline). Press delete. If you lose the newline, simply press enter.

emacs preview duplicate lines before removing

Context: I'm working with a large text file that is almost excel-like and I'm adding/editing entries. It is a shared file so others can have already edited the file.
I'm working with emacs and I found that they added the command delete-duplicate-lines. This command seems great for pruning extra entries, but it would be nice to know which lines were duplicates (i.e. already existed in the file) so that I would know which entries had already been added. Is there a command that is similar to delete-duplicate-lines, but only points out which lines are duplicates without removing them?
You can use command hlt-highlight-line-dups-region from the Highlight library, to highlight all sets of duplicate lines in the region or (if no active region) in the buffer.
By default, leading and trailing whitespace are ignored
when checking for duplicates, but this is controlled by option
hlt-line-dups-ignore-regexp. And with a prefix arg the behavior
effectively acts opposite to the value of that option. So if the
option says not to ignore whitespace and you use a prefix arg then
whitespace is ignored, and vice versa.
You can also control the colors/faces used to highlight each set of duplicates.

Is there a way to get Eclipse to treat 4 spaces exactly as it treats a tab?

I understand how to get Eclipse to insert spaces in place of tabs, but then I'd rather not have to arrow through 12 spaces to reach an indented block.
Bonus points if there's a way to hide the spaces from the 'show whitespace characters'. I like to see whitespace characters for tabs and carriage returns, but the display gets too cluttered when spaces are also displayed.
Try CTRL+[right,left] arrow key. Certainly one of my most-used combos.
As it turns out, this appears to not be possible in Eclipse.
With the next Eclipse 20199.12/4.14, that might actually be possible! (albeit ten years later)
See "Backspace/delete can treat spaces as tabs"
If you use the Insert spaces for tabs option, now you can also change the backspace and delete keys behavior to remove multiple spaces at once, as if they were a tab.
The new setting is called Remove multiple spaces on backspace/delete and is found on the General > Editors > Text Editors preference page.