@marimo-team/islands 0.19.7-dev45 → 0.19.7-dev47
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
CHANGED
|
@@ -17762,7 +17762,7 @@ ${JSON.stringify(e2, null, 4)}`);
|
|
|
17762
17762
|
label: f,
|
|
17763
17763
|
detail: (d == null ? void 0 : d.detail) || c,
|
|
17764
17764
|
apply(e2, c2, d2, _2) {
|
|
17765
|
-
if (v && isLSPTextEdit(v) ? e2.dispatch(insertCompletionText(e2.state, v.newText, posToOffsetOrZero(e2.state.doc, v.range.start), posToOffsetOrZero(e2.state.doc, v.range.end))) : y && E === InsertTextFormat.Snippet && r.useSnippetOnCompletion ? snippet(convertSnippet(y))(e2, null, d2, _2) : e2.dispatch(insertCompletionText(e2.state, f, d2, _2)), !w) return;
|
|
17765
|
+
if (v && isLSPTextEdit(v) ? e2.dispatch(insertCompletionText(e2.state, v.newText, posToOffsetOrZero(e2.state.doc, v.range.start), posToOffsetOrZero(e2.state.doc, v.range.end))) : y && E === InsertTextFormat.Snippet && r.useSnippetOnCompletion ? snippet(convertSnippet(y))(e2, null, d2, _2) : e2.dispatch(insertCompletionText(e2.state, y || f, d2, _2)), !w) return;
|
|
17766
17766
|
let S2 = w.sort(({ range: { end: r2 } }, { range: { end: c3 } }) => posToOffsetOrZero(e2.state.doc, r2) < posToOffsetOrZero(e2.state.doc, c3) ? 1 : posToOffsetOrZero(e2.state.doc, r2) > posToOffsetOrZero(e2.state.doc, c3) ? -1 : 0);
|
|
17767
17767
|
for (let r2 of S2) e2.dispatch(e2.state.update({
|
|
17768
17768
|
changes: {
|
|
@@ -32350,7 +32350,6 @@ ${c.sqlString}
|
|
|
32350
32350
|
var Snapshotter = class {
|
|
32351
32351
|
constructor(e) {
|
|
32352
32352
|
__publicField(this, "documentVersion", 0);
|
|
32353
|
-
__publicField(this, "versionToCellNumberAndVersion", new LRUCache(20));
|
|
32354
32353
|
__publicField(this, "lastSnapshot", null);
|
|
32355
32354
|
this.getNotebookCode = e;
|
|
32356
32355
|
}
|
|
@@ -32367,11 +32366,6 @@ ${c.sqlString}
|
|
|
32367
32366
|
version: this.documentVersion
|
|
32368
32367
|
};
|
|
32369
32368
|
}
|
|
32370
|
-
getSnapshot(e) {
|
|
32371
|
-
let r = this.versionToCellNumberAndVersion.get(e);
|
|
32372
|
-
if (!r) throw Error(`No snapshot for version ${e}`);
|
|
32373
|
-
return r;
|
|
32374
|
-
}
|
|
32375
32369
|
getLatestSnapshot() {
|
|
32376
32370
|
if (!this.lastSnapshot) throw Error("No snapshots");
|
|
32377
32371
|
return {
|
|
@@ -32611,13 +32605,26 @@ ${c.sqlString}
|
|
|
32611
32605
|
}), d.contents === "" ? null : (d.range && (d.range = r.reverseRange(d.range, c)), d)) : (Logger.debug("[lsp] no hover result"), d);
|
|
32612
32606
|
}
|
|
32613
32607
|
async textDocumentCompletion(e) {
|
|
32614
|
-
let { lens: r } = this.snapshotter.getLatestSnapshot()
|
|
32608
|
+
let { lens: r } = this.snapshotter.getLatestSnapshot();
|
|
32609
|
+
if (!CellDocumentUri.is(e.textDocument.uri)) return Logger.error("[lsp] Invalid cell document URI in completion request", e.textDocument.uri), null;
|
|
32610
|
+
let c = CellDocumentUri.parse(e.textDocument.uri);
|
|
32611
|
+
if (!c || c === "undefined") return Logger.error("[lsp] Invalid cellId 'undefined' in completion request", {
|
|
32612
|
+
cellId: c,
|
|
32613
|
+
uri: e.textDocument.uri,
|
|
32614
|
+
availableCellIds: r.cellIds
|
|
32615
|
+
}), null;
|
|
32616
|
+
r.cellIds.includes(c) || Logger.warn("[lsp] CellId in completion request not found in current lens", {
|
|
32617
|
+
cellId: c,
|
|
32618
|
+
uri: e.textDocument.uri,
|
|
32619
|
+
availableCellIds: r.cellIds
|
|
32620
|
+
});
|
|
32621
|
+
let d = r.transformPosition(e.position, c);
|
|
32615
32622
|
return this.client.textDocumentCompletion({
|
|
32616
32623
|
...e,
|
|
32617
32624
|
textDocument: {
|
|
32618
32625
|
uri: this.documentUri
|
|
32619
32626
|
},
|
|
32620
|
-
position:
|
|
32627
|
+
position: d
|
|
32621
32628
|
});
|
|
32622
32629
|
}
|
|
32623
32630
|
patchProcessNotification() {
|
|
@@ -32944,7 +32951,7 @@ ${c.sqlString}
|
|
|
32944
32951
|
client: r2,
|
|
32945
32952
|
languageId: "python",
|
|
32946
32953
|
allowHTMLContent: true,
|
|
32947
|
-
useSnippetOnCompletion:
|
|
32954
|
+
useSnippetOnCompletion: true,
|
|
32948
32955
|
hoverConfig: _,
|
|
32949
32956
|
completionConfig: d2,
|
|
32950
32957
|
diagnosticsEnabled: ((_d2 = f.diagnostics) == null ? void 0 : _d2.enabled) ?? false,
|
|
@@ -73168,7 +73175,7 @@ Image URL: ${r.imageUrl}`)), contextToXml({
|
|
|
73168
73175
|
return Logger.warn("Failed to get version from mount config"), null;
|
|
73169
73176
|
}
|
|
73170
73177
|
}
|
|
73171
|
-
const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.19.7-
|
|
73178
|
+
const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.19.7-dev47"), showCodeInRunModeAtom = atom(true);
|
|
73172
73179
|
atom(null);
|
|
73173
73180
|
var import_compiler_runtime$88 = require_compiler_runtime();
|
|
73174
73181
|
function useKeydownOnElement(e, r) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marimo-team/islands",
|
|
3
|
-
"version": "0.19.7-
|
|
3
|
+
"version": "0.19.7-dev47",
|
|
4
4
|
"main": "dist/main.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@lezer/markdown": "^1.6.2",
|
|
56
56
|
"@lezer/python": "^1.1.18",
|
|
57
57
|
"@marimo-team/codemirror-ai": "^0.3.5",
|
|
58
|
-
"@marimo-team/codemirror-languageserver": "^1.16.
|
|
58
|
+
"@marimo-team/codemirror-languageserver": "^1.16.11",
|
|
59
59
|
"@marimo-team/codemirror-mcp": "^0.1.5",
|
|
60
60
|
"@marimo-team/codemirror-sql": "^0.2.4",
|
|
61
61
|
"@marimo-team/llm-info": "workspace:*",
|
|
@@ -293,7 +293,7 @@ export class PythonLanguageAdapter implements LanguageAdapter<{}> {
|
|
|
293
293
|
client: client as unknown as LanguageServerClient,
|
|
294
294
|
languageId: "python",
|
|
295
295
|
allowHTMLContent: true,
|
|
296
|
-
useSnippetOnCompletion:
|
|
296
|
+
useSnippetOnCompletion: true,
|
|
297
297
|
hoverConfig: hoverOptions,
|
|
298
298
|
completionConfig: autocompleteOptions,
|
|
299
299
|
// Default to false
|
|
@@ -47,13 +47,6 @@ class Snapshotter {
|
|
|
47
47
|
this.getNotebookCode = getNotebookCode;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
/**
|
|
51
|
-
* Map from the global document version to the cell id and version.
|
|
52
|
-
*/
|
|
53
|
-
private versionToCellNumberAndVersion = new LRUCache<number, NotebookLens>(
|
|
54
|
-
20,
|
|
55
|
-
);
|
|
56
|
-
|
|
57
50
|
private lastSnapshot: NotebookLens | null = null;
|
|
58
51
|
|
|
59
52
|
public snapshot() {
|
|
@@ -78,14 +71,6 @@ class Snapshotter {
|
|
|
78
71
|
};
|
|
79
72
|
}
|
|
80
73
|
|
|
81
|
-
public getSnapshot(version: number) {
|
|
82
|
-
const snapshot = this.versionToCellNumberAndVersion.get(version);
|
|
83
|
-
if (!snapshot) {
|
|
84
|
-
throw new Error(`No snapshot for version ${version}`);
|
|
85
|
-
}
|
|
86
|
-
return snapshot;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
74
|
public getLatestSnapshot() {
|
|
90
75
|
if (!this.lastSnapshot) {
|
|
91
76
|
throw new Error("No snapshots");
|
|
@@ -657,14 +642,49 @@ export class NotebookLanguageServerClient implements ILanguageServerClient {
|
|
|
657
642
|
|
|
658
643
|
public async textDocumentCompletion(params: LSP.CompletionParams) {
|
|
659
644
|
const { lens } = this.snapshotter.getLatestSnapshot();
|
|
645
|
+
|
|
646
|
+
// Check if URI is valid
|
|
647
|
+
if (!CellDocumentUri.is(params.textDocument.uri)) {
|
|
648
|
+
Logger.error(
|
|
649
|
+
"[lsp] Invalid cell document URI in completion request",
|
|
650
|
+
params.textDocument.uri,
|
|
651
|
+
);
|
|
652
|
+
return null;
|
|
653
|
+
}
|
|
654
|
+
|
|
660
655
|
const cellId = CellDocumentUri.parse(params.textDocument.uri);
|
|
661
656
|
|
|
657
|
+
// Check if cellId is valid (not undefined string)
|
|
658
|
+
if (!cellId || cellId === "undefined") {
|
|
659
|
+
Logger.error("[lsp] Invalid cellId 'undefined' in completion request", {
|
|
660
|
+
cellId,
|
|
661
|
+
uri: params.textDocument.uri,
|
|
662
|
+
availableCellIds: lens.cellIds,
|
|
663
|
+
});
|
|
664
|
+
// Return null to fail gracefully instead of sending wrong position
|
|
665
|
+
return null;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
// Warn if cellId not found in lens (might be okay if cell was just added)
|
|
669
|
+
if (!lens.cellIds.includes(cellId)) {
|
|
670
|
+
Logger.warn(
|
|
671
|
+
"[lsp] CellId in completion request not found in current lens",
|
|
672
|
+
{
|
|
673
|
+
cellId,
|
|
674
|
+
uri: params.textDocument.uri,
|
|
675
|
+
availableCellIds: lens.cellIds,
|
|
676
|
+
},
|
|
677
|
+
);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
const transformedPosition = lens.transformPosition(params.position, cellId);
|
|
681
|
+
|
|
662
682
|
return this.client.textDocumentCompletion({
|
|
663
683
|
...params,
|
|
664
684
|
textDocument: {
|
|
665
685
|
uri: this.documentUri,
|
|
666
686
|
},
|
|
667
|
-
position:
|
|
687
|
+
position: transformedPosition,
|
|
668
688
|
});
|
|
669
689
|
}
|
|
670
690
|
|