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
Allow to set files.encoding
as language specific setting for files on startup
#127936
Comments
@vscode-triage-bot I sincerely suggest you to look into this bothering issue that a large number of users strongly require to be solved. Many thanks. |
Sorry, I don't know how to get priority on this issue. It seems that the bot has closed this issue. But it's really annoying and such an important use case. |
files.encoding
and files.eol
as language specific setting for files on startup
Renamed to reflect the issue: my understanding is that this only applies to settings which we need right in the beginning when opening a file, specifically: the encoding and the line endings. All other settings should apply after the extensions have been resolved. I briefly looked into this and still don't have a good solution, other than maybe caching all the languages mapped to file types to have them ready right in the beginning. We resolve the language of the file here in order to resolve the right settings:
This code will eventually hit vscode/src/vs/base/common/mime.ts Line 114 in b776d80
But in order for this to work, we need vscode/src/vs/base/common/mime.ts Line 44 in b776d80
Which is not the case for files opened right on startup. So we resolve those settings that are not language based. |
Maybe we could have new API on the However, I just checked our default settings and it looks like we actually define "[shellscript]": {
"files.eol": "\n"
} So we need to be a bit more clever here, otherwise we would always wait for languages being registered from extensions... |
vscode/src/vs/platform/configuration/common/configuration.ts Lines 68 to 88 in bdd4291
|
Maybe allow file-extension-specific overrides in addition to language-specific ones. |
Is there any progress in solving this issue? I understand that it's not easy. But it's really annoying if you want to open a file direclty from a file manager and not within VC. |
files.encoding
and files.eol
as language specific setting for files on startupfiles.encoding
as language specific setting for files on startup
Not super happy with the solution I pushed now and it might backfire, but here is what is happening now:
Unfortunately I cannot tell apart this from happening vs. the user changing the language from the editor status bar. So if the user changes language mode to 🤷 |
Verified in #39084 (comment) |
sorry, that i did not write soon enough in #39084 soon enough (work/holydays absorbed me a bit...), but for me this does not work the way it "should" to be honestly... since i opened #39084 we partly changed some of our scripts to UTF8bom. So while migrating our customers to the latest version of our software (what could take some time...) we are in some kind of mixedmode. My Extension does set the files.encoding param to OEM850 (due to old files). if there is explicity an file that does deliver a UTF8 with a BOM this should not be overridden by the files.encoding param. UTF8bom does explicit deliver the BOM so that e.g. Editors can open the file correctly. -> "files.autoGuessEncoding": true does not work becauses this is setting the OEM850 files to OEM866 (...because that is the first implemented encoding in the OEM sector i gues...) Thanks for a second insight on this matter. |
@Raydir can you open a new issue with some basic steps how to reproduce, I am not sure I understand the issue or if its related to this issue. |
Does this issue occur when all extensions are disabled?: Yes
Well know bug:
Language specific resource settings are not resolved for files opening right on startup · Issue #39084 and others.
Please reopen this issue and set priority on it. It's really worse and there are many people running into this issue!
Perhaps you find a way to handle this by a configurable seeting or command line switch.
The text was updated successfully, but these errors were encountered: