You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Second delete folder operation does not work in Insiders 1.41.0 #85938
Found issue with folder delete operation. The point is, when you delete folder (first time), no matter how, via mouse or keyboard combination, then select another folder and try to delete it, you will get popup message saying "Cannot read property 'isDirectory' of undefined"🤔🧐
Only when you select another folder again (second time), delete operation will be successful.
Tried several times with same results.
And as i remember, this bug i found some time ago, so it is not introduced exactly in last insiders build.
Visual Code Insiders 1.41.0 from 2019-12-02, commit: 7cf4cca
macOS 10.15.1
Activity
ghost changed the title [-]Second folder delete operation fails in Insiders 1.41.0[/-][+]Second delete folder operation does not work in Insiders 1.41.0[/+]on Dec 2, 2019
João Moreno (@joaomoreno) the problem was that it was happening that the tree would sometimes set the trait on one element two times.
In this particular case Selection would be set on the element A and A. So if I say tree.getSelection I would get the same item twice. Instead of the array with one item.
I decided to fix this with a workaround on the trait level.
Repro steps: set compact tree to true. Go up and down with the focus always ending up with the focus on the one select item.
Put a conditional breakpoint here tree will try to set the double selection trait
Where the selection would already contain the folder, but as oldSelection/oldFocus also has the id, it will push the same object to the selection again.
You could also fix it there by doing some sort of duplicate filtering or selection.indexOf to prevent duplciates being added
I could reproduce it consistently by:
Putting a breakpoint there
Creating a new folder
Focusing on that folder
Result: The function ends up setting selection to contain the same object twice.
if (oldSelection.has(id)) {
const element = compressedNode.elements[compressedNode.elements.length - 1].element as T;
if (selection.indexOf(element) === -1) {
selection.push();
didChangeSelection = true;
}
}
if (oldFocus.has(id)) {
const element = compressedNode.elements[compressedNode.elements.length - 1].element as T;
if (focus.indexOf(element) === -1) {
focus.push();
didChangeFocus = true;
}
}
But I'm not sure if this is considered good code, it might be better to create a set of Ids (like oldSelection) does, but as selection is of type T, I could not access the id parameter.
Robert Jin (@jzyrobert) If you would like to create a PR you are more than welcome to! It would be great if you could do it today since we are wrapping up the milestone and we need this fix asap.
Just make sure to remove my wokraound introduced with 6d2eeee
Activity
[-]Second folder delete operation fails in Insiders 1.41.0[/-][+]Second delete folder operation does not work in Insiders 1.41.0[/+]isidorn commentedon Dec 4, 2019
@ZaJarv thanks for filling this great issue. You should have the fix tommorrow in vscode insiders
isidorn commentedon Dec 4, 2019
João Moreno (@joaomoreno) the problem was that it was happening that the tree would sometimes set the trait on one element two times.
In this particular case Selection would be set on the element A and A. So if I say tree.getSelection I would get the same item twice. Instead of the array with one item.
I decided to fix this with a workaround on the trait level.
Repro steps: set compact tree to true. Go up and down with the focus always ending up with the focus on the one select item.
Put a conditional breakpoint here tree will try to set the double selection trait
jzyrobert commentedon Dec 4, 2019
Isidor Nikolic (@isidorn) This seems to be coming from here
Where the selection would already contain the folder, but as oldSelection/oldFocus also has the id, it will push the same object to the selection again.
You could also fix it there by doing some sort of duplicate filtering or selection.indexOf to prevent duplciates being added
I could reproduce it consistently by:
Result: The function ends up setting selection to contain the same object twice.
isidorn commentedon Dec 4, 2019
Robert Jin (@jzyrobert) great pointer. I think you are right, give me a sec and I will push a better fix. Thanks a lot!
jzyrobert commentedon Dec 4, 2019
Isidor Nikolic (@isidorn) I was planning to submit something along the lines of
But I'm not sure if this is considered good code, it might be better to create a set of Ids (like oldSelection) does, but as selection is of type T, I could not access the id parameter.
isidorn commentedon Dec 4, 2019
Robert Jin (@jzyrobert) If you would like to create a PR you are more than welcome to! It would be great if you could do it today since we are wrapping up the milestone and we need this fix asap.
Just make sure to remove my wokraound introduced with 6d2eeee
Thanks!
And make sure to ping me on the PR
Merge pull request #86286 from jzyrobert/85938