Skip to content

Commit 727f55c

Browse files
authored
Merge branch 'main' into jk/feat/input-block-ux
2 parents 18382fc + a9a786b commit 727f55c

23 files changed

+1175
-41
lines changed

package.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@
7070
"key": "escape",
7171
"when": "isCompositeNotebook && !editorHoverVisible && !suggestWidgetVisible && !isComposing && !inSnippetMode && !exceptionWidgetVisible && !selectionAnchorSet && !LinkedEditingInputVisible && !renameInputVisible && !editorHasSelection && !accessibilityHelpWidgetVisible && !breakpointWidgetVisible && !findWidgetVisible && !markersNavigationVisible && !parameterHintsVisible && !editorHasMultipleSelections && !notificationToastsVisible && !notebookEditorFocused && !inlineChatVisible",
7272
"command": "interactive.input.clear"
73+
},
74+
{
75+
"key": "cmd+enter",
76+
"mac": "cmd+enter",
77+
"win": "ctrl+enter",
78+
"linux": "ctrl+enter",
79+
"when": "notebookEditorFocused && !findInputFocussed && !replaceInputFocussed",
80+
"command": "jupyter.notebookeditor.runfocusedcell"
7381
}
7482
],
7583
"commands": [
@@ -544,6 +552,12 @@
544552
"category": "Notebook",
545553
"enablement": "!jupyter.webExtension"
546554
},
555+
{
556+
"command": "jupyter.notebookeditor.runfocusedcell",
557+
"title": "%jupyter.command.jupyter.notebookeditor.runfocusedcell.title%",
558+
"category": "Notebook",
559+
"enablement": "notebookEditorFocused"
560+
},
547561
{
548562
"command": "jupyter.expandallcells",
549563
"title": "%jupyter.command.jupyter.expandallcells.title%",
@@ -714,9 +728,30 @@
714728
{
715729
"id": "editor.interactiveWindow.context",
716730
"label": "%jupyter.command.editor.interactiveWindow.context.label%"
731+
},
732+
{
733+
"id": "deepnote.explorer.context",
734+
"label": "Deepnote"
717735
}
718736
],
719737
"menus": {
738+
"view/title": [
739+
{
740+
"command": "deepnote.newProject",
741+
"when": "view == deepnoteExplorer",
742+
"group": "navigation@1"
743+
},
744+
{
745+
"command": "deepnote.importNotebook",
746+
"when": "view == deepnoteExplorer",
747+
"group": "navigation@2"
748+
},
749+
{
750+
"command": "deepnote.refreshExplorer",
751+
"when": "view == deepnoteExplorer",
752+
"group": "navigation@3"
753+
}
754+
],
720755
"editor/context": [
721756
{
722757
"submenu": "editor.interactiveWindow.context",
@@ -765,6 +800,14 @@
765800
"when": "editorFocus && editorLangId == python && !notebookEditorFocused && isWorkspaceTrusted"
766801
}
767802
],
803+
"deepnote.explorer.context": [
804+
{
805+
"command": "deepnote.newProject"
806+
},
807+
{
808+
"command": "deepnote.importNotebook"
809+
}
810+
],
768811
"editor/title": [
769812
{
770813
"command": "jupyter.restartkernel",
@@ -937,6 +980,11 @@
937980
}
938981
],
939982
"explorer/context": [
983+
{
984+
"submenu": "deepnote.explorer.context",
985+
"when": "isWorkspaceTrusted",
986+
"group": "navigation@10"
987+
},
940988
{
941989
"when": "resourceLangId == python && !notebookEditorFocused && isWorkspaceTrusted",
942990
"command": "jupyter.runFileInteractive",

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
"message": "Add Empty Cell to Notebook File",
9393
"comment": ["{Locked='Notebook'}"]
9494
},
95+
"jupyter.command.jupyter.notebookeditor.runfocusedcell.title": "Run Focused Cell",
9596
"jupyter.command.jupyter.interruptkernel.title": "Interrupt Kernel",
9697
"jupyter.command.jupyter.interruptkernel.shorttitle": "Interrupt",
9798
"jupyter.command.jupyter.restartkernel.title": "Restart Kernel",

src/commands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export interface ICommandNameArgumentTypeMapping {
5858
[DSCommands.RestartKernelAndRunUpToSelectedCell]: [{ notebookEditor: { notebookUri: Uri } } | undefined];
5959
[DSCommands.NotebookEditorRemoveAllCells]: [];
6060
[DSCommands.NotebookEditorRunAllCells]: [];
61+
[DSCommands.NotebookEditorRunFocusedCell]: [];
6162
[DSCommands.NotebookEditorAddCellBelow]: [];
6263
[DSCommands.ExpandAllCells]: [];
6364
[DSCommands.CollapseAllCells]: [];

src/messageTypes.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ export type LocalizedMessages = {
182182
// Integration type labels
183183
integrationsPostgresTypeLabel: string;
184184
integrationsBigQueryTypeLabel: string;
185+
integrationsSnowflakeTypeLabel: string;
185186
// PostgreSQL form strings
186187
integrationsPostgresNameLabel: string;
187188
integrationsPostgresNamePlaceholder: string;
@@ -204,9 +205,36 @@ export type LocalizedMessages = {
204205
integrationsBigQueryCredentialsLabel: string;
205206
integrationsBigQueryCredentialsPlaceholder: string;
206207
integrationsBigQueryCredentialsRequired: string;
208+
// Snowflake form strings
209+
integrationsSnowflakeNameLabel: string;
210+
integrationsSnowflakeNamePlaceholder: string;
211+
integrationsSnowflakeAccountLabel: string;
212+
integrationsSnowflakeAccountPlaceholder: string;
213+
integrationsSnowflakeAuthMethodLabel: string;
214+
integrationsSnowflakeAuthMethodSubLabel: string;
215+
integrationsSnowflakeAuthMethodUsernamePassword: string;
216+
integrationsSnowflakeAuthMethodKeyPair: string;
217+
integrationsSnowflakeUnsupportedAuthMethod: string;
218+
integrationsSnowflakeUsernameLabel: string;
219+
integrationsSnowflakePasswordLabel: string;
220+
integrationsSnowflakePasswordPlaceholder: string;
221+
integrationsSnowflakeServiceAccountUsernameLabel: string;
222+
integrationsSnowflakeServiceAccountUsernameHelp: string;
223+
integrationsSnowflakePrivateKeyLabel: string;
224+
integrationsSnowflakePrivateKeyHelp: string;
225+
integrationsSnowflakePrivateKeyPlaceholder: string;
226+
integrationsSnowflakePrivateKeyPassphraseLabel: string;
227+
integrationsSnowflakePrivateKeyPassphraseHelp: string;
228+
integrationsSnowflakeDatabaseLabel: string;
229+
integrationsSnowflakeDatabasePlaceholder: string;
230+
integrationsSnowflakeRoleLabel: string;
231+
integrationsSnowflakeRolePlaceholder: string;
232+
integrationsSnowflakeWarehouseLabel: string;
233+
integrationsSnowflakeWarehousePlaceholder: string;
207234
// Common form strings
208235
integrationsRequiredField: string;
209236
integrationsOptionalField: string;
237+
integrationsUnnamedIntegration: string;
210238
// Select input settings strings
211239
selectInputSettingsTitle: string;
212240
allowMultipleValues: string;

src/notebooks/deepnote/integrations/integrationManager.ts

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@ import { IExtensionContext } from '../../../platform/common/types';
55
import { Commands } from '../../../platform/common/constants';
66
import { logger } from '../../../platform/logging';
77
import { IIntegrationDetector, IIntegrationManager, IIntegrationStorage, IIntegrationWebviewProvider } from './types';
8-
import { IntegrationStatus, IntegrationWithStatus } from '../../../platform/notebooks/deepnote/integrationTypes';
8+
import {
9+
DEEPNOTE_TO_INTEGRATION_TYPE,
10+
IntegrationStatus,
11+
IntegrationType,
12+
IntegrationWithStatus,
13+
RawIntegrationType
14+
} from '../../../platform/notebooks/deepnote/integrationTypes';
915
import { BlockWithIntegration, scanBlocksForIntegrations } from './integrationUtils';
16+
import { IDeepnoteNotebookManager } from '../../types';
1017

1118
/**
1219
* Manages integration UI and commands for Deepnote notebooks
@@ -21,7 +28,8 @@ export class IntegrationManager implements IIntegrationManager {
2128
@inject(IExtensionContext) private readonly extensionContext: IExtensionContext,
2229
@inject(IIntegrationDetector) private readonly integrationDetector: IIntegrationDetector,
2330
@inject(IIntegrationStorage) private readonly integrationStorage: IIntegrationStorage,
24-
@inject(IIntegrationWebviewProvider) private readonly webviewProvider: IIntegrationWebviewProvider
31+
@inject(IIntegrationWebviewProvider) private readonly webviewProvider: IIntegrationWebviewProvider,
32+
@inject(IDeepnoteNotebookManager) private readonly notebookManager: IDeepnoteNotebookManager
2533
) {}
2634

2735
public activate(): void {
@@ -150,9 +158,33 @@ export class IntegrationManager implements IIntegrationManager {
150158
if (selectedIntegrationId && !integrations.has(selectedIntegrationId)) {
151159
logger.debug(`IntegrationManager: Adding requested integration ${selectedIntegrationId} to the map`);
152160
const config = await this.integrationStorage.getIntegrationConfig(selectedIntegrationId);
161+
162+
// Try to get integration metadata from the project
163+
const project = this.notebookManager.getOriginalProject(projectId);
164+
const projectIntegration = project?.project.integrations?.find((i) => i.id === selectedIntegrationId);
165+
166+
let integrationName: string | undefined;
167+
let integrationType: IntegrationType | undefined;
168+
169+
if (projectIntegration) {
170+
integrationName = projectIntegration.name;
171+
172+
// Validate that projectIntegration.type exists in the mapping before lookup
173+
if (projectIntegration.type in DEEPNOTE_TO_INTEGRATION_TYPE) {
174+
// Map the Deepnote integration type to our IntegrationType
175+
integrationType = DEEPNOTE_TO_INTEGRATION_TYPE[projectIntegration.type as RawIntegrationType];
176+
} else {
177+
logger.warn(
178+
`IntegrationManager: Unknown integration type '${projectIntegration.type}' for integration ID '${selectedIntegrationId}' in project '${projectId}'. Integration type will be undefined.`
179+
);
180+
}
181+
}
182+
153183
integrations.set(selectedIntegrationId, {
154184
config: config || null,
155-
status: config ? IntegrationStatus.Connected : IntegrationStatus.Disconnected
185+
status: config ? IntegrationStatus.Connected : IntegrationStatus.Disconnected,
186+
integrationName,
187+
integrationType
156188
});
157189
}
158190

src/notebooks/deepnote/integrations/integrationWebview.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
131131
integrationsConfigureTitle: localize.Integrations.configureTitle,
132132
integrationsPostgresTypeLabel: localize.Integrations.postgresTypeLabel,
133133
integrationsBigQueryTypeLabel: localize.Integrations.bigQueryTypeLabel,
134+
integrationsSnowflakeTypeLabel: localize.Integrations.snowflakeTypeLabel,
134135
integrationsCancel: localize.Integrations.cancel,
135136
integrationsSave: localize.Integrations.save,
136137
integrationsRequiredField: localize.Integrations.requiredField,
@@ -154,7 +155,34 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
154155
integrationsBigQueryProjectIdPlaceholder: localize.Integrations.bigQueryProjectIdPlaceholder,
155156
integrationsBigQueryCredentialsLabel: localize.Integrations.bigQueryCredentialsLabel,
156157
integrationsBigQueryCredentialsPlaceholder: localize.Integrations.bigQueryCredentialsPlaceholder,
157-
integrationsBigQueryCredentialsRequired: localize.Integrations.bigQueryCredentialsRequired
158+
integrationsBigQueryCredentialsRequired: localize.Integrations.bigQueryCredentialsRequired,
159+
integrationsSnowflakeNameLabel: localize.Integrations.snowflakeNameLabel,
160+
integrationsSnowflakeNamePlaceholder: localize.Integrations.snowflakeNamePlaceholder,
161+
integrationsSnowflakeAccountLabel: localize.Integrations.snowflakeAccountLabel,
162+
integrationsSnowflakeAccountPlaceholder: localize.Integrations.snowflakeAccountPlaceholder,
163+
integrationsSnowflakeAuthMethodLabel: localize.Integrations.snowflakeAuthMethodLabel,
164+
integrationsSnowflakeAuthMethodSubLabel: localize.Integrations.snowflakeAuthMethodSubLabel,
165+
integrationsSnowflakeAuthMethodUsernamePassword: localize.Integrations.snowflakeAuthMethodUsernamePassword,
166+
integrationsSnowflakeAuthMethodKeyPair: localize.Integrations.snowflakeAuthMethodKeyPair,
167+
integrationsSnowflakeUnsupportedAuthMethod: localize.Integrations.snowflakeUnsupportedAuthMethod,
168+
integrationsSnowflakeUsernameLabel: localize.Integrations.snowflakeUsernameLabel,
169+
integrationsSnowflakePasswordLabel: localize.Integrations.snowflakePasswordLabel,
170+
integrationsSnowflakePasswordPlaceholder: localize.Integrations.snowflakePasswordPlaceholder,
171+
integrationsSnowflakeServiceAccountUsernameLabel:
172+
localize.Integrations.snowflakeServiceAccountUsernameLabel,
173+
integrationsSnowflakeServiceAccountUsernameHelp: localize.Integrations.snowflakeServiceAccountUsernameHelp,
174+
integrationsSnowflakePrivateKeyLabel: localize.Integrations.snowflakePrivateKeyLabel,
175+
integrationsSnowflakePrivateKeyHelp: localize.Integrations.snowflakePrivateKeyHelp,
176+
integrationsSnowflakePrivateKeyPlaceholder: localize.Integrations.snowflakePrivateKeyPlaceholder,
177+
integrationsSnowflakePrivateKeyPassphraseLabel: localize.Integrations.snowflakePrivateKeyPassphraseLabel,
178+
integrationsSnowflakePrivateKeyPassphraseHelp: localize.Integrations.snowflakePrivateKeyPassphraseHelp,
179+
integrationsSnowflakeDatabaseLabel: localize.Integrations.snowflakeDatabaseLabel,
180+
integrationsSnowflakeDatabasePlaceholder: localize.Integrations.snowflakeDatabasePlaceholder,
181+
integrationsSnowflakeRoleLabel: localize.Integrations.snowflakeRoleLabel,
182+
integrationsSnowflakeRolePlaceholder: localize.Integrations.snowflakeRolePlaceholder,
183+
integrationsSnowflakeWarehouseLabel: localize.Integrations.snowflakeWarehouseLabel,
184+
integrationsSnowflakeWarehousePlaceholder: localize.Integrations.snowflakeWarehousePlaceholder,
185+
integrationsUnnamedIntegration: localize.Integrations.unnamedIntegration('{0}')
158186
};
159187

160188
await this.currentPanel.webview.postMessage({

src/notebooks/deepnote/sqlCellStatusBarProvider.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,8 @@ export class SqlCellStatusBarProvider implements NotebookCellStatusBarItemProvid
437437
return l10n.t('PostgreSQL');
438438
case IntegrationType.BigQuery:
439439
return l10n.t('BigQuery');
440+
case IntegrationType.Snowflake:
441+
return l10n.t('Snowflake');
440442
default:
441443
return String(type);
442444
}

src/notebooks/notebookCommandListener.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ export class NotebookCommandListener implements INotebookCommandHandler, IExtens
6868
this.disposableRegistry.push(
6969
commands.registerCommand(Commands.NotebookEditorRunAllCells, () => this.runAllCells())
7070
);
71+
this.disposableRegistry.push(
72+
commands.registerCommand(Commands.NotebookEditorRunFocusedCell, () => this.runFocusedCell())
73+
);
7174
this.disposableRegistry.push(
7275
commands.registerCommand(Commands.NotebookEditorAddCellBelow, () => this.addCellBelow())
7376
);
@@ -115,6 +118,27 @@ export class NotebookCommandListener implements INotebookCommandHandler, IExtens
115118
}
116119
}
117120

121+
private runFocusedCell() {
122+
const editor = window.activeNotebookEditor;
123+
if (!editor) {
124+
return;
125+
}
126+
127+
// Get the first selection range
128+
const range = editor.selections[0];
129+
if (!range) {
130+
return;
131+
}
132+
133+
// Execute the cell at the start of the selection
134+
commands
135+
.executeCommand('notebook.cell.execute', {
136+
ranges: [{ start: range.start, end: range.start + 1 }],
137+
document: editor.notebook.uri
138+
})
139+
.then(noop, noop);
140+
}
141+
118142
private addCellBelow() {
119143
if (window.activeNotebookEditor) {
120144
commands.executeCommand('notebook.cell.insertCodeCellBelow').then(noop, noop);

src/platform/common/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ export namespace Commands {
189189
export const NotebookEditorRemoveAllCells = 'jupyter.notebookeditor.removeallcells';
190190
export const NotebookEditorRunAllCells = 'jupyter.notebookeditor.runallcells';
191191
export const NotebookEditorRunSelectedCell = 'jupyter.notebookeditor.runselectedcell';
192+
export const NotebookEditorRunFocusedCell = 'jupyter.notebookeditor.runfocusedcell';
192193
export const NotebookEditorAddCellBelow = 'jupyter.notebookeditor.addcellbelow';
193194
export const ExpandAllCells = 'jupyter.expandallcells';
194195
export const CollapseAllCells = 'jupyter.collapseallcells';

0 commit comments

Comments
 (0)