Visual studio code end of line setting (file with inconsistent line endings) - visual-studio-code

Is it possible to keep original end of lines in the file?
(I use visual studio code to edit files on a linux server through SAMBA)
There is a button at right bottom to choose either LF or CRLF,
but it replace all the end of lines in the file.
example:
line1 \r\n
line2 \r\n
line3 \n

No, it is not possible in VSCode to preserve the original line endings when they are not the same throughout a file. Internally, for each file, VSCode only stores a single _eol value, and when multi-line text is requested, inserts it between every line on the fly.
See, for example, method getText() in mirrorTextModel.ts. MirrorTextModel is a base class of ExtHostDocumentData, which implements the TextDocument entity exposed in the API.

Related

In VS Code, how to prevent the editor from changing line ending

VS Code tend to change line ending when I make changes to file, usually from CRLF to LF. how to deactivate this feature? I want VS Code to just leave the line ending as-as

Line numbering in WPS presentation

I am copying code with syntax highlighting from WPS Writter to WPS Presentation. However, when I apply line numbering in the latter, I only get the first line numbered.
Line numbering works correctly in Writter. But if I copy and paste it into presenter, I cannot update the line numbers. If I paste the code has plain text in Presenter the line numbering works correctly [but I obviously loose the highlighting] .
Is there anyway to correct this?

How can VS Code preserve multiple blank lines in Elixir files after auto-formatting?

VS Code's Elixir formatter removes double (or more) empty lines when formatting the file on save.
Is there an option to leave multiple empty lines untouched, instead of keeping only one empty line between definitions of functions or other blocks?
I solved this by changing the "Editor end of line" from CRLF to LF

Line breaks using dlmcell in Matlab - shows up in Notepad++ but not Notepad

I am using the function dlmcell in Matlab to output text. I want text on a new line each time I append using dlmcell.
When I open my written document in Notepad++, each snippet of text is on a new line as I want it. However, opening it in Notepad that comes with windows, everything is on the same line. Can somebody tell me why this is, and how to fix it?
I'm assuming you're using the string \n to declare a new line in your output. For Notepad++ this is sufficient, because it interprets a new line just with \n. For the Windows Editor you need to include the carriage return also:
substitute:
\n with \r\n
This way not just a new line is created, it also tells the editor to actually continue on the next line.
To illustrate what I mean, open your output file with Notepad++ and activate View > Show Symbol > All characters and you will see something like:
I wrote this with Notepad++ and it automatically adds CR (carriage return) and LF (line feed) at the end of every line. Matlab doesn't if you don't tell it. So your output file only contains LF without the above mentioned substitution.
I've had a look into dlmcell, which is a FEX-function. In the current version \r\n is implemented actually. Do you have the newest version of that function (Download)? If not, something else must be wrong, please post some code.

How can i hinder Eclipse from inserting CRLFs?

I just reinstalled Eclipse Juno.
The problem i have is when i create a new file and start writing, CRLFs are inserted on Return.
Second case: When i fully mark the text of a file (without CRLFs) ans COPY them into another file (i use CRTL+A and DEL to get rid of the file contents and then PASTE i get the file content with CRLFs!)
The resulting file looks like:
Test blah CRLF
Line two ... CRLF
CRLF
How can i get rid of them?
Solution to this is to configure Eclipse accordingly.
Windows->Preferences->General->Workspace
In the right lower corner there is a setting called "New text fiel line delimiter" which i had to switch from Windows to Unix.
The already CRLF prensent i had to remove using Eclispe->File->Convert line delimiters to ->Unix .