You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Notepad++ has a setting to tell if tabs should be replaced by spaces (and if so, by how many). This is great for new files, but bad for existing files that already use the opposite of the setting.
It would be great if Notepad++ could detect:
if a file uses tabs or spaces for indentation — and
for indentation with spaces, the tabulation width.
It need not be perfect, it just has to guess right in most cases. It’s similar to detection of line endings.
As an example, Visual Studio 2022 has such a detection.
For a suggestion on how to implement this:
Use the application’s setting unless the file contains lines which have a tab or 2 spaces as their first characters and all those lines start with the same sequence (1 tab or 2 spaces, not mixed). That determines tabs vs spaces. (Maybe exclude lines that consist of only of white space.)
If the tabulation is detected as spaces, guess the tab width as the number of initial spaces of the first line that starts with 2 or more spaces, then round that number down to 2, 4, or 8.
I’d guess it’s important to rule out a tabulation width of 1 space for false positives like (documentation) comments of the form:
/* next line starts with 1 space, but it’s not indented by any notion! */
The text was updated successfully, but these errors were encountered:
Description of the Issue
Notepad++ has a setting to tell if tabs should be replaced by spaces (and if so, by how many). This is great for new files, but bad for existing files that already use the opposite of the setting.
It would be great if Notepad++ could detect:
It need not be perfect, it just has to guess right in most cases. It’s similar to detection of line endings.
As an example, Visual Studio 2022 has such a detection.
For a suggestion on how to implement this:
I’d guess it’s important to rule out a tabulation width of 1 space for false positives like (documentation) comments of the form:
The text was updated successfully, but these errors were encountered: