-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't use findTreeItem
in AzExtTreeFileSystem
#1257
Conversation
5022ddb
to
49904b4
Compare
f6587b5
to
9d2f4db
Compare
export abstract class AzExtTreeFileSystem<TItem extends AzExtTreeItem> implements FileSystemProvider { | ||
export abstract class AzExtTreeFileSystem<TItem extends types.AzExtTreeFileSystemItem> implements FileSystemProvider { | ||
|
||
private readonly itemCache: Map<string, TItem> = new Map<string, TItem>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we clear and repopulate this every time a refresh happens? Seems like it could cause stale tree item ids if we're not careful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't run into that in my testing, but I am worried about the possibility of something like that happening. The tree item ids correspond to Azure resource ids so unless something is deleted I think it's fine. I will test that now. I don't know if delete was handled properly in v1.
If you delete a resource while editing the tags it will show this error. I think that's fine behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also whenever I tried clearing this map, it resulted in errors since we can't really know if the items in the map are still in use easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A potential fix for all of this would be to really remove the reliance on items at all, and base if fully on URIs.
Oh, this is only for the FileSystem? So |
Yes this PR is only removing the usage of However, |
We haven't gotten
findTreeItem
to work for v2 yet since tree item IDs haven't been ironed out. However, I'm proposing that we move away from usingfindTreeItem
inAzExtTreeFileSystem
.AzExtTreeFileSystem
is one of the main places wherefindTreeItem
is used.vscode.FileSystemProvider
relies on handlingUri
s within VS Code. Within the file system provider methods we need access to the tree item in order to read/write the file content. Currently, we're adding the tree item ID to theUri
query params, and then usingfindTreeItem
to retrieve the tree item within the handler.Although that works great, I found it sorta wasteful to use
findTreeItem
to retrieve a reference to an object that we already have when forming theUri
. Instead, I just store the tree item in aMap
with a random key and pass the key in theUri
, eliminating the need forfindTreeItem
. This method is probably a bit faster too.Drawbacks of this method include: