Skip to content
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

feat: Run task when double clicking tasks #1174

Merged
merged 1 commit into from
Feb 28, 2022
Merged

feat: Run task when double clicking tasks #1174

merged 1 commit into from
Feb 28, 2022

Conversation

CsCherrYY
Copy link
Collaborator

fix #1124

previously: double click task will open the corresponding build file
current: double click task will run this task
clicktask

@Eskibear
Copy link
Member

Interesting. looks a promising way to mimic double click handler.

But I see in the utils, you cached the date in a shared variable for all tree items, which might cause problem.
E.g. If you quickly click two items in 500ms (interval you set), it's wrongly treated as double click.

@CsCherrYY
Copy link
Collaborator Author

Interesting. looks a promising way to mimic double click handler.

But I see in the utils, you cached the date in a shared variable for all tree items, which might cause problem. E.g. If you quickly click two items in 500ms (interval you set), it's wrongly treated as double click.

you're right, in this way we should find a way to record the tree item as well.

@Eskibear
Copy link
Member

a treeItem has a unique id. consider use that?

@CsCherrYY
Copy link
Collaborator Author

a treeItem has a unique id. consider use that?

yes, but that's something like internal identifier and if we didn't specify it before, we will get undefined when accessing that id. Why not directly assert equal of two tree items? Actually, they are the same object if we just click an item twice.

@Eskibear
Copy link
Member

it's fine.

if (treeItem && treeItem.task) {
await runTask(this.rootProjectsStore, treeItem.task, this.client);
if (checkDoubleClick()) {
return run(treeItem, this.rootProjectsStore, this.client);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would better to clear the state if a double click is detected. Otherwise, triple click is regarded as two double clicks.

@CsCherrYY CsCherrYY changed the base branch from main to develop February 21, 2022 07:56
@CsCherrYY CsCherrYY merged commit 3c9a73a into develop Feb 28, 2022
@CsCherrYY CsCherrYY deleted the cs-issue1124 branch February 28, 2022 02:48
@CsCherrYY CsCherrYY mentioned this pull request Feb 28, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change the behavior of clicking tasks
2 participants