stringham / move-ts

A Visual Studio Code plugin for updating relative imports when moving typescript files and folders in your workspace.
MIT License
52 stars 15 forks source link

Repeatedly fires scan on multiple clicks #25

Open electrovir opened 5 years ago

electrovir commented 5 years ago

We've got a large code base, and the "scan" operation apparently takes a very long time the first time (2+ minutes, see logs below). At first I didn't know what was going on and triggered the "Move Typescript" command multiple times (from the right click menu). Then I opened the dev tools to see what was going on and eventually saw that all my triggers ended up finishing, opening the "Where would you like to move?" dialog over and over.

I'm guessing this simply needs a to track if a scan is already in progress and not trigger more scans in the meantime.

Here's the dev tools output with paths truncated:

[Extension Host] scan finished in 111292ms (at vscode.workspace.findFiles.then.then (stringham.move-ts-1.11.3/out/src/index/referenceindexer.js:116:21))
workbench.main.js:294
[Extension Host] move-ts initialized (at scanAll.then.then (stringham.move-ts-1.11.3/out/src/index/referenceindexer.js:37:25))
workbench.main.js:294
[Extension Host] scan finished in 277543ms (at vscode.workspace.findFiles.then.then (stringham.move-ts-1.11.3/out/src/index/referenceindexer.js:116:21))
workbench.main.js:294
[Extension Host] move-ts initialized (at scanAll.then.then (stringham.move-ts-1.11.3/out/src/index/referenceindexer.js:37:25))
workbench.main.js:294
[Extension Host] scan finished in 279089ms (at vscode.workspace.findFiles.then.then (stringham.move-ts-1.11.3/out/src/index/referenceindexer.js:116:21))
workbench.main.js:294
[Extension Host] move-ts initialized (at scanAll.then.then (stringham.move-ts-1.11.3/out/src/index/referenceindexer.js:37:25))
workbench.main.js:294
[Extension Host] scan finished in 278734ms (at vscode.workspace.findFiles.then.then (stringham.move-ts-1.11.3/out/src/index/referenceindexer.js:116:21))
workbench.main.js:294
[Extension Host] move-ts initialized (at scanAll.then.then (stringham.move-ts-1.11.3/out/src/index/referenceindexer.js:37:25))
workbench.main.js:294
[Extension Host] scan finished in 276190ms (at vscode.workspace.findFiles.then.then (stringham.move-ts-1.11.3/out/src/index/referenceindexer.js:116:21))
workbench.main.js:294
[Extension Host] move-ts initialized (at scanAll.then.then (stringham.move-ts-1.11.3/out/src/index/referenceindexer.js:37:25))
workbench.main.js:294
[Extension Host] scan finished in 261436ms (at vscode.workspace.findFiles.then.then (stringham.move-ts-1.11.3/out/src/index/referenceindexer.js:116:21))
workbench.main.js:294
[Extension Host] move-ts initialized (at scanAll.then.then (stringham.move-ts-1.11.3/out/src/index/referenceindexer.js:37:25))
workbench.main.js:294