-
Notifications
You must be signed in to change notification settings - Fork 30.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply files.eol setting when saving untitled with a specific mode that has this setting configured #26626
Comments
@alexandrudima @bpasero any idea why saving using |
@gojimmypi maybe there's an issue with using that setting on the language settings? What if you manually hit the CRLF button and set it to LF in the status bar? |
@Tyriar clicking on the " Indeed manually setting the CRLF to LF in the status bar does work; the script runs in linux with no complaint about the extra CR. Perhaps an acceptable temporary workaround; but it would be great if that setting was always honored in It is cool that toggling the LF/CRLF converts all existing chars, not just the newly entered ones. :) |
It depends on the user steps taken:
|
For bulleted item 1 above: I do not believe the
Here's my existing settings.json
At launch time, VSCode starts with UTF-8, CRLF. If I "Save As" and select "Shell Script"... then type in a name... the CRLF setting remains. Indeed if I open a file saved where the setting was LF, VSCode properly opens the file in LF mode, and not CRLF. |
Today, the setting In this case, the buffer gets created with the "global" eol, i.e. the one which is not language specific, which on Windows out of the box is When the untitled file gets saved with a file ending that indicates shellscript, we no longer look at the This is opposed to a new file being created in the explorer, e.g. newfile.sh, when it is opened it will immediately be known to be shellscript and the eol will be picked up as It would be nice for the first case (untitled file being saved) to do something about the setting, perhaps prompt and explain the discrepancy or offer to convert the eol, etc. Adding @bpasero |
This should actually work because when saving the untitled file we create a new model with the proper resource of the target. However #39051 is the actual problem, you cannot set |
I was wrong, there would still be some conversion needed to apply the EOL when saving. |
@aeschli my understanding is that you are working on this too |
Fixed by #82101.
Note: We only change the EOL if the file has no newlines yet |
This is a feature request to save Linux files with linefeed only and not carriage return.
Visual Studio Code on Windows 10
Version 1.12.1
Commit f6868fc
Date 2017-05-04T21:26:50.689Z
Shell 1.6.6
Renderer 56.0.2924.87
Node 7.4.0
Steps to Reproduce:
#!/bin/bash
echo "Hello World!"
-bash: ./myhello.sh: /bin/bash^M: bad interpreter: No such file or directory
the problem could be resolved as described here:
https://askubuntu.com/questions/304999/not-able-to-execute-a-sh-file-bin-bashm-bad-interpreter
however VSCode is aware that it is a bash shell script, yet even this setting does not resolve the problem:
It would be great to have VSCode be able to save Linux files with the appropriate linefeed (only), as desired.
edit: spelling
The text was updated successfully, but these errors were encountered: