editorconfig-vscode icon indicating copy to clipboard operation
editorconfig-vscode copied to clipboard

Wrong label for short files

Open mcandre opened this issue 4 years ago • 0 comments

Please fill-in this template.

  • [x] I have a question that is specific to this extension; thus, inappropriate for the main EditorConfig issue tracker.
  • [ ] I tried running code --disable-extensions and the issue did NOT present itself.

Delete the following condition if it doesn't apply to your case:

Issue

Visual Studio Code editorconfig-vscode
Version 1.59.1 0.16.4

Root .editorconfig File

# Most text files
[*]
end_of_line = lf
insert_final_newline = true

#
# Windows junk
#
[{*.cmd,*.bat,*.reg,*.ps1,*.vbs,*.cs,*.fs,*.fsx,*.ini,*.ahk,*.psenvrc}]
end_of_line = crlf
insert_final_newline = false

Are there any other relevant .editorconfig files in your project? No

File opened

.psenvrc

Expected behavior

The line ending label in the bottom right corner of VSCode should say "CRLF" for short (blank or single line) Windows text files.

Actual behavior

The line ending label says "LF".

Additional comments or steps to reproduce

  1. Configure .editorconfig to use CRLF line endings for .psenvrc files, with final newline disabled.
  2. Open a short (blank or single line) .psenvrc file in VSCode.
  3. View the line ending status in the bottom right corner.

Strangely, the label temporarily corrects itself when saving the file with Ctrl+S. However, as soon as you close the file tab and reopen the file, then the label resets back to saying "LF".

This appears to be a glitch in how the line ending status treats short (blank or single line) files, that may not yet contain any CR/LF bytes. Not sure if this is a glitch in the EditorConfig plugin or a glitch in VSCode. But it is annoying when editing many small files.

mcandre avatar Sep 01 '21 15:09 mcandre