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

Don't wait twice for command promise #29

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

AndreasArvidsson
Copy link
Member

@AndreasArvidsson AndreasArvidsson commented Nov 20, 2024

We are already waiting for the command promise online 91 so we don't need to wait for it again. This had the side effect that if the promise was rejected we had an uncaught exception being thrown.

This is the reason why you get two error messages from cursorless. The warning is actually from the command client.

image

@pokey
Copy link
Member

pokey commented Nov 21, 2024

I think there are two reasons we may want to keep this code, or something like it:

  1. If the command is called without waitForFinish or returnCommandOutput, then we won't wait for the command to finish before resetting focusedElementType in https://github.com/pokey/command-server/blob/b49e02b2bbbf91c9dacd038c2ff02a615d32b58d/src/extension.ts#L20
  2. Without this await, we are swallowing the error, rather than letting VSCode do whatever it would normally do with a thrown exception. Is that desirable? I don't know. Might be worth discussing

@AndreasArvidsson
Copy link
Member Author

I think there are two reasons we may want to keep this code, or something like it:

1. If the command is called without `waitForFinish` or `returnCommandOutput`, then we won't wait for the command to finish before resetting `focusedElementType` in https://github.com/pokey/command-server/blob/b49e02b2bbbf91c9dacd038c2ff02a615d32b58d/src/extension.ts#L20

2. Without this `await`, we are swallowing the error, rather than letting VSCode do whatever it would normally do with a thrown exception. Is that desirable? I don't know. Might be worth discussing
  1. You're totally right. I made an update to fix this.
  2. We are still returning the error to the command client. I don't see any need for vscode to do anything further with it. Do you?

@pokey
Copy link
Member

pokey commented Nov 23, 2024

That's a good question. My gut instinct is that if you run a command and it throws an exception, we should let that exception out the same way happens when you run a command any other way in VSCode. But I guess I don't feel super strongly

@AndreasArvidsson
Copy link
Member Author

I can of think the purpose of an exception is to bubble back to the caller which is Talon in this case. I just think that double error messages are kinda annoying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants