-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Allow removing files in the file search #82629
Conversation
a8e9a72
to
531676b
Compare
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.
Tested locally (rebased on top of bfd78bb), it works as expected.
Replace in Files also takes deleted entries into account:
Result:
The icon design should be changed though, as it doesn't fit well with the rest of the engine's visual design currently (see review comment).
531676b
to
b4c4ad8
Compare
Is the new version good? |
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.
3b5162d
to
1e52f24
Compare
It may look nicer if the button was added on hover only, like in VS Code in KoBeWi's proposal. But if that requires making the implementation significantly more complex, then it's probably not worth it. |
Another thing is that in VS Code deleting a result will update the number: Code_sNIFvD4Ng4.mp4 |
4cef9a8
to
91d15e3
Compare
Deleting all entries under a file should also delete the file: godot.windows.editor.dev.x86_64_B39QGrj5Tf.mp4Also deleting a file with many results seems to cause a short freeze and error spam 🤔 |
@KoBeWi Can't replicate this issue and also it's kind of expected when you are hiding files with a lot of matches (10k+).
I don't think this is possible with the current implementation of TreeItem and Tree. |
91d15e3
to
1f76b78
Compare
godot.windows.editor.dev.x86_64_9wnf582zyo.mp4I deleted 39 out of 600 results. It's far from thousands.
Why? When deleting item, check if it's the only item. If not, delete item. If true, delete parent instead. |
I think this has to do with some other piece of code that is causing all these errors because when I test it out, it works fine without any errors. |
I'm testing on newest master, so maybe try rebasing if you are not up-to-date. |
1f76b78
to
b1a031a
Compare
@KoBeWi Can't seem to be able to replicate it. Also can someone rerun the checks? |
Your newest changes fixed the errors and lag, but deleting file does not update matches: godot.windows.editor.dev.x86_64_Zz0R1HGs2y.mp4 |
b1a031a
to
190e0e6
Compare
@KoBeWi Should be fixed in the newest but I doubt this will get merged before 4.2 |
It's an enhancement and we're in feature freeze so it won't be merged until 4.3, no rush to fix anything but nothing stopping working on it either :) |
190e0e6
to
1da3ddb
Compare
if (_result_items.find(p_item)) { | ||
_result_items.erase(p_item); |
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.
You can avoid double lookup if you do
if (_result_items.find(p_item)) { | |
_result_items.erase(p_item); | |
HashMap<TreeItem *, Result>::Iterator E = _result_items.find(p_item); | |
if (E) { | |
_result_items.remove(E); |
EDIT:
Also this piece of code is repeated so many times that you could extract it to a method, e.g. _delete_result_item(item)
.
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.
Left one minor comment, but otherwise it's fine.
_file_items.erase(file_path); | ||
} | ||
|
||
get_tree()->queue_delete(p_item); |
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'd move this below as well just to ensure that we don't operate on something after we've queued the deletion, just for correctness and safety
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.
LGTM otherwise
@Stronkkey Are you available to address the last review comments? |
Closes godot-proposals#7881