-
Notifications
You must be signed in to change notification settings - Fork 4
feat: Copy and export data frames. #70
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
📝 WalkthroughWalkthroughImplemented a message-driven DataFrame workflow: extension-side DataframeController now routes DataframeCommand messages (copyTable, exportTable, goToPage, selectPageSize) to handlers that extract DataFrameObject from cell outputs, convert to CSV, update cell metadata, persist edits, and re-execute cells as needed. Webview-side DataframeRenderer adds IconButton, UUID-based select IDs, clsx/tailwind-merge for classes, and posts copy/export/select/goToPage messages. Added unit tests for CSV conversion, dataframe extraction, copy/export flows, message routing, and VS Code API interactions. package.json now includes clsx and tailwind-merge. Localization keys for dataframe UI were added. Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant R as DataframeRenderer (Webview)
participant V as VSCode Webview Channel
participant C as DataframeController (Extension)
participant N as VSCode Notebook/Workspace
participant CL as Clipboard
participant FS as FileSystem
participant W as VSCode Window
rect rgba(230, 240, 255, 0.5)
note over R,C: New message-driven actions
U->>R: Click "Copy" or "Export"
R->>V: postMessage {command: copyTable|exportTable, cellId}
V->>C: onDidReceiveMessage(...)
alt copyTable
C->>N: Find cell by cellId / read outputs
C->>C: getDataframeFromDataframeOutput()
C->>C: dataframeToCsv()
C->>CL: writeText(csv)
C->>W: showInformationMessage("Copied")
else exportTable
C->>N: Find cell by cellId / read outputs
C->>C: getDataframeFromDataframeOutput()
C->>C: dataframeToCsv()
C->>W: showSaveDialog()
alt User selects path
C->>FS: writeFile(csv)
C->>W: showInformationMessage("Exported")
else Cancel or no path
C->>C: Abort silently
end
end
end
opt Error paths
C->>W: showErrorMessage(...)
end
sequenceDiagram
autonumber
actor U as User
participant R as DataframeRenderer (Webview)
participant V as VSCode Webview Channel
participant C as DataframeController (Extension)
participant N as VSCode Notebook/Workspace
participant K as Kernel
rect rgba(240, 255, 240, 0.5)
note over R,C: Updated pagination and page size
U->>R: Change page size or navigate page
alt selectPageSize
R->>V: postMessage {command: selectPageSize, cellId, pageSize}
V->>C: onDidReceiveMessage(...)
C->>N: Update cell.metadata.deepnote_table_state.pageSize
C->>N: applyEdit()
C->>K: execute cell
else goToPage
R->>V: postMessage {command: goToPage, cellId, pageIndex}
V->>C: onDidReceiveMessage(...)
C->>N: Update cell.metadata.deepnote_table_state.pageIndex
C->>N: applyEdit()
C->>K: execute cell
end
end
opt Error paths
C->>W: showErrorMessage(...)
end
Suggested reviewers
Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (6)
🧰 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/platform/**/*.ts📄 CodeRabbit inference engine (.github/instructions/platform.instructions.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 (7)📓 Common learnings📚 Learning: 2025-09-03T12:53:28.421ZApplied to files:
📚 Learning: 2025-09-03T14:50:58.575ZApplied to files:
📚 Learning: 2025-10-15T12:48:33.517ZApplied to files:
📚 Learning: 2025-09-03T12:53:28.421ZApplied to files:
📚 Learning: 2025-09-03T12:58:18.091ZApplied to files:
📚 Learning: 2025-09-03T12:54:35.368ZApplied to files:
🧬 Code graph analysis (2)src/webviews/webview-side/dataframe-renderer/DataframeRenderer.tsx (3)
src/webviews/extension-side/dataframe/dataframeController.unit.test.ts (4)
🔇 Additional comments (16)
Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #70 +/- ##
======================================
Coverage 70% 70%
======================================
Files 513 515 +2
Lines 37701 38159 +458
Branches 4822 4854 +32
======================================
+ Hits 26648 27053 +405
- Misses 9456 9501 +45
- Partials 1597 1605 +8
🚀 New features to boost your workflow:
|
bfc7976 to
5da8ac4
Compare
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: 10
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/webviews/webview-side/dataframe-renderer/DataframeRenderer.tsx (2)
64-69: Remove or gate console logs.Avoid console.log in TSX; either use a webview logger or guard behind a dev flag. Noise in production console makes troubleshooting harder.
Also applies to: 87-98, 103-114, 116-136
188-197: Avoid duplicate classes on IconButton.IconButton already sets border/background/size. Drop the repeated className on usage to rely on defaults.
-<IconButton - aria-label="Previous page" - className={` - border border-[var(--vscode-panel-border)] bg-[var(--vscode-button-secondaryBackground)] hover:bg-[var(--vscode-button-secondaryHoverBackground)] - text-[var(--vscode-button-secondaryForeground)] - disabled:opacity-50 disabled:cursor-not-allowed - flex items-center justify-center - h-[20px] w-[20px] - `} +<IconButton + aria-label="Previous page" disabled={pageIndex === 0} title="Previous page" type="button" onClick={() => handlePageChange(pageIndex - 1)} >Also applies to: 207-216
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
package.json(2 hunks)src/webviews/extension-side/dataframe/dataframeController.ts(6 hunks)src/webviews/extension-side/dataframe/dataframeController.unit.test.ts(1 hunks)src/webviews/webview-side/dataframe-renderer/DataframeRenderer.tsx(6 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/!(*.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/webviews/extension-side/dataframe/dataframeController.unit.test.tssrc/webviews/extension-side/dataframe/dataframeController.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/webviews/extension-side/dataframe/dataframeController.unit.test.tssrc/webviews/webview-side/dataframe-renderer/DataframeRenderer.tsxsrc/webviews/extension-side/dataframe/dataframeController.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/webviews/extension-side/dataframe/dataframeController.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/webviews/extension-side/dataframe/dataframeController.unit.test.ts
🧠 Learnings (2)
📚 Learning: 2025-09-03T12:54:35.368Z
Learnt from: CR
PR: deepnote/vscode-extension#0
File: .github/instructions/interactiveWindow.instructions.md:0-0
Timestamp: 2025-09-03T12:54:35.368Z
Learning: Applies to src/interactive-window/**/*.ts : Add unit and integration tests for new features and modifications; include performance and cross-platform test coverage
Applied to files:
src/webviews/extension-side/dataframe/dataframeController.unit.test.ts
📚 Learning: 2025-09-03T12:58:18.091Z
Learnt from: CR
PR: deepnote/vscode-extension#0
File: .github/instructions/kernel.instructions.md:0-0
Timestamp: 2025-09-03T12:58:18.091Z
Learning: Applies to src/kernels/execution/CellExecutionMessageHandler.ts : CellExecutionMessageHandler must process kernel messages (iopub, execute_reply) and update VS Code cell outputs
Applied to files:
src/webviews/extension-side/dataframe/dataframeController.ts
🧬 Code graph analysis (3)
src/webviews/extension-side/dataframe/dataframeController.unit.test.ts (5)
src/notebooks/controllers/notebookIPyWidgetCoordinator.ts (1)
controller(27-32)src/test/vscode-mock.ts (2)
resetVSCodeMocks(60-79)mockedVSCodeNamespaces(17-17)src/webviews/extension-side/dataframe/dataframeController.ts (1)
dispose(68-70)src/test/datascience/editor-integration/helpers.ts (1)
createMockedNotebookDocument(159-204)src/test/datascience/mockTextEditor.ts (1)
document(67-69)
src/webviews/webview-side/dataframe-renderer/DataframeRenderer.tsx (2)
src/platform/common/uuid.ts (1)
generateUuid(10-61)src/webviews/extension-side/dataframe/dataframeController.ts (2)
handleCopyTable(117-155)handleExportTable(157-211)
src/webviews/extension-side/dataframe/dataframeController.ts (1)
src/platform/common/process/types.node.ts (1)
Output(15-18)
🔇 Additional comments (1)
package.json (1)
2128-2128: Deps look good; confirm bundling for webview.clsx and tailwind-merge versions align with Tailwind v4 usage. Ensure these are included in the webview bundle and not pulled into extension host unintentionally.
Also applies to: 2167-2167
src/webviews/webview-side/dataframe-renderer/DataframeRenderer.tsx
Outdated
Show resolved
Hide resolved
andyjakubowski
left a comment
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.
🚀
Summary by CodeRabbit
New Features
Bug Fixes
Tests