-
Notifications
You must be signed in to change notification settings - Fork 92
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
Add isPositron context key #5673
Conversation
@@ -25,6 +25,9 @@ CONSTANT_VALUES.set('isEdge', isEdge); | |||
CONSTANT_VALUES.set('isFirefox', isFirefox); | |||
CONSTANT_VALUES.set('isChrome', isChrome); | |||
CONSTANT_VALUES.set('isSafari', isSafari); | |||
// --- START POSITRON --- |
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.
Nit, instead of capitals, we've tried to be consistent with Start Positron
and End Positron
, mixed case, for these change region markers.
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'm not sure why I thought we always used capitals. 🤯
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 👍 Added one idea for testing in an extension, but I agree the test should be enough!
// --- Start Positron --- | ||
test('Positron Context Key', () => { | ||
assert.ok(ContextKeyExpr.has('isPositron').equals(ContextKeyExpr.true())); | ||
}); | ||
// --- End Positron --- |
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.
Agreed this should be enough to verify the context key works for now 👍
If we'd like to test in an extension, one idea is to add a command to positron-zed which has enablement
based on the Positron context? Then we can verify that the context key is working if the command is available in the Command Prompt.
extensions/positron-zed/package.json
(I think something like this might work, but untested!)
{
"category": "Zed",
"command": "zed.checkIsPositronContext",
"title": "Check that the isPositron context key is set",
"enablement": "isPositron"
},
The PWB extension will be leveraging this context key soon, so we can also wait for that work to confirm the context key functionality: /~https://github.com/rstudio/rstudio-workbench-vscode-ext/issues/279
Address #5339
Adds a
isPositron
context key that istrue
. This can be used with extensions like this:It can also be used internally with
IsPositronContext
orContextKeyExpr.has('isPositron')
if we had an existential crisis.QA Notes
Nothing uses this and the unit test is enough to know that the key is available.