Related: https://github.com/microsoft/vscode/issues/79275
I have fixed this issue in my local environment, and I'd like to make a pull request if you want.
This will require a upstream update.
Related: microsoft/vscode#79275
I have fixed this issue in my local environment, and I'd like to make a pull request if you want.
I also found vscode cannot reopen with other encodings like gbk, could you help me?
@SysuXiaoYu feel free to do so and regenerate the patch for us.
@LeuisKen how did you fix it locally?
@LeuisKen how did you fix it locally?
@LeuisKen thank you! Does it also allow to switch file encoding?
@LeuisKen thank you! Does it also allow to switch file encoding?
I find some way to do this, but this patch need to import another third party lib called text-encoding, and I didn't publish this internal patch. Hope vscode will fix this issue soon.
@LeuisKen, can you also describe what would be the correct way to get your fix into the code-server?
I would like to apply you fix (at least to my local fork of the code-server), but I am afraid it'll take me hours to figure out how to do it properly :)
Maybe you can even make a PR to this repo with your patch?
Maybe you can even make a PR to this repo with your patch?
I may not have time to do this until weekend, and other features like guess encoding I didn't fix.
I'll send a pull request to code-server this weekend if you really need it.
I think that VS Code team will not fix this problem in my way, and I am worried that this patch will make the code server and VS Code upstream code further and further away.
@code-asher Can you take a look at @LeuisKen's PR?
No problem.
@LeuisKen let me describe you my use-case, so you can tell me if your code will fix it or not (not sure I know enough vscode to understand this myself 馃槄 )
In the codebase I am working with there are 2 languages used: PHP and JS. Unfortunately *.php files have one encoding and *.js files have another. And currently it will not change in the forseable future. And I need to be able to save the files in the encoding they are currently.
I'll send a pull request to code-server this weekend if you really need it.
So as you can see from my description, I really need it :)
In the desktop version of VSCode I can do it with:
// workspace settings json
"[php]": {
"files.encoding": "encoding"
// error: this setting does not support per-language configuration
}
This doesn't work probably because code-server does not support top-level files.encoding setting at all.
How hard do you think it will be to add support for files.encoding setting on top of your changes? Do you think then it will address my use-case?
I think that VS Code team will not fix this problem in my way, and I am worried that this patch will make the code server and VS Code upstream code further and further away.
It seems like the Coder team are ok with the change. And for me this change will be the savior - without it I can't use code-server for half of my project.
So if you can fix this for me you will be my hero 馃槃
I understand and I'll try to help with your case.
Thank you for taking care of it!
In the related VSCode issue there was just posted an interesting answer: https://github.com/microsoft/vscode/issues/79275#issuecomment-629952916
Maybe we just wait for Microsoft to get it in.
See https://github.com/microsoft/vscode/issues/79275#issuecomment-637337120
Should be in the next couple weeks and their's will be much smaller.
https://bundlephobia.com/[email protected]
In @LeuisKen's PR text-encoding adds 200 KB of minified code! For reference react-dom is 35 KB.
Yeah, I've decided to give it a try and contribute the feature.
However so far it doesn't look like the result will be smaller. 200 KB you are referring to is minified and gzipped version. Just minified one is 535 KB according to your link.
Currently iconv-lite, which we are planning to use in the browser is 600 KB minified. As you can see it is even bigger.
So I am not sure the solution I am working on now will result in smaller footprint. However it will probably be more "correct" because it will reuse code between electron version and browser version as well as will use stream interface hence smaller memory footprint.
Mhmm. Sounds good. Let's wait for your stuff to get into upstream then.
If it ends up taking a while upstream we can just make text-encoding lazy load when we need to use a non UTF-8 encoding and that'd be ok.
I am hoping it can go to upstream for June release. At least I鈥檒l try my best to make it happen.
Alternatively if it gets blocked there, I can finish it up anyway and we can just apply my changes here if you鈥檒l be up for it.
Currently it gives me a lot of pain, cause I have to work on half of my project files locally and rsync them back and forth 馃槄
@nhooyr finally all of the work needed for this is merged to upstream.
Should be in the next couple weeks and their's will be much smaller.
In the end we were able to make the size much smaller, so you were right 馃槃
Unfortunately it didn't make in time for the June release. Would it be possible to update code-server so that it includes the fresh release (we seem to be lagging behind now) plus commits needed for this feature to work?
Would it be possible to update code-server so that it includes the fresh release (we seem to be lagging behind now) plus commits needed for this feature to work?
Definitely! We'll try to get on this at some point but welcome a PR as well.
Definitely! We'll try to get on this at some point but welcome a PR as well.
I am afraid merging your vscode patch with vscode changes requires much deeper knowledge of how things work together than I currently have.
@LeuisKen 3.5.0 should now support encodings. I am not using code-server at the moment. Can you try to see if it works for you?
Most helpful comment
Maybe we just wait for Microsoft to get it in.
See https://github.com/microsoft/vscode/issues/79275#issuecomment-637337120
Should be in the next couple weeks and their's will be much smaller.
https://bundlephobia.com/[email protected]
In @LeuisKen's PR text-encoding adds 200 KB of minified code! For reference react-dom is 35 KB.