-
Notifications
You must be signed in to change notification settings - Fork 4
feat: Add a command for adding chart blocks #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughThis PR adds a new Deepnote command Sequence Diagram(s)sequenceDiagram
participant User
participant VSCode as "VS Code (Palette / Toolbar)"
participant Listener as "DeepnoteNotebookCommandListener"
participant VarGen as "getNextDeepnoteVariableName(prefix: chart)"
participant Notebook as "Notebook API"
rect rgba(200,240,255,0.4)
User->>VSCode: Trigger `deepnote.addChartBlock`
VSCode->>Listener: execute addChartBlock()
end
rect rgba(230,255,220,0.4)
Listener->>VarGen: request next variable name
VarGen-->>Listener: returns variable name (e.g., chart_1)
Listener->>Notebook: chainWithPendingUpdates -> insert chart cell (Vega‑Lite JSON, variable, metadata) at index
Notebook-->>Listener: insertion confirmed
Listener->>Notebook: revealRange & execute edit command
Notebook-->>Listener: cell revealed & edit mode active
end
Possibly related PRs
Suggested reviewers
Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (5)**/!(*.node|*.web).ts📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
src/notebooks/deepnote/**📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.unit.test.ts📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.{test,spec}.ts📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)
Files:
🧠 Learnings (2)📚 Learning: 2025-10-30T12:09:07.473ZApplied to files:
📚 Learning: 2025-10-30T12:27:22.797ZApplied to files:
🧬 Code graph analysis (2)src/notebooks/deepnote/deepnoteNotebookCommandListener.ts (3)
src/notebooks/deepnote/deepnoteNotebookCommandListener.unit.test.ts (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (3)
Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #137 +/- ##
======================================
Coverage 72% 72%
======================================
Files 541 541
Lines 41483 41595 +112
Branches 5027 5031 +4
======================================
+ Hits 30211 30322 +111
Misses 9593 9593
- Partials 1679 1680 +1
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (6)
package.json(2 hunks)package.nls.json(1 hunks)src/commands.ts(1 hunks)src/notebooks/deepnote/deepnoteNotebookCommandListener.ts(3 hunks)src/notebooks/deepnote/deepnoteNotebookCommandListener.unit.test.ts(2 hunks)src/platform/common/constants.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/!(*.node|*.web).ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Place shared cross-platform logic in common
.tsfiles (not suffixed with.nodeor.web)
Files:
src/platform/common/constants.tssrc/notebooks/deepnote/deepnoteNotebookCommandListener.unit.test.tssrc/notebooks/deepnote/deepnoteNotebookCommandListener.tssrc/commands.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx}: Inject interfaces, not concrete classes
Avoid circular dependencies
Usel10n.t()for user-facing strings
Use typed error classes fromsrc/platform/errors/when throwing or handling errors
Use theILoggerservice instead ofconsole.log
Preserve error details while scrubbing PII in messages and telemetry
Include the Microsoft copyright header in source files
Prefer async/await and handle cancellation withCancellationToken
**/*.{ts,tsx}: Order class members (methods, fields, properties) first by accessibility (public/protected/private) and then alphabetically
Do not add the Microsoft copyright header to new files
Use Uri.joinPath() to construct file paths instead of manual string concatenation
Add a blank line after groups of const declarations and before return statements for readability
Separate third-party imports from local file imports
Files:
src/platform/common/constants.tssrc/notebooks/deepnote/deepnoteNotebookCommandListener.unit.test.tssrc/notebooks/deepnote/deepnoteNotebookCommandListener.tssrc/commands.ts
src/platform/**/*.ts
📄 CodeRabbit inference engine (.github/instructions/platform.instructions.md)
src/platform/**/*.ts: Use Inversify decorators for DI: annotate classes with @Injectable() and inject dependencies with @Inject(Token)
Use the centralized logger (import { logger } from '../platform/logging') instead of console.log for application logging
Files:
src/platform/common/constants.ts
**/*.unit.test.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Place unit tests in files matching
*.unit.test.ts
**/*.unit.test.ts: Unit tests must use Mocha/Chai and have the .unit.test.ts extension
Place unit test files alongside the source files they test
Use assert.deepStrictEqual() for object comparisons in tests instead of checking individual properties
Files:
src/notebooks/deepnote/deepnoteNotebookCommandListener.unit.test.ts
**/*.{test,spec}.ts
📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)
In unit tests, when a mock is returned from a promise, ensure the mocked instance has an undefined
thenproperty to avoid hanging tests
Files:
src/notebooks/deepnote/deepnoteNotebookCommandListener.unit.test.ts
src/notebooks/deepnote/**
📄 CodeRabbit inference engine (CLAUDE.md)
Deepnote integration code resides under src/notebooks/deepnote/
Files:
src/notebooks/deepnote/deepnoteNotebookCommandListener.unit.test.tssrc/notebooks/deepnote/deepnoteNotebookCommandListener.ts
🧬 Code graph analysis (2)
src/notebooks/deepnote/deepnoteNotebookCommandListener.unit.test.ts (1)
src/test/mocks/vsc/extHostedTypes.ts (1)
NotebookRange(2436-2466)
src/notebooks/deepnote/deepnoteNotebookCommandListener.ts (3)
src/test/mocks/vsc/extHostedTypes.ts (4)
error(30-37)NotebookCellData(2546-2572)NotebookEdit(2467-2530)NotebookRange(2436-2466)src/platform/logging/index.ts (1)
logger(35-48)src/kernels/execution/notebookUpdater.ts (1)
chainWithPendingUpdates(24-52)
🔇 Additional comments (1)
src/notebooks/deepnote/deepnoteNotebookCommandListener.unit.test.ts (1)
979-1159: Comprehensive test suite with good coverage.The test suite thoroughly validates chart block insertion:
- Full structure validation including Vega-Lite spec (lines 1009-1025)
- Variable name generation considering both
variableanddeepnote_variable_namekeys (lines 1067-1086, 1088-1108)- Position handling and error cases
Minor suggestion: Line 1107's comment "Should consider all df variables" could clarify it uses the highest df_ number (df_5 → df_6).
src/notebooks/deepnote/deepnoteNotebookCommandListener.unit.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
src/notebooks/deepnote/deepnoteNotebookCommandListener.ts(3 hunks)src/notebooks/deepnote/deepnoteNotebookCommandListener.unit.test.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/!(*.node|*.web).ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Place shared cross-platform logic in common
.tsfiles (not suffixed with.nodeor.web)
Files:
src/notebooks/deepnote/deepnoteNotebookCommandListener.unit.test.tssrc/notebooks/deepnote/deepnoteNotebookCommandListener.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx}: Inject interfaces, not concrete classes
Avoid circular dependencies
Usel10n.t()for user-facing strings
Use typed error classes fromsrc/platform/errors/when throwing or handling errors
Use theILoggerservice instead ofconsole.log
Preserve error details while scrubbing PII in messages and telemetry
Include the Microsoft copyright header in source files
Prefer async/await and handle cancellation withCancellationToken
**/*.{ts,tsx}: Order class members (methods, fields, properties) first by accessibility (public/protected/private) and then alphabetically
Do not add the Microsoft copyright header to new files
Use Uri.joinPath() to construct file paths instead of manual string concatenation
Add a blank line after groups of const declarations and before return statements for readability
Separate third-party imports from local file imports
Files:
src/notebooks/deepnote/deepnoteNotebookCommandListener.unit.test.tssrc/notebooks/deepnote/deepnoteNotebookCommandListener.ts
**/*.unit.test.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Place unit tests in files matching
*.unit.test.ts
**/*.unit.test.ts: Unit tests must use Mocha/Chai and have the .unit.test.ts extension
Place unit test files alongside the source files they test
Use assert.deepStrictEqual() for object comparisons in tests instead of checking individual properties
Files:
src/notebooks/deepnote/deepnoteNotebookCommandListener.unit.test.ts
**/*.{test,spec}.ts
📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)
In unit tests, when a mock is returned from a promise, ensure the mocked instance has an undefined
thenproperty to avoid hanging tests
Files:
src/notebooks/deepnote/deepnoteNotebookCommandListener.unit.test.ts
src/notebooks/deepnote/**
📄 CodeRabbit inference engine (CLAUDE.md)
Deepnote integration code resides under src/notebooks/deepnote/
Files:
src/notebooks/deepnote/deepnoteNotebookCommandListener.unit.test.tssrc/notebooks/deepnote/deepnoteNotebookCommandListener.ts
🧠 Learnings (1)
📚 Learning: 2025-10-30T12:09:07.473Z
Learnt from: Artmann
PR: deepnote/vscode-deepnote#137
File: src/notebooks/deepnote/deepnoteNotebookCommandListener.ts:278-305
Timestamp: 2025-10-30T12:09:07.473Z
Learning: In `src/notebooks/deepnote/deepnoteNotebookCommandListener.ts`, chart blocks created by `addChartBlock()` should use the 'df' prefix when calling `getNextDeepnoteVariableName()`, not the 'chart' prefix, even though 'chart' is available as an option in the function signature.
Applied to files:
src/notebooks/deepnote/deepnoteNotebookCommandListener.unit.test.tssrc/notebooks/deepnote/deepnoteNotebookCommandListener.ts
🧬 Code graph analysis (2)
src/notebooks/deepnote/deepnoteNotebookCommandListener.unit.test.ts (1)
src/test/mocks/vsc/extHostedTypes.ts (1)
NotebookRange(2436-2466)
src/notebooks/deepnote/deepnoteNotebookCommandListener.ts (2)
src/kernels/execution/notebookUpdater.ts (1)
chainWithPendingUpdates(24-52)src/test/mocks/vsc/extHostedTypes.ts (3)
NotebookCellData(2546-2572)NotebookEdit(2467-2530)NotebookRange(2436-2466)
🔇 Additional comments (2)
src/notebooks/deepnote/deepnoteNotebookCommandListener.ts (2)
78-81: LGTM—correctly handles both chart and non-chart variable names.The nullish coalescing supports chart blocks'
variablekey while maintaining backward compatibility withdeepnote_variable_name.
153-153: LGTM—command registration follows the established pattern.
Resolved conflict in deepnoteNotebookCommandListener.unit.test.ts by keeping both imports: - WrappedError from platform/errors/types (for chart block tests) - DATAFRAME_SQL_INTEGRATION_ID from platform/notebooks/deepnote/integrationTypes (from main)
* feat: Add a command for adding chart blocks. * hardcode the variable name * better errrors
Summary by CodeRabbit
New Features
Updates