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:
Search for 'POSITRON': '1' for other instances where we set the environment variable
Extensions such as Quarto and Workbench use this environment variable to check if the extensions are running in Positron to apply customized behaviour.
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 anisPositronContext
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
IsPositron
orIsPositronContext
Notes
POSITRON=1
https://github.com/posit-dev/positron/blob/d753d0dce92a116a0c6fe6e70cf7822b8e4243a2/src/vs/platform/terminal/node/terminalEnvironment.ts#L144-L153'POSITRON': '1'
for other instances where we set the environment variable