From 31ae4ee4599ebd66e04de8f8f78a87d2331bd8c8 Mon Sep 17 00:00:00 2001 From: Julia Silge Date: Tue, 17 Sep 2024 11:22:45 -0600 Subject: [PATCH 1/7] Add new env vars for `uiKind` and a long version to kernel (i.e. console) --- extensions/jupyter-adapter/src/JupyterKernel.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/extensions/jupyter-adapter/src/JupyterKernel.ts b/extensions/jupyter-adapter/src/JupyterKernel.ts index e15ca4a753b..b8acc40f971 100644 --- a/extensions/jupyter-adapter/src/JupyterKernel.ts +++ b/extensions/jupyter-adapter/src/JupyterKernel.ts @@ -726,7 +726,12 @@ export class JupyterKernel extends EventEmitter implements vscode.Disposable { const command = args.join(' '); // Create environment. - const env = { POSITRON: '1', POSITRON_VERSION: positron.version }; + const env = { + POSITRON: '1', + POSITRON_VERSION: positron.version, + POSITRON_LONG_VERSION: `${positron.version}+${positron.buildNumber}`, + POSITRON_UI_KIND: vscode.env.uiKind === vscode.UIKind.Desktop ? 'desktop' : 'web', + }; Object.assign(env, process.env, this._spec.env); // We are now starting the kernel From 70bed381c7bb389baa88a133c144f9ff933b83a8 Mon Sep 17 00:00:00 2001 From: Julia Silge Date: Tue, 17 Sep 2024 16:00:41 -0600 Subject: [PATCH 2/7] Change name of env var to `POSITRON_MODE` --- extensions/jupyter-adapter/src/JupyterKernel.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/jupyter-adapter/src/JupyterKernel.ts b/extensions/jupyter-adapter/src/JupyterKernel.ts index b8acc40f971..c7e2f108fe7 100644 --- a/extensions/jupyter-adapter/src/JupyterKernel.ts +++ b/extensions/jupyter-adapter/src/JupyterKernel.ts @@ -730,7 +730,7 @@ export class JupyterKernel extends EventEmitter implements vscode.Disposable { POSITRON: '1', POSITRON_VERSION: positron.version, POSITRON_LONG_VERSION: `${positron.version}+${positron.buildNumber}`, - POSITRON_UI_KIND: vscode.env.uiKind === vscode.UIKind.Desktop ? 'desktop' : 'web', + POSITRON_MODE: vscode.env.uiKind === vscode.UIKind.Desktop ? 'desktop' : 'web', }; Object.assign(env, process.env, this._spec.env); From 7928ee12c2e20eb1aa4b9d599a45008f66bcb42d Mon Sep 17 00:00:00 2001 From: Julia Silge Date: Tue, 17 Sep 2024 16:01:08 -0600 Subject: [PATCH 3/7] Add env vars to terminals (as well as consoles) --- src/vs/platform/terminal/node/terminalEnvironment.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/vs/platform/terminal/node/terminalEnvironment.ts b/src/vs/platform/terminal/node/terminalEnvironment.ts index 66f1d0b39ef..07d4a3c564d 100644 --- a/src/vs/platform/terminal/node/terminalEnvironment.ts +++ b/src/vs/platform/terminal/node/terminalEnvironment.ts @@ -19,6 +19,11 @@ import { EnvironmentVariableMutatorType } from 'vs/platform/terminal/common/envi import { deserializeEnvironmentVariableCollections } from 'vs/platform/terminal/common/environmentVariableShared'; import { MergedEnvironmentVariableCollection } from 'vs/platform/terminal/common/environmentVariableCollection'; +// --- Start Positron --- +// eslint-disable-next-line no-duplicate-imports +import { isWeb } from 'vs/base/common/platform'; +// --- End Positron --- + export function getWindowsBuildNumber(): number { const osVersion = (/(\d+)\.(\d+)\.(\d+)/g).exec(os.release()); let buildNumber: number = 0; @@ -140,7 +145,10 @@ export function getShellIntegrationInjection( // --- Start Positron --- // 'VSCODE_INJECTION': '1' 'VSCODE_INJECTION': '1', - 'POSITRON': '1' + 'POSITRON': '1', + 'POSITRON_VERSION': productService.positronVersion, + 'POSITRON_LONG_VERSION': `${productService.positronVersion}+${productService.positronBuildNumber}`, + 'POSITRON_MODE': isWeb ? 'web' : 'desktop' // --- End Positron --- }; From 0a5684917b080136874b081230b9e0a75017d271 Mon Sep 17 00:00:00 2001 From: Julia Silge Date: Tue, 17 Sep 2024 16:10:05 -0600 Subject: [PATCH 4/7] Update terminal tests --- .../test/node/terminalEnvironment.test.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/vs/platform/terminal/test/node/terminalEnvironment.test.ts b/src/vs/platform/terminal/test/node/terminalEnvironment.test.ts index 5ef7ee9ce94..56eb068225e 100644 --- a/src/vs/platform/terminal/test/node/terminalEnvironment.test.ts +++ b/src/vs/platform/terminal/test/node/terminalEnvironment.test.ts @@ -12,6 +12,11 @@ import { IProductService } from 'vs/platform/product/common/productService'; import { ITerminalProcessOptions } from 'vs/platform/terminal/common/terminal'; import { getShellIntegrationInjection, getWindowsBuildNumber, IShellIntegrationConfigInjection } from 'vs/platform/terminal/node/terminalEnvironment'; +// --- Start Positron --- +// eslint-disable-next-line no-duplicate-imports +import { isWeb } from 'vs/base/common/platform'; +// --- End Positron --- + const enabledProcessOptions: ITerminalProcessOptions = { shellIntegration: { enabled: true, suggestEnabled: false, nonce: '' }, windowsEnableConpty: true, environmentVariableCollections: undefined, workspaceFolder: undefined }; const disabledProcessOptions: ITerminalProcessOptions = { shellIntegration: { enabled: false, suggestEnabled: false, nonce: '' }, windowsEnableConpty: true, environmentVariableCollections: undefined, workspaceFolder: undefined }; const winptyProcessOptions: ITerminalProcessOptions = { shellIntegration: { enabled: true, suggestEnabled: false, nonce: '' }, windowsEnableConpty: false, environmentVariableCollections: undefined, workspaceFolder: undefined }; @@ -52,6 +57,9 @@ suite('platform - terminalEnvironment', () => { envMixin: { // --- Start Positron --- POSITRON: '1', + POSITRON_VERSION: productService.positronVersion, + POSITRON_LONG_VERSION: `${productService.positronVersion}+${productService.positronBuildNumber}`, + POSITRON_MODE: isWeb ? 'web' : 'desktop', // --- End Positron --- VSCODE_INJECTION: '1' } @@ -86,6 +94,9 @@ suite('platform - terminalEnvironment', () => { envMixin: { // --- Start Positron --- POSITRON: '1', + POSITRON_VERSION: productService.positronVersion, + POSITRON_LONG_VERSION: `${productService.positronVersion}+${productService.positronBuildNumber}`, + POSITRON_MODE: isWeb ? 'web' : 'desktop', // --- End Positron --- VSCODE_INJECTION: '1' } @@ -133,7 +144,7 @@ suite('platform - terminalEnvironment', () => { function assertIsEnabled(result: IShellIntegrationConfigInjection, globalZdotdir = homedir()) { // --- Start Positron --- // strictEqual(Object.keys(result.envMixin!).length, 3); - strictEqual(Object.keys(result.envMixin!).length, 4); + strictEqual(Object.keys(result.envMixin!).length, 7); // --- End Positron --- ok(result.envMixin!['ZDOTDIR']?.match(expectedDir)); strictEqual(result.envMixin!['USER_ZDOTDIR'], globalZdotdir); @@ -200,6 +211,9 @@ suite('platform - terminalEnvironment', () => { envMixin: { // --- Start Positron --- POSITRON: '1', + POSITRON_VERSION: productService.positronVersion, + POSITRON_LONG_VERSION: `${productService.positronVersion}+${productService.positronBuildNumber}`, + POSITRON_MODE: isWeb ? 'web' : 'desktop', // --- End Positron --- VSCODE_INJECTION: '1', VSCODE_STABLE: '0' @@ -218,6 +232,9 @@ suite('platform - terminalEnvironment', () => { envMixin: { // --- Start Positron --- POSITRON: '1', + POSITRON_VERSION: productService.positronVersion, + POSITRON_LONG_VERSION: `${productService.positronVersion}+${productService.positronBuildNumber}`, + POSITRON_MODE: isWeb ? 'web' : 'desktop', // --- End Positron --- VSCODE_INJECTION: '1', VSCODE_SHELL_LOGIN: '1', From cf5bafbfbe0e39720bade57d0200c40d82319f28 Mon Sep 17 00:00:00 2001 From: Julia Silge Date: Wed, 18 Sep 2024 19:19:36 -0600 Subject: [PATCH 5/7] `POSITRON_MODE` is going to be "server" for consistency with RStudio --- extensions/jupyter-adapter/src/JupyterKernel.ts | 2 +- src/vs/platform/terminal/node/terminalEnvironment.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/jupyter-adapter/src/JupyterKernel.ts b/extensions/jupyter-adapter/src/JupyterKernel.ts index c7e2f108fe7..9b3b1c27402 100644 --- a/extensions/jupyter-adapter/src/JupyterKernel.ts +++ b/extensions/jupyter-adapter/src/JupyterKernel.ts @@ -730,7 +730,7 @@ export class JupyterKernel extends EventEmitter implements vscode.Disposable { POSITRON: '1', POSITRON_VERSION: positron.version, POSITRON_LONG_VERSION: `${positron.version}+${positron.buildNumber}`, - POSITRON_MODE: vscode.env.uiKind === vscode.UIKind.Desktop ? 'desktop' : 'web', + POSITRON_MODE: vscode.env.uiKind === vscode.UIKind.Desktop ? 'desktop' : 'server', }; Object.assign(env, process.env, this._spec.env); diff --git a/src/vs/platform/terminal/node/terminalEnvironment.ts b/src/vs/platform/terminal/node/terminalEnvironment.ts index 07d4a3c564d..2ee228f5f1f 100644 --- a/src/vs/platform/terminal/node/terminalEnvironment.ts +++ b/src/vs/platform/terminal/node/terminalEnvironment.ts @@ -148,7 +148,7 @@ export function getShellIntegrationInjection( 'POSITRON': '1', 'POSITRON_VERSION': productService.positronVersion, 'POSITRON_LONG_VERSION': `${productService.positronVersion}+${productService.positronBuildNumber}`, - 'POSITRON_MODE': isWeb ? 'web' : 'desktop' + 'POSITRON_MODE': isWeb ? 'server' : 'desktop' // --- End Positron --- }; From 01cf6cb83b8821e3432c31a7823335faa21d4f63 Mon Sep 17 00:00:00 2001 From: Julia Silge Date: Thu, 19 Sep 2024 09:39:52 -0600 Subject: [PATCH 6/7] Bump ark to v0.1.138 --- extensions/positron-r/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/positron-r/package.json b/extensions/positron-r/package.json index f84e374c87e..cc5d421c57f 100644 --- a/extensions/positron-r/package.json +++ b/extensions/positron-r/package.json @@ -634,7 +634,7 @@ }, "positron": { "binaryDependencies": { - "ark": "0.1.136" + "ark": "0.1.138" }, "minimumRVersion": "4.2.0", "minimumRenvVersion": "1.0.7" From df2612c928ed6f42152a0ef6f8f4dacd0b0b795d Mon Sep 17 00:00:00 2001 From: Julia Silge Date: Thu, 19 Sep 2024 10:37:25 -0600 Subject: [PATCH 7/7] Update `POSITRON_MODE` value in tests --- .../terminal/test/node/terminalEnvironment.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vs/platform/terminal/test/node/terminalEnvironment.test.ts b/src/vs/platform/terminal/test/node/terminalEnvironment.test.ts index 165a7a083d4..dc741d966cc 100644 --- a/src/vs/platform/terminal/test/node/terminalEnvironment.test.ts +++ b/src/vs/platform/terminal/test/node/terminalEnvironment.test.ts @@ -59,7 +59,7 @@ suite('platform - terminalEnvironment', () => { POSITRON: '1', POSITRON_VERSION: productService.positronVersion, POSITRON_LONG_VERSION: `${productService.positronVersion}+${productService.positronBuildNumber}`, - POSITRON_MODE: isWeb ? 'web' : 'desktop', + POSITRON_MODE: isWeb ? 'server' : 'desktop', // --- End Positron --- VSCODE_INJECTION: '1' } @@ -96,7 +96,7 @@ suite('platform - terminalEnvironment', () => { POSITRON: '1', POSITRON_VERSION: productService.positronVersion, POSITRON_LONG_VERSION: `${productService.positronVersion}+${productService.positronBuildNumber}`, - POSITRON_MODE: isWeb ? 'web' : 'desktop', + POSITRON_MODE: isWeb ? 'server' : 'desktop', // --- End Positron --- VSCODE_INJECTION: '1' } @@ -213,7 +213,7 @@ suite('platform - terminalEnvironment', () => { POSITRON: '1', POSITRON_VERSION: productService.positronVersion, POSITRON_LONG_VERSION: `${productService.positronVersion}+${productService.positronBuildNumber}`, - POSITRON_MODE: isWeb ? 'web' : 'desktop', + POSITRON_MODE: isWeb ? 'server' : 'desktop', // --- End Positron --- VSCODE_INJECTION: '1', VSCODE_STABLE: '0' @@ -234,7 +234,7 @@ suite('platform - terminalEnvironment', () => { POSITRON: '1', POSITRON_VERSION: productService.positronVersion, POSITRON_LONG_VERSION: `${productService.positronVersion}+${productService.positronBuildNumber}`, - POSITRON_MODE: isWeb ? 'web' : 'desktop', + POSITRON_MODE: isWeb ? 'server' : 'desktop', // --- End Positron --- VSCODE_INJECTION: '1', VSCODE_SHELL_LOGIN: '1',