↓
), CRLF (↵
), or CR (←
).editor.largeFileOptimizations: false
regardless of thedocument's size.editor.renderWhitespace: selection
)and trailing whitespace (editor.renderWhitespace: trailing
).code-eol.highlightNonDefault: true
).code-eol.highlightExtraWhitespace: true
).editor.renderWhitespace
setting (accessible through View
Render Whitespace
menu). The followingsettings are supported:none
: Extension will not add end-of-line decorations.boundary
: Extension will not add end-of-line decorations.selection
: Extension will render end-of-line decorations only if they are within selection.all
: Extension will render all end-of-line decorations.code-eol
extension):code-eol.newlineCharacter
: Character used to display LF (line-feed) line ending (aka Linux/Mac line ending).code-eol.returnCharacter
: Character used to display CR (carriage-return) line ending (aka old Macintosh line ending).code-eol.crlfCharacter
: Character used to display CRLF (carriage-return, line-feed) line ending (aka Windows line ending).code-eol.highlightNonDefault
: If true, non-default line ending will be colored as error.code-eol.highlightExtraWhitespace
: If true, trailing whitespace will be colored as error. Note this is only shown if renderWhitespace
is turned on.code-eol.decorateBeforeEol
: If true, decoration will come before the end of the line thus playing better with extensions that use decorations after the end of the line. Do note that the line ending will not be rendered on empty lines if this is used.editorWhitespace.foreground
theme color (also used byVisual Studio Code to color whitespace symbols). Color for non-default lineending is taken from errorForeground
theme color.files.eol
setting.editor.largeFileOptimizations
to false
.code-eol.decorateBeforeEol
to true
..gitattributes
. For most people,this is as simple as creating a file named .gitattributes
at the rootof your repository that contains one line:rn
) to Unix style line endings (n
) when they’readded to the repository.core.autocrlf
?core.autocrlf
. This is a similarapproach to the attributes mechanism: the idea is that a Windows userwill set a Git configuration option core.autocrlf=true
and theirline endings will be converted to Unix style line endings when they addfiles to the repository..gitattributes
is set in the repository, so its shared with everybody.But core.autocrlf
is set in the local Git configuration. That meansthat everybody has to remember to set it, and set it identically.core.autocrlf
is that if some people have it set totrue
and some don’t, you’ll get a mix of line endings in your repository.And that’s not good - because his setting doesn’t just tell Git what youwant it to do with files going in to your repository. It also tells Gitwhat you’ve already done, and what the line endings look like on the filesthat are already checked in.git status
tells you thatyou’ve changed a file, but running git diff
doesn’t show you any changes.How can that be? Line endings.core.autocrlf=true
when they added the file. You, on the other hand, being a diligent Gitfor Windows user, did set that option.git status
, git will look at that file to decide whetheryou've made any changes to it. When it compares what's on disk to what'sin your repository, it will convert the line endings on-disk fromWindows-style style to Unix-style in the repository. Since the existingfile in the repository had Windows-style line endings, and you expect themto be Unix style, git will determine that the file is different. (It is,byte for byte, different.).gitattributes
, you ensure that these settings exist at therepository level, instead of leaving it up to individual users tounderstand to configure correctly. This means there’s no opportunityfor misconfiguration by an individual user.text
attribute from files that you don't want to haveline ending conversions. For example, if you have PNGs in your repository,your .gitattributes
might look like this:.gitattributes
that can be applied. These are especially useful in particulardevelopment scenarios. We'll dive deeper into some of those - likeusing Unity - in the next blog post.