@marimo-team/islands 0.22.1-dev23 → 0.22.1-dev27
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/main.js +3 -3
- package/package.json +6 -17
- package/src/__tests__/main.test.tsx +12 -14
- package/src/components/ai/ai-provider-icon.tsx +1 -2
- package/src/components/data-table/cell-selection/types.ts +3 -2
- package/src/components/data-table/charts/charts.tsx +2 -2
- package/src/components/data-table/column-formatting/types.ts +3 -2
- package/src/components/data-table/column-header.tsx +4 -2
- package/src/components/data-table/column-wrapping/types.ts +3 -2
- package/src/components/data-table/copy-column/types.ts +3 -2
- package/src/components/data-table/focus-row/types.ts +3 -2
- package/src/components/data-table/range-focus/__tests__/atoms.test.ts +11 -11
- package/src/components/data-table/range-focus/__tests__/use-cell-range-selection.test.ts +9 -11
- package/src/components/editor/__tests__/data-attributes.test.tsx +93 -94
- package/src/components/editor/actions/name-cell-input.tsx +4 -2
- package/src/components/editor/actions/useCellActionButton.tsx +4 -2
- package/src/components/editor/cell/CellStatus.tsx +4 -5
- package/src/components/editor/cell/cell-context-menu.tsx +4 -2
- package/src/components/editor/cell/code/cell-editor.tsx +2 -1
- package/src/components/editor/cell/toolbar.tsx +2 -1
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +11 -12
- package/src/components/storage/__tests__/storage-snippets.test.ts +4 -6
- package/src/components/tracing/tracing.test.tsx +30 -30
- package/src/components/ui/badge.tsx +2 -1
- package/src/components/ui/button.tsx +2 -1
- package/src/components/ui/calendar.tsx +3 -2
- package/src/components/ui/combobox.tsx +2 -1
- package/src/components/ui/date-input.tsx +7 -6
- package/src/components/ui/date-picker.tsx +6 -4
- package/src/components/ui/field.tsx +1 -2
- package/src/components/ui/progress.tsx +3 -2
- package/src/components/ui/query-param-preserving-link.tsx +4 -2
- package/src/components/ui/sheet.tsx +2 -1
- package/src/components/ui/textarea.tsx +1 -2
- package/src/core/ai/context/providers/cell-output.ts +1 -2
- package/src/core/ai/tools/edit-notebook-tool.ts +4 -3
- package/src/core/ai/tools/run-cells-tool.ts +4 -3
- package/src/core/cells/__tests__/add-missing-import.test.ts +23 -22
- package/src/core/cells/__tests__/cell.test.ts +14 -13
- package/src/core/cells/logs.ts +1 -1
- package/src/core/codemirror/cells/__tests__/extensions.test.ts +15 -17
- package/src/core/codemirror/copilot/transport.ts +1 -2
- package/src/core/codemirror/language/languages/markdown.ts +1 -3
- package/src/core/codemirror/language/languages/python.ts +4 -0
- package/src/core/codemirror/language/languages/sql/completion-sources.tsx +4 -6
- package/src/core/codemirror/language/languages/sql/sql.ts +1 -3
- package/src/core/codemirror/reactive-references/__tests__/analyzer.test.ts +28 -42
- package/src/core/datasets/data-source-connections.ts +4 -2
- package/src/core/dom/__tests__/htmlUtils.test.ts +8 -14
- package/src/core/dom/__tests__/outline.test.ts +2 -3
- package/src/core/islands/__tests__/parse.test.ts +8 -7
- package/src/core/saving/__tests__/filename.test.ts +7 -6
- package/src/core/static/__tests__/download-html.test.ts +16 -15
- package/src/core/static/__tests__/files.test.ts +30 -28
- package/src/css/app/Cell.css +5 -2
- package/src/css/globals.css +40 -14
- package/src/plugins/impl/DataEditorPlugin.tsx +4 -2
- package/src/plugins/impl/FormPlugin.tsx +1 -2
- package/src/plugins/impl/data-frames/forms/__tests__/form.test.tsx +7 -9
- package/src/plugins/impl/vega/__tests__/make-selectable.test.ts +13 -14
- package/src/plugins/layout/ImageComparisonPlugin.tsx +1 -3
- package/src/plugins/stateless-plugin.ts +4 -2
- package/src/utils/__tests__/cell-urls.test.ts +24 -21
- package/src/utils/__tests__/filenames.test.ts +15 -14
- package/src/utils/__tests__/json-parser.test.ts +14 -21
- package/src/utils/__tests__/path.test.ts +34 -31
- package/src/utils/__tests__/urls.test.ts +19 -18
- package/src/utils/tracer.ts +1 -0
|
@@ -5,36 +5,36 @@ import { formatChartTime } from "./utils";
|
|
|
5
5
|
describe("formatChartTime", () => {
|
|
6
6
|
beforeAll(() => {
|
|
7
7
|
// Mock Date to always use UTC
|
|
8
|
-
vi.spyOn(global.Date.prototype, "getFullYear").mockImplementation(
|
|
9
|
-
this: Date
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
vi.spyOn(global.Date.prototype, "getMonth").mockImplementation(
|
|
14
|
-
this: Date
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
vi.spyOn(global.Date.prototype, "getDate").mockImplementation(
|
|
19
|
-
this: Date
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
vi.spyOn(global.Date.prototype, "getHours").mockImplementation(
|
|
24
|
-
this: Date
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
vi.spyOn(global.Date.prototype, "getMinutes").mockImplementation(
|
|
29
|
-
this: Date
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
vi.spyOn(global.Date.prototype, "getSeconds").mockImplementation(
|
|
34
|
-
this: Date
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
8
|
+
vi.spyOn(global.Date.prototype, "getFullYear").mockImplementation(
|
|
9
|
+
function (this: Date) {
|
|
10
|
+
return this.getUTCFullYear();
|
|
11
|
+
},
|
|
12
|
+
);
|
|
13
|
+
vi.spyOn(global.Date.prototype, "getMonth").mockImplementation(
|
|
14
|
+
function (this: Date) {
|
|
15
|
+
return this.getUTCMonth();
|
|
16
|
+
},
|
|
17
|
+
);
|
|
18
|
+
vi.spyOn(global.Date.prototype, "getDate").mockImplementation(
|
|
19
|
+
function (this: Date) {
|
|
20
|
+
return this.getUTCDate();
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
vi.spyOn(global.Date.prototype, "getHours").mockImplementation(
|
|
24
|
+
function (this: Date) {
|
|
25
|
+
return this.getUTCHours();
|
|
26
|
+
},
|
|
27
|
+
);
|
|
28
|
+
vi.spyOn(global.Date.prototype, "getMinutes").mockImplementation(
|
|
29
|
+
function (this: Date) {
|
|
30
|
+
return this.getUTCMinutes();
|
|
31
|
+
},
|
|
32
|
+
);
|
|
33
|
+
vi.spyOn(global.Date.prototype, "getSeconds").mockImplementation(
|
|
34
|
+
function (this: Date) {
|
|
35
|
+
return this.getUTCSeconds();
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
38
|
vi.spyOn(global.Date.prototype, "getMilliseconds").mockImplementation(
|
|
39
39
|
function (this: Date) {
|
|
40
40
|
return this.getUTCMilliseconds();
|
|
@@ -29,7 +29,8 @@ const badgeVariants = cva(
|
|
|
29
29
|
);
|
|
30
30
|
|
|
31
31
|
export interface BadgeProps
|
|
32
|
-
extends
|
|
32
|
+
extends
|
|
33
|
+
React.HTMLAttributes<HTMLDivElement>,
|
|
33
34
|
VariantProps<typeof badgeVariants> {}
|
|
34
35
|
|
|
35
36
|
const Badge = ({ className, variant, ...props }: BadgeProps) => {
|
|
@@ -92,7 +92,8 @@ const buttonVariants = cva(
|
|
|
92
92
|
);
|
|
93
93
|
|
|
94
94
|
export interface ButtonProps
|
|
95
|
-
extends
|
|
95
|
+
extends
|
|
96
|
+
React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
96
97
|
Omit<VariantProps<typeof buttonVariants>, "disabled"> {
|
|
97
98
|
asChild?: boolean;
|
|
98
99
|
keyboardShortcut?: string;
|
|
@@ -183,8 +183,9 @@ const Calendar = <T extends AriaDateValue>({
|
|
|
183
183
|
);
|
|
184
184
|
};
|
|
185
185
|
|
|
186
|
-
interface RangeCalendarProps<
|
|
187
|
-
extends
|
|
186
|
+
interface RangeCalendarProps<
|
|
187
|
+
T extends AriaDateValue,
|
|
188
|
+
> extends AriaRangeCalendarProps<T> {
|
|
188
189
|
errorMessage?: string;
|
|
189
190
|
}
|
|
190
191
|
|
|
@@ -230,7 +230,8 @@ interface ComboboxItemOptions<TValue> {
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
export interface ComboboxItemProps<TValue>
|
|
233
|
-
extends
|
|
233
|
+
extends
|
|
234
|
+
ComboboxItemOptions<TValue>,
|
|
234
235
|
Omit<
|
|
235
236
|
React.ComponentProps<typeof CommandItem>,
|
|
236
237
|
keyof ComboboxItemOptions<TValue> | "onSelect" | "role"
|
|
@@ -41,8 +41,7 @@ const DateSegment = ({ className, ...props }: AriaDateSegmentProps) => {
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
interface DateInputProps
|
|
44
|
-
extends AriaDateInputProps,
|
|
45
|
-
VariantProps<typeof fieldGroupVariants> {}
|
|
44
|
+
extends AriaDateInputProps, VariantProps<typeof fieldGroupVariants> {}
|
|
46
45
|
|
|
47
46
|
const DateInput = ({
|
|
48
47
|
className,
|
|
@@ -61,8 +60,9 @@ const DateInput = ({
|
|
|
61
60
|
);
|
|
62
61
|
};
|
|
63
62
|
|
|
64
|
-
interface DateFieldProps<
|
|
65
|
-
extends
|
|
63
|
+
interface DateFieldProps<
|
|
64
|
+
T extends AriaDateValue,
|
|
65
|
+
> extends AriaDateFieldProps<T> {
|
|
66
66
|
label?: string;
|
|
67
67
|
description?: string;
|
|
68
68
|
errorMessage?: string | ((validation: AriaValidationResult) => string);
|
|
@@ -94,8 +94,9 @@ const DateField = <T extends AriaDateValue>({
|
|
|
94
94
|
);
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
interface TimeFieldProps<
|
|
98
|
-
extends
|
|
97
|
+
interface TimeFieldProps<
|
|
98
|
+
T extends AriaTimeValue,
|
|
99
|
+
> extends AriaTimeFieldProps<T> {
|
|
99
100
|
label?: string;
|
|
100
101
|
description?: string;
|
|
101
102
|
errorMessage?: string | ((validation: AriaValidationResult) => string);
|
|
@@ -51,8 +51,9 @@ const DatePickerContent = ({
|
|
|
51
51
|
</Popover>
|
|
52
52
|
);
|
|
53
53
|
|
|
54
|
-
interface DatePickerProps<
|
|
55
|
-
extends
|
|
54
|
+
interface DatePickerProps<
|
|
55
|
+
T extends AriaDateValue,
|
|
56
|
+
> extends AriaDatePickerProps<T> {
|
|
56
57
|
label?: string;
|
|
57
58
|
description?: string;
|
|
58
59
|
errorMessage?: string | ((validation: AriaValidationResult) => string);
|
|
@@ -115,8 +116,9 @@ const DatePicker = <T extends AriaDateValue>({
|
|
|
115
116
|
);
|
|
116
117
|
};
|
|
117
118
|
|
|
118
|
-
interface DateRangePickerProps<
|
|
119
|
-
extends
|
|
119
|
+
interface DateRangePickerProps<
|
|
120
|
+
T extends AriaDateValue,
|
|
121
|
+
> extends AriaDateRangePickerProps<T> {
|
|
120
122
|
label?: string;
|
|
121
123
|
description?: string;
|
|
122
124
|
errorMessage?: string | ((validation: AriaValidationResult) => string);
|
|
@@ -66,8 +66,7 @@ const fieldGroupVariants = cva("", {
|
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
interface GroupProps
|
|
69
|
-
extends AriaGroupProps,
|
|
70
|
-
VariantProps<typeof fieldGroupVariants> {}
|
|
69
|
+
extends AriaGroupProps, VariantProps<typeof fieldGroupVariants> {}
|
|
71
70
|
|
|
72
71
|
const FieldGroup = ({ className, variant, ...props }: GroupProps) => {
|
|
73
72
|
return (
|
|
@@ -5,8 +5,9 @@ import * as React from "react";
|
|
|
5
5
|
|
|
6
6
|
import { cn } from "@/utils/cn";
|
|
7
7
|
|
|
8
|
-
interface ProgressProps
|
|
9
|
-
|
|
8
|
+
interface ProgressProps extends React.ComponentPropsWithoutRef<
|
|
9
|
+
typeof ProgressPrimitive.Root
|
|
10
|
+
> {
|
|
10
11
|
/**
|
|
11
12
|
* When true, shows an indeterminate animated progress bar.
|
|
12
13
|
*/
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
import React, { useRef } from "react";
|
|
4
4
|
import { usePress } from "react-aria";
|
|
5
5
|
|
|
6
|
-
interface QueryParamPreservingLinkProps
|
|
7
|
-
|
|
6
|
+
interface QueryParamPreservingLinkProps extends Omit<
|
|
7
|
+
React.HTMLAttributes<HTMLAnchorElement>,
|
|
8
|
+
"href"
|
|
9
|
+
> {
|
|
8
10
|
href: string;
|
|
9
11
|
children: React.ReactNode;
|
|
10
12
|
}
|
|
@@ -51,7 +51,8 @@ const sheetVariants = cva(
|
|
|
51
51
|
);
|
|
52
52
|
|
|
53
53
|
interface SheetContentProps
|
|
54
|
-
extends
|
|
54
|
+
extends
|
|
55
|
+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
|
|
55
56
|
VariantProps<typeof sheetVariants> {}
|
|
56
57
|
|
|
57
58
|
const SheetContent = React.forwardRef<
|
|
@@ -6,8 +6,7 @@ import { useDebounceControlledState } from "@/hooks/useDebounce";
|
|
|
6
6
|
import { cn } from "@/utils/cn";
|
|
7
7
|
import { Events } from "@/utils/events";
|
|
8
8
|
|
|
9
|
-
export interface TextareaProps
|
|
10
|
-
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
9
|
+
export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
11
10
|
bottomAdornment?: React.ReactNode;
|
|
12
11
|
}
|
|
13
12
|
|
|
@@ -34,8 +34,7 @@ export interface CellOutputData {
|
|
|
34
34
|
// For the context provider
|
|
35
35
|
// Currently, we enforce that cellOutput is present.
|
|
36
36
|
interface CellOutputContextData
|
|
37
|
-
extends CellOutputData,
|
|
38
|
-
Record<string, unknown> {
|
|
37
|
+
extends CellOutputData, Record<string, unknown> {
|
|
39
38
|
cellOutput: BaseOutput;
|
|
40
39
|
}
|
|
41
40
|
|
|
@@ -72,9 +72,10 @@ type EditNotebookInput = z.infer<typeof editNotebookSchema>;
|
|
|
72
72
|
type EditOperation = EditNotebookInput["edit"];
|
|
73
73
|
export type EditType = EditOperation["type"];
|
|
74
74
|
|
|
75
|
-
export class EditNotebookTool
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
export class EditNotebookTool implements AiTool<
|
|
76
|
+
EditNotebookInput,
|
|
77
|
+
ToolOutputBase
|
|
78
|
+
> {
|
|
78
79
|
readonly name = "edit_notebook_tool";
|
|
79
80
|
readonly description = description;
|
|
80
81
|
readonly schema = editNotebookSchema;
|
|
@@ -50,9 +50,10 @@ const filePartSchema = z.object({
|
|
|
50
50
|
mediaType: z.string(),
|
|
51
51
|
}) satisfies z.ZodType<FileUIPart>;
|
|
52
52
|
|
|
53
|
-
export class RunStaleCellsTool
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
export class RunStaleCellsTool implements AiTool<
|
|
54
|
+
EmptyToolInput,
|
|
55
|
+
RunStaleCellsOutput
|
|
56
|
+
> {
|
|
56
57
|
readonly name = "run_stale_cells_tool";
|
|
57
58
|
readonly description = description;
|
|
58
59
|
readonly schema = z.object({});
|
|
@@ -48,28 +48,29 @@ describe("maybeAddMissingImport", () => {
|
|
|
48
48
|
"import marimo as mo\nimport marimo as mo",
|
|
49
49
|
"import marimo as mo",
|
|
50
50
|
];
|
|
51
|
-
it.each(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
51
|
+
it.each(VALID_IMPORTS)(
|
|
52
|
+
"should not add an import if the import statement already exists in the notebook",
|
|
53
|
+
(code) => {
|
|
54
|
+
const appStore = createStore();
|
|
55
|
+
appStore.set(variablesAtom, {} as Variables);
|
|
56
|
+
appStore.set(
|
|
57
|
+
notebookAtom,
|
|
58
|
+
MockNotebook.notebookState({
|
|
59
|
+
cellData: {
|
|
60
|
+
[Cell1]: { code: code },
|
|
61
|
+
},
|
|
62
|
+
}),
|
|
63
|
+
);
|
|
64
|
+
const onAddImport = vi.fn();
|
|
65
|
+
maybeAddMissingImport({
|
|
66
|
+
moduleName: "marimo",
|
|
67
|
+
variableName: "mo",
|
|
68
|
+
onAddImport,
|
|
69
|
+
appStore,
|
|
70
|
+
});
|
|
71
|
+
expect(onAddImport).not.toHaveBeenCalled();
|
|
72
|
+
},
|
|
73
|
+
);
|
|
73
74
|
|
|
74
75
|
it("should add an import if the variable is not in the variables state and the import statement does not exist in the notebook", () => {
|
|
75
76
|
const appStore = createStore();
|
|
@@ -43,19 +43,20 @@ describe("outputIsLoading", () => {
|
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
describe("outputIsStale", () => {
|
|
46
|
-
it.each(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
46
|
+
it.each(STATUSES)(
|
|
47
|
+
"should return true if the cell is edited and status is %s",
|
|
48
|
+
(status) => {
|
|
49
|
+
const cell = {
|
|
50
|
+
status: status,
|
|
51
|
+
staleInputs: true,
|
|
52
|
+
output: null,
|
|
53
|
+
runStartTimestamp: null,
|
|
54
|
+
interrupted: false,
|
|
55
|
+
};
|
|
56
|
+
const edited = true;
|
|
57
|
+
expect(outputIsStale(cell, edited)).toBe(true);
|
|
58
|
+
},
|
|
59
|
+
);
|
|
59
60
|
|
|
60
61
|
it("should return true if the cell is loading", () => {
|
|
61
62
|
const cell = {
|
package/src/core/cells/logs.ts
CHANGED
|
@@ -98,7 +98,7 @@ const CellLogLogger = {
|
|
|
98
98
|
? "red"
|
|
99
99
|
: "orange";
|
|
100
100
|
const status = payload.level.toUpperCase();
|
|
101
|
-
|
|
101
|
+
// oxlint-disable-next-line no-console -- intentional debug logging
|
|
102
102
|
console.log(
|
|
103
103
|
`%c[${status}]`,
|
|
104
104
|
`color:${color}; padding:2px 0; border-radius:2px; font-weight:bold`,
|
|
@@ -18,24 +18,22 @@ function createTransaction(spec: TransactionSpec) {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
describe("shouldAutorunMarkdownUpdate", () => {
|
|
21
|
-
it.each([
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
changes: { from: 0, insert: "#" },
|
|
29
|
-
annotations: [Transaction.userEvent.of(userEvent)],
|
|
30
|
-
});
|
|
21
|
+
it.each(["input.type", "delete.backward", "undo", "redo"])(
|
|
22
|
+
"accepts local %s transactions",
|
|
23
|
+
(userEvent) => {
|
|
24
|
+
const transaction = createTransaction({
|
|
25
|
+
changes: { from: 0, insert: "#" },
|
|
26
|
+
annotations: [Transaction.userEvent.of(userEvent)],
|
|
27
|
+
});
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
expect(
|
|
30
|
+
shouldAutorunMarkdownUpdate({
|
|
31
|
+
docChanged: transaction.docChanged,
|
|
32
|
+
transactions: [transaction],
|
|
33
|
+
}),
|
|
34
|
+
).toBe(true);
|
|
35
|
+
},
|
|
36
|
+
);
|
|
39
37
|
|
|
40
38
|
it("ignores formatting changes", () => {
|
|
41
39
|
const transaction = createTransaction({
|
|
@@ -169,8 +169,7 @@ export class LazyWebsocketTransport extends Transport {
|
|
|
169
169
|
// Show error toast on final retry
|
|
170
170
|
this.options.showError(
|
|
171
171
|
"GitHub Copilot Connection Error",
|
|
172
|
-
|
|
173
|
-
prettyError(error),
|
|
172
|
+
`Failed to connect to GitHub Copilot. Please check your settings and try again.\n\n${prettyError(error)}`,
|
|
174
173
|
);
|
|
175
174
|
throw error;
|
|
176
175
|
}
|
|
@@ -38,9 +38,7 @@ export const MARKDOWN_INITIAL_HIDE_CODE = true;
|
|
|
38
38
|
/**
|
|
39
39
|
* Language adapter for Markdown.
|
|
40
40
|
*/
|
|
41
|
-
export class MarkdownLanguageAdapter
|
|
42
|
-
implements LanguageAdapter<MarkdownLanguageAdapterMetadata>
|
|
43
|
-
{
|
|
41
|
+
export class MarkdownLanguageAdapter implements LanguageAdapter<MarkdownLanguageAdapterMetadata> {
|
|
44
42
|
private parser = new MarkdownParser();
|
|
45
43
|
|
|
46
44
|
readonly type = "markdown";
|
|
@@ -45,6 +45,7 @@ import type { LanguageAdapter } from "../types";
|
|
|
45
45
|
|
|
46
46
|
const pylspClient = once((lspConfig: LSPConfig) => {
|
|
47
47
|
// Create a mutable reference for the resync callback
|
|
48
|
+
// oxlint-disable-next-line prefer-const -- reassigned after closure capture
|
|
48
49
|
let resyncCallback: (() => Promise<void>) | undefined;
|
|
49
50
|
|
|
50
51
|
const transport = createTransport("pylsp", async () => {
|
|
@@ -151,6 +152,7 @@ const pylspClient = once((lspConfig: LSPConfig) => {
|
|
|
151
152
|
});
|
|
152
153
|
|
|
153
154
|
const tyLspClient = once((_: LSPConfig) => {
|
|
155
|
+
// oxlint-disable-next-line prefer-const -- reassigned after closure capture
|
|
154
156
|
let resyncCallback: (() => Promise<void>) | undefined;
|
|
155
157
|
|
|
156
158
|
const transport = createTransport("ty", async () => {
|
|
@@ -181,6 +183,7 @@ const tyLspClient = once((_: LSPConfig) => {
|
|
|
181
183
|
|
|
182
184
|
const pyreflyClient = once(
|
|
183
185
|
(lspConfig: LSPConfig & { diagnostics: DiagnosticsConfig }) => {
|
|
186
|
+
// oxlint-disable-next-line prefer-const -- reassigned after closure capture
|
|
184
187
|
let resyncCallback: (() => Promise<void>) | undefined;
|
|
185
188
|
|
|
186
189
|
const transport = createTransport("pyrefly", async () => {
|
|
@@ -218,6 +221,7 @@ const pyreflyClient = once(
|
|
|
218
221
|
);
|
|
219
222
|
|
|
220
223
|
const pyrightClient = once((_: LSPConfig) => {
|
|
224
|
+
// oxlint-disable-next-line prefer-const -- reassigned after closure capture
|
|
221
225
|
let resyncCallback: (() => Promise<void>) | undefined;
|
|
222
226
|
|
|
223
227
|
const transport = createTransport("basedpyright", async () => {
|
|
@@ -91,13 +91,11 @@ export function customKeywordCompletionSource(): CompletionSource {
|
|
|
91
91
|
|
|
92
92
|
// e.g. lazily load keyword docs
|
|
93
93
|
const getKeywordDocs = once(async (): Promise<Record<string, unknown>> => {
|
|
94
|
-
const keywords =
|
|
95
|
-
"@marimo-team/codemirror-sql/data/common-keywords.json"
|
|
96
|
-
);
|
|
94
|
+
const keywords =
|
|
95
|
+
await import("@marimo-team/codemirror-sql/data/common-keywords.json");
|
|
97
96
|
// Include DuckDB for now, but we can remove this once we have a better way to handle dialect-specific keywords
|
|
98
|
-
const duckdbKeywords =
|
|
99
|
-
"@marimo-team/codemirror-sql/data/duckdb-keywords.json"
|
|
100
|
-
);
|
|
97
|
+
const duckdbKeywords =
|
|
98
|
+
await import("@marimo-team/codemirror-sql/data/duckdb-keywords.json");
|
|
101
99
|
return {
|
|
102
100
|
...keywords.default.keywords,
|
|
103
101
|
...duckdbKeywords.default.keywords,
|
|
@@ -77,9 +77,7 @@ function getLatestEngine(): ConnectionName {
|
|
|
77
77
|
/**
|
|
78
78
|
* Language adapter for SQL.
|
|
79
79
|
*/
|
|
80
|
-
export class SQLLanguageAdapter
|
|
81
|
-
implements LanguageAdapter<SQLLanguageAdapterMetadata>
|
|
82
|
-
{
|
|
80
|
+
export class SQLLanguageAdapter implements LanguageAdapter<SQLLanguageAdapterMetadata> {
|
|
83
81
|
private parser = new SQLParser();
|
|
84
82
|
readonly type = "sql";
|
|
85
83
|
sqlModeEnabled: boolean;
|