Open jeffb-sfdc opened 2 years ago
@jeffb-sfdc have you found a root cause for this issue?
@christian-bromann yes, if I remember correctly, the issue is that in openItem()
, the tree is walked and expended with:
await item?.expand();
When expanded, the first item is now "test / two / three", but path[0]
is now stale, and is only "test".
A few lines later there is:
let currentItem = await this.findItem(path[0], 1);
path[0]
is still "test", but within this.findItem()
, it has "test / two / three" not "test", and so the node is never found.
@jeffb-sfdc gotcha, what would you suggest as a solution to this problem?
TreeSection.openItem() doesn't work with compacted (empty) folders.
Let's say I have the following folder structure:
...and let's say that in my e2e test, I have /src/project open. When
/src/project
is opened, VS Code displays just:If /project/test is expanded, because VS Code has the
explorer.compactFolders
setting set to true by default, what we see is:(/project/test only has one folder, "two", and project/test/two only has one folder, "three", and so they are compacted)
OK, next write a test and add:
The implementation of
openItem()
is:Here, path is ['test'], and in the first loop, when findItem() is called:
...i is 0, and path[0] is "test", this.findItem(path[i], i + 1) succeeds, and then the node is expanded in VS Code's UI.
But next, immediately after the first for loop, findItem() is called again:
path[0]
is still "test", but since the node was expanded, and it has nested empty folders, and explorer.compactFolders is true by default, the text of the node is now "test / two / three", andcurrentItem
returned fromthis.findItem(path[0], 1)
is undefined.