Editor

Back to -Products -Sapphire-IDE -FAQ -Editor

A dialog box warns about ‘Inconsistent Line Endings’ when I load some files.

When loading some Ruby or Rails files, I see a warning that the line endings in the file are not consistent. What is the problem and how can I get rid of the warning dialog?

This is a Visual Studio warning. It occurs when you load a file containing a mix of Windows standard and non-standard line-endings. Windows line-endings take the form of a pair of characters (Carriage Return plus Linefeed) whereas Unix line-endings use just a single (Linefeed) character. You can easily tell the difference by loading a file into Windows Notepad. Those files which use Unix-style line-endings will wrap in Notepad; those using Windows line-endings won’t.

Many files in the standard Ruby libraries as well as files generated by Rails scripts use the Unix line-endings. If a file is subsequently modified using a Windows editor it may end up with a mix of Windows and Unix-style line-endings. Visual Studio detects these inconsistencies on loading and asks if you would like to regularize them. If you choose to do so, you can select options such as Windows, (CR+LF), Unix (LF) or Macintosh (CR).

If you prefer to ignore inconsistent line-endings, you can disable the warning dialog by unchecking ‘Always show this dialog’. You can also set this option in the global Options dialog (Tools->Options->Environment->Documents). Enable or disable the option: Check for consistent line endings on load.

© SapphireSteel Software 2014