Skip to content

Commit 2a8c475

Browse files
add kernel connection sys info string (#10236)
1 parent 348e85a commit 2a8c475

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed

news/2 Fixes/9132.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Have sys info show that we have connected to an existing server.

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@
178178
"DataScience.pythonVersionHeader": "Python version:",
179179
"DataScience.pythonRestartHeader": "Restarted kernel:",
180180
"DataScience.pythonNewHeader": "Started new kernel:",
181+
"DataScience.pythonConnectHeader": "Connected to kernel:",
181182
"DataScience.executingCodeFailure": "Executing code failed : {0}",
182183
"DataScience.inputWatermark": "Type code here and press shift-enter to run",
183184
"DataScience.deleteButtonTooltip": "Remove cell",

src/client/common/utils/localize.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ export namespace DataScience {
409409
export const pythonVersionHeader = localize('DataScience.pythonVersionHeader', 'Python Version:');
410410
export const pythonRestartHeader = localize('DataScience.pythonRestartHeader', 'Restarted Kernel:');
411411
export const pythonNewHeader = localize('DataScience.pythonNewHeader', 'Started new kernel:');
412+
export const pythonConnectHeader = localize('DataScience.pythonConnectHeader', 'Connected to kernel:');
412413

413414
export const jupyterSelectURIPrompt = localize(
414415
'DataScience.jupyterSelectURIPrompt',

src/client/datascience/interactive-common/interactiveBase.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,6 +1361,9 @@ export abstract class InteractiveBase extends WebViewHost<IInteractiveWindowMapp
13611361
case SysInfoReason.New:
13621362
return localize.DataScience.pythonNewHeader();
13631363
break;
1364+
case SysInfoReason.Connect:
1365+
return localize.DataScience.pythonConnectHeader();
1366+
break;
13641367
default:
13651368
traceError('Invalid SysInfoReason');
13661369
return '';
@@ -1479,8 +1482,13 @@ export abstract class InteractiveBase extends WebViewHost<IInteractiveWindowMapp
14791482
}
14801483
await this.commandManager.executeCommand(Commands.SwitchJupyterKernel, this._notebook);
14811484
}
1482-
private async kernelChangeHandler(_kernel: IJupyterKernelSpec | LiveKernelModel) {
1483-
await this.addSysInfo(SysInfoReason.New);
1485+
private async kernelChangeHandler(kernel: IJupyterKernelSpec | LiveKernelModel) {
1486+
// Check if we are changing to LiveKernelModel
1487+
if (kernel.hasOwnProperty('numberOfConnections')) {
1488+
await this.addSysInfo(SysInfoReason.Connect);
1489+
} else {
1490+
await this.addSysInfo(SysInfoReason.New);
1491+
}
14841492
}
14851493

14861494
private openSettings(setting: string | undefined) {

src/client/datascience/interactive-common/interactiveWindowTypes.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ export enum SysInfoReason {
147147
Start,
148148
Restart,
149149
Interrupt,
150-
New
150+
New,
151+
Connect
151152
}
152153

153154
export interface IAddedSysInfo {

0 commit comments

Comments
 (0)