@marimo-team/islands 0.19.11-dev2 → 0.19.11-dev3

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
@@ -30615,7 +30615,8 @@ ${c.sqlString}
30615
30615
  terminal: false,
30616
30616
  pylsp: false,
30617
30617
  basedpyright: false,
30618
- ty: false
30618
+ ty: false,
30619
+ pyrefly: false
30619
30620
  });
30620
30621
  function hasCapability(e) {
30621
30622
  var _a2;
@@ -32891,6 +32892,21 @@ ${c.sqlString}
32891
32892
  ]
32892
32893
  }), {});
32893
32894
  return r = () => c.resyncAllDocuments(), c;
32895
+ }), pyreflyClient = once((e) => {
32896
+ var _a2;
32897
+ let r, c = new NotebookLanguageServerClient(new LanguageServerClient({
32898
+ transport: createTransport("pyrefly", async () => {
32899
+ await (r == null ? void 0 : r());
32900
+ }),
32901
+ rootUri: getLSPDocumentRootUri(),
32902
+ workspaceFolders: [],
32903
+ initializationOptions: {
32904
+ pyrefly: {
32905
+ displayTypeErrors: ((_a2 = e.diagnostics) == null ? void 0 : _a2.enabled) ?? false ? "force-on" : "force-off"
32906
+ }
32907
+ }
32908
+ }), {});
32909
+ return r = () => c.resyncAllDocuments(), c;
32894
32910
  }), pyrightClient = once((e) => {
32895
32911
  let r, c = new NotebookLanguageServerClient(new LanguageServerClient({
32896
32912
  transport: createTransport("basedpyright", async () => {
@@ -32928,7 +32944,7 @@ ${c.sqlString}
32928
32944
  getExtension(e, r, c, d, f) {
32929
32945
  return [
32930
32946
  (() => {
32931
- var _a2, _b3, _c3, _d2;
32947
+ var _a2, _b3, _c3, _d2, _e8;
32932
32948
  let d2 = {
32933
32949
  defaultKeymap: false,
32934
32950
  activateOnTyping: r.activate_on_typing,
@@ -32936,7 +32952,7 @@ ${c.sqlString}
32936
32952
  }, _ = {
32937
32953
  hideOnChange: true
32938
32954
  }, v = [];
32939
- ((_a2 = f == null ? void 0 : f.pylsp) == null ? void 0 : _a2.enabled) && hasCapability("pylsp") && v.push(pylspClient(f)), ((_b3 = f == null ? void 0 : f.ty) == null ? void 0 : _b3.enabled) && hasCapability("ty") && v.push(tyLspClient(f)), ((_c3 = f == null ? void 0 : f.basedpyright) == null ? void 0 : _c3.enabled) && hasCapability("basedpyright") && v.push(pyrightClient(f));
32955
+ ((_a2 = f == null ? void 0 : f.pylsp) == null ? void 0 : _a2.enabled) && hasCapability("pylsp") && v.push(pylspClient(f)), ((_b3 = f == null ? void 0 : f.ty) == null ? void 0 : _b3.enabled) && hasCapability("ty") && v.push(tyLspClient(f)), ((_c3 = f == null ? void 0 : f.pyrefly) == null ? void 0 : _c3.enabled) && hasCapability("pyrefly") && v.push(pyreflyClient(f)), ((_d2 = f == null ? void 0 : f.basedpyright) == null ? void 0 : _d2.enabled) && hasCapability("basedpyright") && v.push(pyrightClient(f));
32940
32956
  let y = r.signature_hint_on_typing, S = y ? /(\w+|\w+\.|\/)$/ : /(\w+|\w+\.|\(|\/|,)$/;
32941
32957
  if (v.length > 0) {
32942
32958
  let r2 = v.length === 1 ? v[0] : new FederatedLanguageServerClient(v);
@@ -32948,7 +32964,7 @@ ${c.sqlString}
32948
32964
  useSnippetOnCompletion: true,
32949
32965
  hoverConfig: _,
32950
32966
  completionConfig: d2,
32951
- diagnosticsEnabled: ((_d2 = f.diagnostics) == null ? void 0 : _d2.enabled) ?? false,
32967
+ diagnosticsEnabled: ((_e8 = f.diagnostics) == null ? void 0 : _e8.enabled) ?? false,
32952
32968
  sendIncrementalChanges: false,
32953
32969
  signatureHelpEnabled: true,
32954
32970
  signatureActivateOnTyping: y,
@@ -73307,7 +73323,7 @@ Image URL: ${r.imageUrl}`)), contextToXml({
73307
73323
  return Logger.warn("Failed to get version from mount config"), null;
73308
73324
  }
73309
73325
  }
73310
- const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.19.11-dev2"), showCodeInRunModeAtom = atom(true);
73326
+ const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.19.11-dev3"), showCodeInRunModeAtom = atom(true);
73311
73327
  atom(null);
73312
73328
  var import_compiler_runtime$88 = require_compiler_runtime();
73313
73329
  function useKeydownOnElement(e, r) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.19.11-dev2",
3
+ "version": "0.19.11-dev3",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -228,6 +228,7 @@ export const UserConfigForm: React.FC = () => {
228
228
  pylsp: true,
229
229
  ty: true,
230
230
  basedpyright: true,
231
+ pyrefly: true,
231
232
  };
232
233
  }
233
234
 
@@ -672,6 +673,48 @@ export const UserConfigForm: React.FC = () => {
672
673
  </div>
673
674
  )}
674
675
  />
676
+ <FormField
677
+ control={form.control}
678
+ name="language_servers.pyrefly.enabled"
679
+ render={({ field }) => (
680
+ <div className="flex flex-col gap-1">
681
+ <FormItem className={formItemClasses}>
682
+ <FormLabel>
683
+ <Badge variant="defaultOutline" className="mr-2">
684
+ Beta
685
+ </Badge>
686
+ Pyrefly (
687
+ <ExternalLink href="https://github.com/facebook/pyrefly">
688
+ docs
689
+ </ExternalLink>
690
+ )
691
+ </FormLabel>
692
+ <FormControl>
693
+ <Checkbox
694
+ data-testid="pyrefly-checkbox"
695
+ checked={field.value}
696
+ disabled={field.disabled}
697
+ onCheckedChange={(checked) => {
698
+ field.onChange(Boolean(checked));
699
+ }}
700
+ />
701
+ </FormControl>
702
+ <FormMessage />
703
+ <IsOverridden
704
+ userConfig={config}
705
+ name="language_servers.pyrefly.enabled"
706
+ />
707
+ </FormItem>
708
+ {field.value && !capabilities.pyrefly && (
709
+ <Banner kind="danger">
710
+ Pyrefly is not available in your current environment.
711
+ Please install <Kbd className="inline">pyrefly</Kbd> in
712
+ your environment.
713
+ </Banner>
714
+ )}
715
+ </div>
716
+ )}
717
+ />
675
718
  <FormField
676
719
  control={form.control}
677
720
  name="language_servers.ty.enabled"
@@ -175,6 +175,44 @@ const tyLspClient = once((_: LSPConfig) => {
175
175
  return notebookClient;
176
176
  });
177
177
 
178
+ const pyreflyClient = once(
179
+ (lspConfig: LSPConfig & { diagnostics: DiagnosticsConfig }) => {
180
+ let resyncCallback: (() => Promise<void>) | undefined;
181
+
182
+ const transport = createTransport("pyrefly", async () => {
183
+ await resyncCallback?.();
184
+ });
185
+
186
+ const lspClientOpts = {
187
+ transport,
188
+ rootUri: getLSPDocumentRootUri(),
189
+ workspaceFolders: [],
190
+ };
191
+
192
+ // We wrap the client in a NotebookLanguageServerClient to add some
193
+ // additional functionality to handle multiple cells
194
+ const notebookClient = new NotebookLanguageServerClient(
195
+ new LanguageServerClient({
196
+ ...lspClientOpts,
197
+ initializationOptions: {
198
+ pyrefly: {
199
+ displayTypeErrors:
200
+ (lspConfig.diagnostics?.enabled ?? false)
201
+ ? "force-on"
202
+ : "force-off",
203
+ },
204
+ },
205
+ }),
206
+ {},
207
+ );
208
+
209
+ // Set the resync callback now that the client exists
210
+ resyncCallback = () => notebookClient.resyncAllDocuments();
211
+
212
+ return notebookClient;
213
+ },
214
+ );
215
+
178
216
  const pyrightClient = once((_: LSPConfig) => {
179
217
  let resyncCallback: (() => Promise<void>) | undefined;
180
218
 
@@ -263,6 +301,9 @@ export class PythonLanguageAdapter implements LanguageAdapter<{}> {
263
301
  if (lspConfig?.ty?.enabled && hasCapability("ty")) {
264
302
  clients.push(tyLspClient(lspConfig));
265
303
  }
304
+ if (lspConfig?.pyrefly?.enabled && hasCapability("pyrefly")) {
305
+ clients.push(pyreflyClient(lspConfig));
306
+ }
266
307
  if (lspConfig?.basedpyright?.enabled && hasCapability("basedpyright")) {
267
308
  clients.push(pyrightClient(lspConfig));
268
309
  }
@@ -14,7 +14,7 @@ import { getRuntimeManager } from "../../runtime/config";
14
14
  * @returns The transport.
15
15
  */
16
16
  export function createTransport(
17
- serverName: "pylsp" | "basedpyright" | "copilot" | "ty",
17
+ serverName: "pylsp" | "basedpyright" | "copilot" | "ty" | "pyrefly",
18
18
  onReconnect?: () => Promise<void>,
19
19
  ) {
20
20
  const runtimeManager = getRuntimeManager();
@@ -8,6 +8,7 @@ export const capabilitiesAtom = atom<Capabilities>({
8
8
  pylsp: false,
9
9
  basedpyright: false,
10
10
  ty: false,
11
+ pyrefly: false,
11
12
  });
12
13
 
13
14
  export function hasCapability(key: keyof Capabilities): boolean {
@@ -140,7 +140,7 @@ export class RuntimeManager {
140
140
  /**
141
141
  * The URL of the copilot server.
142
142
  */
143
- getLSPURL(lsp: "pylsp" | "basedpyright" | "copilot" | "ty"): URL {
143
+ getLSPURL(lsp: "pylsp" | "basedpyright" | "copilot" | "ty" | "pyrefly"): URL {
144
144
  if (lsp === "copilot") {
145
145
  // For copilot, don't include any query parameters
146
146
  const url = this.formatWsURL(`/lsp/${lsp}`);