Gruntfuggly / todo-tree

Use ripgrep to find TODO tags and display the results in a tree view
Other
1.4k stars 134 forks source link

Interference with Git context switches - Uncontrolled auto save for "in memory" file #844

Open FALLAI-Denis opened 1 month ago

FALLAI-Denis commented 1 month ago

Hi,

First of all, thank you for proposing this extension which we fully appreciate.

We noticed an issue when using it in a Git context. When the user works in a Git branch whose sources have TODO tags, and he makes a Git branch change, (checkout), the TAG tree is not erased and recreated for the context of the new Git branch, but above all, the links stored in the TAG tree cause the display of a source which possibly does not even exist in the new Git branch...

It is of course possible to activate the todo-tree.general.automaticGitRefreshInterval setting, but this will actually occurs after the Git branch change, and it seems that the TAG tree locks the referenced sources and prevents Git areas from being refreshed by checkout.

The case of a source that does not exist in the new Git context is obvious, and this is what attracted the attention of our developers, but the biggest danger would be to work with a source that exists in the old Git context and the new Git context, and after a Git context change the developer ends up with the source of the old context. For the moment we have not highlighted this problem, but that of the file which does not exist in the new Git context and which is displayed when we click on the link in the TAG tree has been observed several times.

This issue was noticed after implementing the TODO Tree extension and did not occur before that.

Thanks.

FALLAI-Denis commented 1 month ago

PS: I think I found the conditions of the problem...

However, the problem does not seem systematic and seems to only occur in the event of a "first" time on a file: if it has been highlighted 1 time on a file, it is not possible to reproduce the case on the same file. Perhaps the number of editors open in VS Code also has an influence on the occurrence of the problem.