@marimo-team/islands 0.23.2-dev1 → 0.23.2-dev10
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/{chat-ui-CNHw9Osh.js → chat-ui-Bi0ioKDx.js} +1 -1
- package/dist/main.js +3 -3
- package/dist/{process-output-Bekznt_B.js → process-output-H_7QTreh.js} +2133 -2119
- package/package.json +1 -1
- package/src/components/editor/Output.tsx +1 -1
- package/src/core/codemirror/language/languages/python.ts +9 -9
- package/src/core/codemirror/lsp/__tests__/notebook-lsp.test.ts +8 -1
- package/src/core/codemirror/lsp/federated-lsp.ts +2 -2
- package/src/core/codemirror/lsp/notebook-lsp.ts +2 -2
- package/src/core/codemirror/lsp/utils.ts +21 -6
package/package.json
CHANGED
|
@@ -263,7 +263,7 @@ const MimeBundleOutputRenderer: React.FC<{
|
|
|
263
263
|
const { mode } = useAtomValue(viewStateAtom);
|
|
264
264
|
const appView = mode === "present" || mode === "read";
|
|
265
265
|
|
|
266
|
-
// Extract metadata if present (e.g.,
|
|
266
|
+
// Extract metadata if present (e.g., to maintain a constant display size regardless of DPI/PPI)
|
|
267
267
|
const metadata = mimebundle[METADATA_KEY];
|
|
268
268
|
|
|
269
269
|
// Filter out metadata from the mime entries and type narrow
|
|
@@ -36,7 +36,7 @@ import { FederatedLanguageServerClient } from "../../lsp/federated-lsp";
|
|
|
36
36
|
import { NotebookLanguageServerClient } from "../../lsp/notebook-lsp";
|
|
37
37
|
import { createTransport } from "../../lsp/transports";
|
|
38
38
|
import { CellDocumentUri, type ILanguageServerClient } from "../../lsp/types";
|
|
39
|
-
import {
|
|
39
|
+
import { getLspRootUri, getLspWorkspaceFolders } from "../../lsp/utils";
|
|
40
40
|
import {
|
|
41
41
|
clickablePlaceholderExtension,
|
|
42
42
|
smartPlaceholderExtension,
|
|
@@ -54,8 +54,8 @@ const pylspClient = once((lspConfig: LSPConfig) => {
|
|
|
54
54
|
|
|
55
55
|
const lspClientOpts = {
|
|
56
56
|
transport,
|
|
57
|
-
rootUri:
|
|
58
|
-
workspaceFolders:
|
|
57
|
+
rootUri: getLspRootUri(),
|
|
58
|
+
workspaceFolders: getLspWorkspaceFolders(),
|
|
59
59
|
};
|
|
60
60
|
const config = lspConfig?.pylsp;
|
|
61
61
|
|
|
@@ -161,8 +161,8 @@ const tyLspClient = once((_: LSPConfig) => {
|
|
|
161
161
|
|
|
162
162
|
const lspClientOpts = {
|
|
163
163
|
transport,
|
|
164
|
-
rootUri:
|
|
165
|
-
workspaceFolders:
|
|
164
|
+
rootUri: getLspRootUri(),
|
|
165
|
+
workspaceFolders: getLspWorkspaceFolders(),
|
|
166
166
|
};
|
|
167
167
|
|
|
168
168
|
// We wrap the client in a NotebookLanguageServerClient to add some
|
|
@@ -192,8 +192,8 @@ const pyreflyClient = once(
|
|
|
192
192
|
|
|
193
193
|
const lspClientOpts = {
|
|
194
194
|
transport,
|
|
195
|
-
rootUri:
|
|
196
|
-
workspaceFolders:
|
|
195
|
+
rootUri: getLspRootUri(),
|
|
196
|
+
workspaceFolders: getLspWorkspaceFolders(),
|
|
197
197
|
};
|
|
198
198
|
|
|
199
199
|
// We wrap the client in a NotebookLanguageServerClient to add some
|
|
@@ -230,8 +230,8 @@ const pyrightClient = once((_: LSPConfig) => {
|
|
|
230
230
|
|
|
231
231
|
const lspClientOpts = {
|
|
232
232
|
transport,
|
|
233
|
-
rootUri:
|
|
234
|
-
workspaceFolders:
|
|
233
|
+
rootUri: getLspRootUri(),
|
|
234
|
+
workspaceFolders: getLspWorkspaceFolders(),
|
|
235
235
|
};
|
|
236
236
|
|
|
237
237
|
// We wrap the client in a NotebookLanguageServerClient to add some
|
|
@@ -12,6 +12,7 @@ import { cellId } from "@/__tests__/branded";
|
|
|
12
12
|
import type { CellId } from "@/core/cells/ids";
|
|
13
13
|
import { store } from "@/core/state/jotai";
|
|
14
14
|
import { topologicalCodesAtom } from "../../copilot/getCodes";
|
|
15
|
+
import { lspWorkspaceAtom } from "@/core/saving/file-state";
|
|
15
16
|
import { languageAdapterState } from "../../language/extension";
|
|
16
17
|
import { PythonLanguageAdapter } from "../../language/languages/python";
|
|
17
18
|
import { languageMetadataField } from "../../language/metadata";
|
|
@@ -285,6 +286,12 @@ describe("NotebookLanguageServerClient", () => {
|
|
|
285
286
|
},
|
|
286
287
|
};
|
|
287
288
|
}
|
|
289
|
+
if (atom === lspWorkspaceAtom) {
|
|
290
|
+
return {
|
|
291
|
+
rootUri: "file:///project",
|
|
292
|
+
documentUri: "file:///project/__marimo_notebook__.py",
|
|
293
|
+
};
|
|
294
|
+
}
|
|
288
295
|
return undefined;
|
|
289
296
|
});
|
|
290
297
|
|
|
@@ -421,7 +428,7 @@ describe("NotebookLanguageServerClient", () => {
|
|
|
421
428
|
expect(result).toEqual(mockCompletionResponse);
|
|
422
429
|
expect(mockClient.textDocumentCompletion).toHaveBeenCalledWith(
|
|
423
430
|
expect.objectContaining({
|
|
424
|
-
textDocument: { uri: "file:///__marimo_notebook__.py" },
|
|
431
|
+
textDocument: { uri: "file:///project/__marimo_notebook__.py" },
|
|
425
432
|
}),
|
|
426
433
|
);
|
|
427
434
|
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import type * as LSP from "vscode-languageserver-protocol";
|
|
4
4
|
import { Objects } from "@/utils/objects";
|
|
5
5
|
import type { ILanguageServerClient } from "./types";
|
|
6
|
-
import {
|
|
6
|
+
import { getLspDocumentUri } from "./utils";
|
|
7
7
|
|
|
8
8
|
function removeFalseyValues<T extends object>(obj: T): T {
|
|
9
9
|
return Objects.filter(obj, (value) => value !== false && value !== null) as T;
|
|
@@ -20,7 +20,7 @@ export class FederatedLanguageServerClient implements ILanguageServerClient {
|
|
|
20
20
|
|
|
21
21
|
constructor(clients: ILanguageServerClient[]) {
|
|
22
22
|
this.clients = clients;
|
|
23
|
-
this.documentUri =
|
|
23
|
+
this.documentUri = getLspDocumentUri();
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
onNotification(
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
type ILanguageServerClient,
|
|
23
23
|
isClientWithNotify,
|
|
24
24
|
} from "./types";
|
|
25
|
-
import {
|
|
25
|
+
import { getLspDocumentUri } from "./utils";
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Check if a variable name is private (starts with underscore but not dunder).
|
|
@@ -189,7 +189,7 @@ export class NotebookLanguageServerClient implements ILanguageServerClient {
|
|
|
189
189
|
EditorView | null | undefined
|
|
190
190
|
> = defaultGetNotebookEditors,
|
|
191
191
|
) {
|
|
192
|
-
this.documentUri =
|
|
192
|
+
this.documentUri = getLspDocumentUri();
|
|
193
193
|
this.getNotebookEditors = getNotebookEditors;
|
|
194
194
|
this.initialSettings = initialSettings;
|
|
195
195
|
this.client = client;
|
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { lspWorkspaceAtom } from "@/core/saving/file-state";
|
|
3
|
+
import { store } from "@/core/state/jotai";
|
|
4
4
|
|
|
5
|
-
export function
|
|
6
|
-
|
|
5
|
+
export function getLspRootUri() {
|
|
6
|
+
const lspWorkspace = store.get(lspWorkspaceAtom);
|
|
7
|
+
// The backend provides rootUri for active notebook sessions.
|
|
8
|
+
// For non-notebook pages (home, gallery), lspWorkspace is null,
|
|
9
|
+
// so return a valid file URI fallback.
|
|
10
|
+
return lspWorkspace?.rootUri ?? "file:///";
|
|
7
11
|
}
|
|
8
12
|
|
|
9
|
-
export function
|
|
10
|
-
|
|
13
|
+
export function getLspWorkspaceFolders() {
|
|
14
|
+
const lspWorkspace = store.get(lspWorkspaceAtom);
|
|
15
|
+
const rootUri = lspWorkspace?.rootUri;
|
|
16
|
+
// Return workspace folders only if rootUri is set; empty array otherwise.
|
|
17
|
+
return rootUri ? [{ uri: rootUri, name: "marimo" }] : [];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function getLspDocumentUri() {
|
|
21
|
+
const lspWorkspace = store.get(lspWorkspaceAtom);
|
|
22
|
+
// The backend provides documentUri for active notebook sessions.
|
|
23
|
+
// For non-notebook pages (home, gallery), lspWorkspace is null,
|
|
24
|
+
// so return a valid file URI fallback.
|
|
25
|
+
return lspWorkspace?.documentUri ?? "file:///__marimo_notebook__.py";
|
|
11
26
|
}
|