Skip to content

Commit

Permalink
refactor(cli): replace Promise-based setTimeout with timers/promises
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Jan 5, 2025
1 parent 7d5ed91 commit 1d51e51
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import glob = require('glob');
import fs = require('fs');
import os = require('os');
import languagePlugins = require('./lib/languagePlugins.js');
import { setTimeout } from 'node:timers/promises';
import { getVSCodeFormattingSettings } from './lib/formatting.js';

const _reset = '\x1b[0m';
Expand Down Expand Up @@ -376,7 +377,7 @@ class Project {

if (Date.now() - lastSpinnerUpdate > 100) {
lastSpinnerUpdate = Date.now();
await new Promise(resolve => setTimeout(resolve, 0));
await setTimeout(0);
}

let fileCache = project.cache[fileName];
Expand Down

0 comments on commit 1d51e51

Please sign in to comment.