-
Notifications
You must be signed in to change notification settings - Fork 29.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
Emmet: Encode\Decode action & preferences #9002
Conversation
@mrmlnc, thanks for your PR! By analyzing the annotation information on this pull request, we identified @egamma and @alexandrudima to be potential reviewers |
@mrmlnc I'm sorry but I didn't get to this PR before my vacation and it is getting tight for the July iteration. One issue is that emmet 1.6 adds a new dependency to caniuse-db, that we need to track. |
@mrmlnc there is some significant size increase between emmet 1.3.1 and emmet 1.6 and this needs a justification:
While the emmet 1.6 module itself got smaller and is now 1.8 MB, the caniuse-db module adds 7 MB. So how can the size difference be justified? |
Hello, @egamma, you are well rested? 🎿 ☀️ Nice catch. Unfortunately, i have not checked this case. The module CanIuse contains a lot of unnecessary information for us. The way out of this situation will be building Emmet by Gulp. Theoretically this can solve some issues such as #4076. If you remember, I conducted the tests, but it was on a fast SSD drive. P.S.: The author plans to completely rewrite Emmet, so we can postpone this matter at any time convenient for you. I don't think a lot of people use this feature Emmet. |
The way we currently build VS Code is that we One thing we are also considering is to move emmet into an extension.
Then let's defer it for now. This is still a great PR, thank you 🌹 |
I will discuss this issue with the creator of Emmet.
Great idea. |
@mrmlnc I'm closing this PR for now. |
Hi, I can not find the Encode/Decode Image to data:URL command in the palette and in the emmet commands list. What about you guys ? Is it missing for everyone?
|
@freMea No this hasn't been implemented in VS Code yet. You can follow #27978 for updates on this feature |
As I promised before, here’s a detailed description of what’s happening in the code.
Description
I contacted with the developer of Emmet (@sergeche) and made a bit of changes for creating an ability of using asynchronous API, and handle any errors, such as file does not exist, reading errors, write errors etc.
This PR close following issues and PR: #8569, #8324, #8586, #8542, which were created before.
Changelog
There’s a main changes that this PR make:
meta:redirect
snippet commitprofile.booleanAttributes
commitbuffer
in the filesrc/vs/base/node/request.ts
, since the functiontext
returns a string. This function returns the buffer.Encode\Decode
andUpdate Image Size
.base64
for transmit path to the Emmet, has been delete (it is not necessary in version 1.6.0).Why the
base64
has a lot of code?For user comfortable it’s necessary to process several situations:
Automated tests
I try to create automatic tests for this command, but got an editor error. The log is below. The source code for the test: Gist.
Despite of error,
console.log
in the test (inside the test file) file displays the correct result. I can’t find a reason of this.Error log:
Cannot read property 'getStartPosition' of null
I also wrote the basic tests for
FileAccessor
, but i didn’t include them in this PR. They are available in Gist.This tests are useful after little changes of a class
FileAccessor
:locateFile
method should returnthis.fileService.existsFile
.read
method should returnbuffer
иthis.fileService.resolveContent
.save
method should returnthis.fileService.updateContent
.Because of automatic tests don’t work, I wrote the instructions for manual testing.
Manual tests
Check for encoding and decoding for files from network and disks.
Open the directory and create a CSS file.
Insert the following code into the newly created file:
Run
Encode\Decode
command. The correct result:background-image: url(data:application/octet-stream;base64,/9j/2wCEAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSE…);
Run
Encode/Decode
command in the same file.Write the name
test.png
. File must be saved, and property looks following:background-image: url (test.png);
.Rerun
Encode\Decode
command. The correct result: as in item 3 above.Check of processing cancellation of decode and display a simple errors.
Repeat the first three steps described above (1.1 - 1.3).
Run
Encode\Decode
command and press Escape key. Nothing's going to happen.Run
Encode\Decode
and write the following text:../../test.png
. You should see:Run
Encode\Decode
and write the following text:test:::image.png
. You should see:Checking display of warnings.
Repeat the first six steps described above (1.1 - 1.5).
Change image url on
https://avatars2.githubusercontent.com/u/172399?v=3&s=60
.Run
Encode\Decode
action and writetest.png
. You should see:Agree to overwrite.
Open the file
test.png
. You should see avatar @egamma.Checking display warnings about missing files.
Open the directory and create a CSS file.
Insert the following code into the newly created file:
Run
Encode\Decode
action. You should see:Replace the path in
background-image
property to a new value:fileNotExist.png
.Run
Encode\Decode
action. You should see: