Skip to content

Fix #84111 - #84610

Merged
Matt Bierner (mjbvz) merged 3 commits into
microsoft:masterfrom
shizengzhou:image-size
Nov 15, 2019
Merged

Matt Bierner (mjbvz) merged 3 commits into
microsoft:masterfrom
shizengzhou:image-size

Conversation

@shizengzhou

Copy link
Copy Markdown
Contributor

This PR fixes #84111

Comment thread extensions/image-preview/src/preview.ts Outdated
case 'size':
{
this._imageSize = message.value;
const { size } = fs.statSync(resource.path);

Copy link
Copy Markdown
Contributor

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>;

@mjbvz Matt Bierner (mjbvz) left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread extensions/image-preview/src/preview.ts Outdated
{
this._imageSize = message.value;
this.update();
vscode.workspace.fs.stat(resource).then(stat => {

@mjbvz Matt Bierner (mjbvz) Nov 14, 2019 •

Copy link
Copy Markdown
Contributor

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 Matt Bierner (mjbvz) added this to the November 2019 milestone Nov 15, 2019
@mjbvz
Matt Bierner (mjbvz) merged commit 14e6ad3 into microsoft:master Nov 15, 2019
@mjbvz

Copy link
Copy Markdown
Contributor

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

@shizengzhou
Shizeng Zhou (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