fix: filesize calculation
This commit is contained in:
parent
b55656a014
commit
f276c4ad3d
1 changed files with 6 additions and 1 deletions
|
@ -185,7 +185,12 @@ async function fileDetails(_raw: string, document: TextDocument, selection: Sele
|
||||||
|
|
||||||
if (raw.includes(REPLACE_KEYS.FileSize)) {
|
if (raw.includes(REPLACE_KEYS.FileSize)) {
|
||||||
let currentDivision = 0;
|
let currentDivision = 0;
|
||||||
let { size } = await workspace.fs.stat(document.uri);
|
let size: number;
|
||||||
|
try {
|
||||||
|
({ size } = await workspace.fs.stat(document.uri));
|
||||||
|
} catch {
|
||||||
|
size = document.getText().length;
|
||||||
|
}
|
||||||
const originalSize = size;
|
const originalSize = size;
|
||||||
if (originalSize > 1000) {
|
if (originalSize > 1000) {
|
||||||
size /= 1000;
|
size /= 1000;
|
||||||
|
|
Loading…
Reference in a new issue