File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 66- Added a new command: ` Task: Show Debug Panel ` to show the Task debug panel (#25 by @pd93 ).
77- Added the ability to sort tasks in the tree view (#20 by @pd93 ).
88 - Configurable via ` task.tree.sort ` setting (values: ` "default" ` (default), ` "alphanumeric" ` or ` "none" ` ).
9+ - Added a cancel/timeout to file watcher to improve performance when making lots of file changes (#35 by @pd93 ).
10+ - For example, ` git stash pop ` of a lot of ` .yml ` files would cause a huge lag spike as multiple update calls were made.
911
1012## v0.1.1 - 2021-03-27
1113
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ export class TaskExtension {
88 private _taskfiles : models . Taskfile [ ] = [ ] ;
99 private _activityBar : elements . ActivityBar ;
1010 private _watcher : vscode . FileSystemWatcher ;
11+ private _changeTimeout : NodeJS . Timeout | null = null ;
1112
1213 constructor ( ) {
1314 this . _activityBar = new elements . ActivityBar ( ) ;
@@ -209,10 +210,19 @@ export class TaskExtension {
209210
210211 private async _onDidTaskfileChange ( ) {
211212 log . info ( "Detected changes to taskfile" ) ;
212- // If manual updating is turned off (update on save)
213- if ( settings . updateOn !== "manual" ) {
214- await this . refresh ( false ) ;
213+
214+ // If there's already a timeout scheduled, cancel it to debounce the changes
215+ if ( this . _changeTimeout ) {
216+ clearTimeout ( this . _changeTimeout ) ;
215217 }
218+
219+ // Schedule a new timeout to refresh the task files after 500ms
220+ this . _changeTimeout = setTimeout ( async ( ) => {
221+ // If manual updating is turned off (update on save)
222+ if ( settings . updateOn !== "manual" ) {
223+ await this . refresh ( false ) ;
224+ }
225+ } , 200 ) ;
216226 }
217227
218228 private _onDidChangeConfiguration ( event : vscode . ConfigurationChangeEvent ) {
You can’t perform that action at this time.
0 commit comments