Open baincd opened 3 months ago
This issue seems similar to #637. I was able to track down the starting place for this issue (the refresh()
function in src/extension.js
), but I am unable to find the root cause.
However, I tried applying similar fixes to this issue as was used to fix #637, and they do appear to fix the issue. I haven't considered the performance impact of rebuilding the tree when changing the view mode, so that may need to be taken into consideration.
@@ -863,12 +863,18 @@ function activate( context )
function refresh()
{
searchResults.markAsNotAdded();
provider.clear( vscode.workspace.workspaceFolders );
provider.rebuild();
- refreshOpenFiles();
- addResultsToTree();
+ // FIX1 - just rebuild the entire tree
+ rebuild();
+
+ // OR FIX2 - call these methods the same was as is done in rebuild(), but without having to do the full rebuild
+ iterateSearchList()
+ .finally( refreshOpenFiles )
+ .then( addResultsToTree );
+
setButtonsAndContext();
}
Recreate
Setup
Steps
[ ] Hello
to the filefile1
World
to the todo line in the file (so it now says "[ ] Hello World") - DO NOT SAVEBoth the todo saved in the file (![image](https://github.com/Gruntfuggly/todo-tree/assets/5075659/d878ba7b-1856-4a7c-a0b0-5ffb3da32f24)
[ ] Hello
) and the todo in the editor ([ ] Hello World
) are displayedClick refresh cleans up the duplicate (removing the version saved to disk). But pressing the flat/tree/tags-only or group-by-tags button again reintroduces the extra todo