Skip to content

Fix #84111#84610

Merged
mjbvz merged 3 commits intomicrosoft:masterfrom
shizengzhou:image-size
Nov 15, 2019
Merged

Fix #84111#84610
mjbvz merged 3 commits intomicrosoft:masterfrom
shizengzhou:image-size

Conversation

@shizengzhou
Copy link
Contributor

This PR fixes #84111

case 'size':
{
this._imageSize = message.value;
const { size } = fs.statSync(resource.path);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many of the images we load are not on the file system. They may be remote or data uris, which fs will not understand

Try using VS Code's file system api instead:

stat(uri: Uri): Thenable<FileStat>;

Copy link
Collaborator

@mjbvz mjbvz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the binary size should be a new status bar item. That way users can disable the dimensions or binary size independently.

See SizeStatusBarEntry for a good starting point for creating the new status bar item. The BinarySize class can also live in that new file

{
this._imageSize = message.value;
this.update();
vscode.workspace.fs.stat(resource).then(stat => {
Copy link
Collaborator

@mjbvz mjbvz Nov 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not happen inside the message handler. The image's dimensions and binary size should be computed independently

@mjbvz mjbvz added this to the November 2019 milestone Nov 15, 2019
@mjbvz mjbvz merged commit 14e6ad3 into microsoft:master Nov 15, 2019
@mjbvz
Copy link
Collaborator

mjbvz commented Nov 15, 2019

Thanks! Will be in the next VS Code insiders build and is scheduled to go out with VS Code 1.41

@shizengzhou shizengzhou deleted the image-size branch December 13, 2019 04:07
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Image size that showed on the status bar is not being displayed

2 participants