posit-dev / positron

Positron, a next-generation data science IDE
https://positron.posit.co
Other
2.82k stars 91 forks source link

Add Positron context key #5339

Open sharon-wang opened 1 week ago

sharon-wang commented 1 week ago

Background

We currently set POSITRON=1 in our Terminals, but there are areas where we may want to interface with a context key instead of an environment variable to determine that we're running in Positron.

For example, when clauses could make use of an isPositronContext context key to enable contributions:

https://github.com/posit-dev/positron/blob/d753d0dce92a116a0c6fe6e70cf7822b8e4243a2/extensions/positron-python/package.json#L89-L96

Similarly, enablement clauses could leverage the context key.

https://github.com/posit-dev/positron/blob/d753d0dce92a116a0c6fe6e70cf7822b8e4243a2/extensions/positron-python/package.json#L302-L308

Extensions may want to contribute commands or UI based on if the extension is run in Positron or not.

Proposal

Notes

juliasilge commented 1 week ago

Related to https://github.com/posit-dev/positron/issues/526, and maybe a better way to address that need than something in the Positron API