@marimo-team/islands 0.23.16-dev5 → 0.23.16-dev50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ConnectedDataExplorerComponent-CJaUI-S-.js → ConnectedDataExplorerComponent-f9vLjQiF.js} +13 -13
- package/dist/{ErrorBoundary-DXlxsrTF.js → ErrorBoundary-DhLqwSWA.js} +3 -3
- package/dist/{any-language-editor-P9tjkj4n.js → any-language-editor-DifE-fl7.js} +5 -5
- package/dist/{button-BcSml68y.js → button-BSm8IXRU.js} +2 -4
- package/dist/{capabilities-BYLFYTYv.js → capabilities-C6OQ5YBO.js} +1 -1
- package/dist/{chat-ui-BdSDiVjk.js → chat-ui-1e7PcW56.js} +3117 -3120
- package/dist/{check-Cs-KV5XY.js → check-DP7U0H0G.js} +1 -1
- package/dist/{code-visibility-C4wLKnSb.js → common-BcbT1FqC.js} +1046 -1014
- package/dist/{copy-Cs3yt6Vt.js → copy-DNq8q3zw.js} +2 -2
- package/dist/{dist-B96tMAst.js → dist-DIlxLFXG.js} +2 -2
- package/dist/{error-banner-DR7o3CbX.js → error-banner-B_GQfxxD.js} +2 -2
- package/dist/{esm-k8PIvuZW.js → esm-DzZVaNH4.js} +1 -1
- package/dist/{extends-Cq2JYHKy.js → extends-w2_S44bV.js} +4 -4
- package/dist/{formats-BFhkZJwd.js → formats-Dwq1THhr.js} +3 -3
- package/dist/{glide-data-editor--CaN-f27.js → glide-data-editor-B9K6-MJe.js} +9 -9
- package/dist/{html-to-image-DDENewl2.js → html-to-image-3w0AakWW.js} +7164 -6240
- package/dist/{input-DStQIuqD.js → input-C5K4VBvB.js} +7 -7
- package/dist/{label-DIk0QoFe.js → label-DjoYwqmj.js} +2 -2
- package/dist/{loader-CTHCI-qe.js → loader-DX-IDS7n.js} +1 -1
- package/dist/main.js +1010 -1019
- package/dist/{mermaid-CdSvixW2.js → mermaid-hv6IckVw.js} +5 -5
- package/dist/{node-sql-parser-DLl_zNw0.js → node-sql-parser-v1Vi-Fft.js} +16867 -16665
- package/dist/{process-output-2QPcgBQg.js → process-output-BRwR4QGs.js} +32 -28
- package/dist/{reveal-component-BSD4w8YU.js → reveal-component-D7xmRQQ_.js} +725 -643
- package/dist/{spec-CnaxwDqy.js → spec-CQKL_D3i.js} +4 -4
- package/dist/{strings-BYAhZnQi.js → strings-DIy9NAmg.js} +4 -4
- package/dist/style.css +1 -1
- package/dist/{swiper-component-DE94711u.js → swiper-component-CEdAYjb7.js} +2 -2
- package/dist/toDate-CqhBWjvO.js +713 -0
- package/dist/{tooltip-B-qh7UPB.js → tooltip-f-qR0iUx.js} +3 -3
- package/dist/{types-DQl7jVYK.js → types-DicH9Oi0.js} +1 -1
- package/dist/{useAsyncData-CvO8WUy3.js → useAsyncData-CYOQb1EW.js} +1 -1
- package/dist/{useDateFormatter-BSoGim-G.js → useDateFormatter-Bt2qr_XS.js} +2 -2
- package/dist/{useDeepCompareMemoize-J3MKRdA4.js → useDeepCompareMemoize-CSHQeQEI.js} +1 -1
- package/dist/{useIframeCapabilities-POcFXHbw.js → useIframeCapabilities-kA09ykNq.js} +1 -1
- package/dist/{useLifecycle-DqPxHgAN.js → useLifecycle-CMJGqBaY.js} +3 -3
- package/dist/{useTheme-XMq9mNf_.js → useTheme-DYfby65G.js} +2 -2
- package/dist/{vega-component-CrFoZT1S.js → vega-component-C7nO5zcf.js} +10 -10
- package/dist/{zod-D0yOqoGe.js → zod-BUcyXSdR.js} +1 -1
- package/package.json +3 -4
- package/src/__mocks__/requests.ts +45 -4
- package/src/components/data-table/__tests__/__snapshots__/chart-spec-model.test.ts.snap +174 -21
- package/src/components/data-table/__tests__/chart-spec-model.test.ts +102 -1
- package/src/components/data-table/column-summary/chart-spec-model.tsx +163 -103
- package/src/components/data-table/column-summary/legacy-chart-spec.ts +15 -7
- package/src/components/data-table/column-summary/utils.ts +26 -7
- package/src/components/data-table/types.ts +1 -1
- package/src/components/editor/__tests__/viewer-banner.test.tsx +14 -0
- package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +99 -18
- package/src/components/editor/actions/__tests__/pdf-export.test.ts +32 -13
- package/src/components/editor/actions/pair-with-agent-commands.ts +21 -10
- package/src/components/editor/actions/pair-with-agent-modal.tsx +2 -2
- package/src/components/editor/actions/pdf-export.ts +11 -14
- package/src/components/editor/actions/useNotebookActions.tsx +18 -18
- package/src/components/editor/cell/code/__tests__/cell-editor-activity-lifecycle.test.ts +250 -0
- package/src/components/editor/cell/code/cell-editor.tsx +13 -7
- package/src/components/editor/chrome/panels/__tests__/logs-panel.test.tsx +25 -0
- package/src/components/editor/chrome/panels/logs-panel.tsx +12 -2
- package/src/components/editor/chrome/panels/write-secret-modal.tsx +40 -12
- package/src/components/editor/connections/__tests__/json-credentials.test.ts +114 -0
- package/src/components/editor/connections/__tests__/paths.test.ts +39 -0
- package/src/components/editor/connections/components.tsx +6 -2
- package/src/components/editor/connections/database/__tests__/__snapshots__/as-code.test.ts.snap +21 -5
- package/src/components/editor/connections/database/__tests__/as-code.test.ts +17 -0
- package/src/components/editor/connections/database/as-code.ts +16 -2
- package/src/components/editor/connections/database/schemas.ts +6 -5
- package/src/components/editor/connections/form-renderers.tsx +99 -1
- package/src/components/editor/connections/json-credentials.ts +57 -0
- package/src/components/editor/connections/paths.ts +21 -0
- package/src/components/editor/connections/secret-combobox.tsx +41 -20
- package/src/components/editor/connections/storage/__tests__/__snapshots__/as-code.test.ts.snap +88 -2
- package/src/components/editor/connections/storage/__tests__/as-code.test.ts +128 -8
- package/src/components/editor/connections/storage/as-code.ts +79 -36
- package/src/components/editor/connections/storage/schemas.ts +85 -44
- package/src/components/editor/file-tree/__tests__/renderers.test.ts +31 -0
- package/src/components/editor/file-tree/file-viewer.tsx +11 -7
- package/src/components/editor/file-tree/renderers.tsx +21 -0
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +1 -1
- package/src/components/editor/viewer-banner.tsx +4 -1
- package/src/components/forms/options.ts +2 -1
- package/src/components/slides/__tests__/cell-output-block.test.tsx +40 -0
- package/src/components/slides/__tests__/slide-cell-view.test.tsx +33 -0
- package/src/components/slides/__tests__/slide-scroll-hint.test.tsx +198 -0
- package/src/components/slides/reveal-component.tsx +25 -19
- package/src/components/slides/slide-cell-view.tsx +1 -1
- package/src/components/slides/slide-scroll-hint.tsx +161 -0
- package/src/components/slides/slides.css +4 -2
- package/src/components/static-html/share-modal.tsx +1 -1
- package/src/components/ui/input.tsx +1 -1
- package/src/core/ai/context/providers/file.ts +8 -29
- package/src/core/cells/__tests__/cells.test.ts +12 -2
- package/src/core/cells/__tests__/logs.test.ts +5 -5
- package/src/core/cells/cells.ts +17 -4
- package/src/core/cells/document-changes.ts +1 -0
- package/src/core/cells/logs.ts +14 -4
- package/src/core/codemirror/copilot/__tests__/language-server.test.ts +396 -100
- package/src/core/codemirror/copilot/__tests__/transport.test.ts +128 -540
- package/src/core/codemirror/copilot/language-server.ts +182 -70
- package/src/core/codemirror/copilot/transport.ts +15 -207
- package/src/core/codemirror/copilot/types.ts +9 -2
- package/src/core/codemirror/find-replace/__tests__/navigate.test.ts +42 -30
- package/src/core/codemirror/find-replace/navigate.ts +2 -0
- package/src/core/codemirror/go-to-definition/__tests__/commands.test.ts +24 -3
- package/src/core/codemirror/go-to-definition/commands.ts +3 -0
- package/src/core/codemirror/keymaps/__tests__/keymaps.test.ts +31 -2
- package/src/core/codemirror/keymaps/keymaps.ts +12 -0
- package/src/core/codemirror/language/__tests__/sql.test.ts +443 -61
- package/src/core/codemirror/language/languages/python.ts +23 -11
- package/src/core/codemirror/language/languages/sql/completion-store.ts +5 -1
- package/src/core/codemirror/language/languages/sql/sql.ts +210 -3
- package/src/core/codemirror/lsp/__tests__/federated-lsp.test.ts +161 -0
- package/src/core/codemirror/lsp/__tests__/log-messages.test.ts +53 -0
- package/src/core/codemirror/lsp/__tests__/normalize-markdown-math.test.ts +25 -0
- package/src/core/codemirror/lsp/__tests__/notebook-lsp.test.ts +598 -156
- package/src/core/codemirror/lsp/__tests__/transports.test.ts +112 -0
- package/src/core/codemirror/lsp/federated-lsp.ts +76 -23
- package/src/core/codemirror/lsp/log-messages.ts +37 -0
- package/src/core/codemirror/lsp/normalize-markdown-math.ts +8 -4
- package/src/core/codemirror/lsp/notebook-lsp.ts +220 -56
- package/src/core/codemirror/lsp/transports.ts +8 -1
- package/src/core/codemirror/lsp/types.ts +68 -8
- package/src/core/codemirror/lsp/utils.ts +14 -0
- package/src/core/codemirror/utils.ts +28 -0
- package/src/core/edit-app.tsx +1 -2
- package/src/core/export/__tests__/hooks.test.ts +2 -4
- package/src/core/export/hooks.ts +4 -3
- package/src/core/hotkeys/hotkeys.ts +0 -2
- package/src/core/islands/__tests__/bridge.test.ts +107 -0
- package/src/core/islands/bridge.ts +16 -0
- package/src/core/lsp/__tests__/transport.test.ts +509 -337
- package/src/core/lsp/transport.ts +304 -132
- package/src/core/mode.ts +10 -0
- package/src/core/network/__tests__/api.test.ts +42 -0
- package/src/core/network/__tests__/connection.test.ts +45 -0
- package/src/core/network/__tests__/requests-lazy.test.ts +32 -1
- package/src/core/network/__tests__/requests-network.test.ts +21 -0
- package/src/core/network/api.ts +27 -0
- package/src/core/network/connection.ts +15 -0
- package/src/core/network/requests-lazy.ts +1 -0
- package/src/core/network/requests-network.ts +14 -8
- package/src/core/network/requests-static.ts +1 -0
- package/src/core/network/requests-toasting.tsx +1 -0
- package/src/core/network/types.ts +22 -6
- package/src/core/rtc/state.ts +9 -0
- package/src/core/static/download-html.ts +5 -14
- package/src/core/wasm/bridge.ts +4 -2
- package/src/core/wasm/worker/types.ts +5 -2
- package/src/css/app/codemirror.css +16 -2
- package/src/plugins/impl/FormPlugin.tsx +1 -1
- package/src/plugins/impl/__tests__/FormPlugin.test.tsx +162 -0
- package/src/stories/log-viewer.stories.tsx +12 -6
- package/src/utils/__tests__/blob.test.ts +27 -1
- package/src/utils/__tests__/download.test.tsx +44 -4
- package/src/utils/blob.ts +24 -1
- package/src/utils/download.ts +14 -15
- package/dist/toDate-B3IRfHhw.js +0 -692
|
@@ -20,6 +20,26 @@ vi.mock("@/core/cells/cells", () => ({
|
|
|
20
20
|
getAllEditorViews: () => mockGetAllEditorViews(),
|
|
21
21
|
}));
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* A view stub that only carries what navigate needs
|
|
25
|
+
*/
|
|
26
|
+
function createMockView(state: EditorState): EditorView {
|
|
27
|
+
const cell = document.createElement("div");
|
|
28
|
+
cell.className = "marimo-cell";
|
|
29
|
+
// jsdom doesn't implement scrollIntoView.
|
|
30
|
+
cell.scrollIntoView = vi.fn();
|
|
31
|
+
const dom = document.createElement("div");
|
|
32
|
+
cell.append(dom);
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
state,
|
|
36
|
+
dom,
|
|
37
|
+
// Don't actually apply changes; it's complex to mock properly and the
|
|
38
|
+
// assertions only care that dispatch was called.
|
|
39
|
+
dispatch: vi.fn(),
|
|
40
|
+
} as unknown as EditorView;
|
|
41
|
+
}
|
|
42
|
+
|
|
23
43
|
describe("navigate", () => {
|
|
24
44
|
let view1: EditorView;
|
|
25
45
|
let view2: EditorView;
|
|
@@ -36,20 +56,8 @@ describe("navigate", () => {
|
|
|
36
56
|
});
|
|
37
57
|
|
|
38
58
|
// Create mock views that track dispatch calls
|
|
39
|
-
view1 =
|
|
40
|
-
|
|
41
|
-
dispatch: vi.fn(() => {
|
|
42
|
-
// Mock dispatch - in real tests we just need to verify it was called
|
|
43
|
-
// Don't actually apply changes as it's complex to mock properly
|
|
44
|
-
}),
|
|
45
|
-
} as unknown as EditorView;
|
|
46
|
-
|
|
47
|
-
view2 = {
|
|
48
|
-
state: state2,
|
|
49
|
-
dispatch: vi.fn(() => {
|
|
50
|
-
// Mock dispatch - in real tests we just need to verify it was called
|
|
51
|
-
}),
|
|
52
|
-
} as unknown as EditorView;
|
|
59
|
+
view1 = createMockView(state1);
|
|
60
|
+
view2 = createMockView(state2);
|
|
53
61
|
|
|
54
62
|
mockViews = [view1, view2];
|
|
55
63
|
mockGetAllEditorViews.mockReturnValue(mockViews);
|
|
@@ -234,6 +242,22 @@ describe("navigate", () => {
|
|
|
234
242
|
|
|
235
243
|
expect(result).toBe(false);
|
|
236
244
|
});
|
|
245
|
+
|
|
246
|
+
it("should scroll the cell owning the match into view", async () => {
|
|
247
|
+
const cell = view1.dom.closest(".marimo-cell");
|
|
248
|
+
invariant(cell, "mock view should be inside a cell");
|
|
249
|
+
|
|
250
|
+
expect(findNext()).toBeTruthy();
|
|
251
|
+
|
|
252
|
+
// The scroll is deferred a frame.
|
|
253
|
+
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
254
|
+
|
|
255
|
+
expect(cell.scrollIntoView).toHaveBeenCalledWith({
|
|
256
|
+
behavior: "instant",
|
|
257
|
+
block: "nearest",
|
|
258
|
+
inline: "nearest",
|
|
259
|
+
});
|
|
260
|
+
});
|
|
237
261
|
});
|
|
238
262
|
|
|
239
263
|
describe("findPrev", () => {
|
|
@@ -319,10 +343,7 @@ describe("navigate", () => {
|
|
|
319
343
|
extensions: [EditorState.readOnly.of(true)],
|
|
320
344
|
});
|
|
321
345
|
|
|
322
|
-
const readOnlyView =
|
|
323
|
-
state: readOnlyState,
|
|
324
|
-
dispatch: vi.fn(),
|
|
325
|
-
} as unknown as EditorView;
|
|
346
|
+
const readOnlyView = createMockView(readOnlyState);
|
|
326
347
|
|
|
327
348
|
// Replace view1 with read-only view temporarily
|
|
328
349
|
mockGetAllEditorViews.mockReturnValueOnce([readOnlyView, view2]);
|
|
@@ -568,10 +589,7 @@ describe("navigate", () => {
|
|
|
568
589
|
doc: Text.of(["hello world hello there hello"]),
|
|
569
590
|
});
|
|
570
591
|
|
|
571
|
-
const testView =
|
|
572
|
-
state: testDoc,
|
|
573
|
-
dispatch: vi.fn(),
|
|
574
|
-
} as unknown as EditorView;
|
|
592
|
+
const testView = createMockView(testDoc);
|
|
575
593
|
|
|
576
594
|
mockGetAllEditorViews.mockReturnValue([testView]);
|
|
577
595
|
|
|
@@ -613,10 +631,7 @@ describe("navigate", () => {
|
|
|
613
631
|
doc: Text.of([""]),
|
|
614
632
|
});
|
|
615
633
|
|
|
616
|
-
const emptyView =
|
|
617
|
-
state: emptyState,
|
|
618
|
-
dispatch: vi.fn(),
|
|
619
|
-
} as unknown as EditorView;
|
|
634
|
+
const emptyView = createMockView(emptyState);
|
|
620
635
|
|
|
621
636
|
mockGetAllEditorViews.mockReturnValue([emptyView]);
|
|
622
637
|
|
|
@@ -629,10 +644,7 @@ describe("navigate", () => {
|
|
|
629
644
|
doc: Text.of(["orphan content"]),
|
|
630
645
|
});
|
|
631
646
|
|
|
632
|
-
const orphanView =
|
|
633
|
-
state: orphanState,
|
|
634
|
-
dispatch: vi.fn(),
|
|
635
|
-
} as unknown as EditorView;
|
|
647
|
+
const orphanView = createMockView(orphanState);
|
|
636
648
|
|
|
637
649
|
store.set(findReplaceAtom, {
|
|
638
650
|
type: "setCurrentView",
|
|
@@ -6,6 +6,7 @@ import { EditorView } from "@codemirror/view";
|
|
|
6
6
|
import { getAllEditorViews } from "@/core/cells/cells";
|
|
7
7
|
import { replaceEditorContent } from "@/core/codemirror/replace-editor-content";
|
|
8
8
|
import { store } from "@/core/state/jotai";
|
|
9
|
+
import { scrollOwnerCell } from "../utils";
|
|
9
10
|
import { asQueryCreator, type QueryType } from "./query";
|
|
10
11
|
import { findReplaceAtom } from "./state";
|
|
11
12
|
|
|
@@ -85,6 +86,7 @@ const findInDirection = (direction: "next" | "prev") =>
|
|
|
85
86
|
effects: [EditorView.scrollIntoView(selection.main, { y: "center" })],
|
|
86
87
|
userEvent: "select.search",
|
|
87
88
|
});
|
|
89
|
+
scrollOwnerCell(view);
|
|
88
90
|
store.set(findReplaceAtom, {
|
|
89
91
|
type: "setCurrentView",
|
|
90
92
|
view,
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
import { python } from "@codemirror/lang-python";
|
|
4
4
|
import { EditorState } from "@codemirror/state";
|
|
5
5
|
import { EditorView } from "@codemirror/view";
|
|
6
|
-
import { afterEach, describe, expect, test } from "vitest";
|
|
6
|
+
import { afterEach, describe, expect, test, vi } from "vitest";
|
|
7
7
|
import { goToVariableDefinition } from "../commands";
|
|
8
8
|
|
|
9
9
|
async function tick(): Promise<void> {
|
|
10
10
|
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
function createEditor(content: string) {
|
|
13
|
+
function createEditor(content: string, parent: HTMLElement = document.body) {
|
|
14
14
|
const state = EditorState.create({
|
|
15
15
|
doc: content,
|
|
16
16
|
extensions: [python()],
|
|
@@ -18,7 +18,7 @@ function createEditor(content: string) {
|
|
|
18
18
|
|
|
19
19
|
const view = new EditorView({
|
|
20
20
|
state,
|
|
21
|
-
parent
|
|
21
|
+
parent,
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
return view;
|
|
@@ -383,6 +383,27 @@ print('myVar')`);
|
|
|
383
383
|
"
|
|
384
384
|
`);
|
|
385
385
|
});
|
|
386
|
+
|
|
387
|
+
test("scrolls the cell owning the definition into view", async () => {
|
|
388
|
+
const cell = document.createElement("div");
|
|
389
|
+
cell.className = "marimo-cell";
|
|
390
|
+
// jsdom doesn't implement scrollIntoView.
|
|
391
|
+
cell.scrollIntoView = vi.fn();
|
|
392
|
+
document.body.append(cell);
|
|
393
|
+
|
|
394
|
+
view = createEditor("myVar = 10\nprint(myVar)", cell);
|
|
395
|
+
expect(goToVariableDefinition(view, "myVar")).toBe(true);
|
|
396
|
+
// The jump and the scroll are both deferred to the next frame.
|
|
397
|
+
await tick();
|
|
398
|
+
|
|
399
|
+
expect(cell.scrollIntoView).toHaveBeenCalledWith({
|
|
400
|
+
behavior: "instant",
|
|
401
|
+
block: "nearest",
|
|
402
|
+
inline: "nearest",
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
cell.remove();
|
|
406
|
+
});
|
|
386
407
|
});
|
|
387
408
|
|
|
388
409
|
/**
|
|
@@ -4,6 +4,7 @@ import { syntaxTree } from "@codemirror/language";
|
|
|
4
4
|
import type { EditorState } from "@codemirror/state";
|
|
5
5
|
import { EditorView } from "@codemirror/view";
|
|
6
6
|
import type { SyntaxNode, Tree, TreeCursor } from "@lezer/common";
|
|
7
|
+
import { scrollOwnerCell } from "../utils";
|
|
7
8
|
|
|
8
9
|
const SCOPE_CREATING_NODES = new Set([
|
|
9
10
|
"FunctionDefinition",
|
|
@@ -45,6 +46,8 @@ function goToPosition(view: EditorView, from: number): void {
|
|
|
45
46
|
}),
|
|
46
47
|
});
|
|
47
48
|
});
|
|
49
|
+
|
|
50
|
+
scrollOwnerCell(view);
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
function findFirstMatchingVariable(
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
copyLineDown,
|
|
5
|
+
copyLineUp,
|
|
6
|
+
defaultKeymap as originalDefaultKeymap,
|
|
7
|
+
} from "@codemirror/commands";
|
|
4
8
|
import { describe, expect, it } from "vitest";
|
|
5
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
HotkeyProvider,
|
|
11
|
+
OverridingHotkeyProvider,
|
|
12
|
+
} from "@/core/hotkeys/hotkeys";
|
|
6
13
|
import { visibleForTesting } from "../keymaps";
|
|
7
14
|
|
|
8
15
|
const { defaultKeymap, defaultVimKeymap, overrideKeymap, OVERRIDDEN_COMMANDS } =
|
|
@@ -40,4 +47,26 @@ describe("keymaps", () => {
|
|
|
40
47
|
expect(keys.some((k) => k.run === command)).toBe(true);
|
|
41
48
|
}
|
|
42
49
|
});
|
|
50
|
+
|
|
51
|
+
it.each([
|
|
52
|
+
["cell.copyLineUp", copyLineUp, "Alt-Shift-ArrowUp"],
|
|
53
|
+
["cell.copyLineDown", copyLineDown, "Alt-Shift-ArrowDown"],
|
|
54
|
+
] as const)(
|
|
55
|
+
"%s is bound to the configured hotkey, not CodeMirror's default",
|
|
56
|
+
(action, command, defaultKey) => {
|
|
57
|
+
// Without an override, the binding matches CodeMirror's default key.
|
|
58
|
+
expect(
|
|
59
|
+
overrideKeymap(HotkeyProvider.create()).find((k) => k.run === command)
|
|
60
|
+
?.key,
|
|
61
|
+
).toBe(defaultKey);
|
|
62
|
+
|
|
63
|
+
// With an override, the binding follows the user's configured key.
|
|
64
|
+
// This is what `editable: true` on these hotkeys promises.
|
|
65
|
+
expect(
|
|
66
|
+
overrideKeymap(
|
|
67
|
+
new OverridingHotkeyProvider({ [action]: "Ctrl-d" }),
|
|
68
|
+
).find((k) => k.run === command)?.key,
|
|
69
|
+
).toBe("Ctrl-d");
|
|
70
|
+
},
|
|
71
|
+
);
|
|
43
72
|
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
+
copyLineDown,
|
|
5
|
+
copyLineUp,
|
|
4
6
|
cursorCharLeft,
|
|
5
7
|
cursorCharRight,
|
|
6
8
|
cursorLineDown,
|
|
@@ -94,6 +96,8 @@ export function keymapBundle(
|
|
|
94
96
|
const OVERRIDDEN_COMMANDS = new Set<Command | undefined>([
|
|
95
97
|
toggleComment,
|
|
96
98
|
toggleBlockComment,
|
|
99
|
+
copyLineUp,
|
|
100
|
+
copyLineDown,
|
|
97
101
|
]);
|
|
98
102
|
|
|
99
103
|
const defaultKeymap = once(() => {
|
|
@@ -111,6 +115,14 @@ const overrideKeymap = (keymap: HotkeyProvider): readonly KeyBinding[] => {
|
|
|
111
115
|
key: keymap.getHotkey("cell.toggleBlockComment").key,
|
|
112
116
|
run: toggleBlockComment,
|
|
113
117
|
},
|
|
118
|
+
{
|
|
119
|
+
key: keymap.getHotkey("cell.copyLineUp").key,
|
|
120
|
+
run: copyLineUp,
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
key: keymap.getHotkey("cell.copyLineDown").key,
|
|
124
|
+
run: copyLineDown,
|
|
125
|
+
},
|
|
114
126
|
];
|
|
115
127
|
};
|
|
116
128
|
|