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

isTesting versus ide.runMode #2301

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

saidelike
Copy link
Collaborator

@saidelike saidelike commented Apr 18, 2024

Checklist

I initially wanted to get rid of isTesting() entirely an only rely on ide.runMode === "test" and ide.runMode === "production" but it seems that some tests actually don't run as vscode extensions we need the CURSORLESS_TEST environment variable (see launch.json)

I thought about moving the isTesting() to cursorless-engine since it holds the ide and export that specific function to the rest of the world. However there is at least one instance of isTesting() in a package that doesn't import cursorless-engine (packages\cursorless-vscode\src\ide\vscode\VscodeEnabledHatStyleManager.ts) so we can't do that.

That is why I came up with this following approach, even though I'm not entirely happy about it. I can't think about any better way, but at least I think it's better than the current way.

it is all the more not ideal because for neovim I'm using CURSORLESS_MODE set to development or test to set the neovimIde.runMode since it's not given by vscode. consequently I'm never gonna use isTesting(). Consequently we could potentially move this one to vscode specific packages.

@pokey
Copy link
Member

pokey commented Apr 18, 2024

hmm if we can't get rid of it entirely, i'd be inclined to just leave things as they are?

@saidelike
Copy link
Collaborator Author

saidelike commented Apr 18, 2024

hmm if we can't get rid of it entirely, i'd be inclined to just leave things as they are?

Yes we could tbh. It didn't go as planned lol but i thought i would explain it in this PR anyway. But i also dont really like the old approach but i can't think of a better way atm anyway.

Feel free to close if you want to stick to old method.

@pokey
Copy link
Member

pokey commented Apr 18, 2024

might be worth switching to use CURSORLESS_MODE everywhere then instead of CURSORLESS_TEST?

@saidelike
Copy link
Collaborator Author

Ya the advantage of CURSORLESS_MODE is that it is consistent if we vscode extension or not and for other apps than vscode.
The drawback is that we need to specify it for every single task or launch config (as development or test) as otherwise it will be treated as production (when the env variable is not set).

@pokey
Copy link
Member

pokey commented Apr 18, 2024

but that's the same problem we have today with CURSORLESS_TEST right?

@saidelike
Copy link
Collaborator Author

Yes when outside of a vscode extension.

But in the case of a vscode extension, the vscodeIDE.runMode gives by default that it is production hence not test or development. But it is in other places where isTesting() is not used.

And that was that inconsistency that i wanted to fix initially.

@pokey
Copy link
Member

pokey commented Apr 22, 2024

hmm not sure i'm totally following. maybe let's discuss at a meet-up?

@pokey pokey added the to discuss Plan to discuss at meet-up label Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
to discuss Plan to discuss at meet-up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants