Skip to content

Commit

Permalink
fix: make sure onDidSaveTextDocument execute after `onWillSaveTextD…
Browse files Browse the repository at this point in the history
…ocument`
  • Loading branch information
johnsoncodehk committed Apr 25, 2023
1 parent 86d427b commit 3ace934
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/vscode-vue/src/nodeClientMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,19 @@ export function activate(context: vscode.ExtensionContext) {
}
});

let start = Date.now();
let start: number | undefined;
vscode.workspace.onWillSaveTextDocument(() => {
start = Date.now();
});
vscode.workspace.onDidSaveTextDocument(async () => {

if (start === undefined) {
return;
}

const time = Date.now() - start;
start = undefined;

if (config.features.codeActions.enable && time > config.features.codeActions.savingTimeLimit) {
const result = await vscode.window.showInformationMessage(
`Saving time is too long. (${time} ms > ${config.features.codeActions.savingTimeLimit} ms), `,
Expand Down

0 comments on commit 3ace934

Please sign in to comment.