feat: LSP root and document URI integration from backend#9143
feat: LSP root and document URI integration from backend#9143mscolnick merged 3 commits intomarimo-team:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Bundle ReportChanges will increase total bundle size by 95 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: marimo-esmAssets Changed:
Files in
|
There was a problem hiding this comment.
Pull request overview
Integrates backend-resolved LSP workspace information (root/document URIs) into the frontend so Python language servers use the correct project root (e.g., to pick up pyproject.toml-based basedpyright settings).
Changes:
- Replaced frontend-derived LSP root/document URI computation with values read from
lspWorkspaceAtom. - Updated Python LSP client initialization (pylsp/ty/pyrefly/basedpyright) to pass backend
rootUriand derivedworkspaceFolders. - Updated LSP client wrappers/tests to use the backend-provided
documentUri.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/core/codemirror/lsp/utils.ts | Adds helpers to read backend-provided rootUri / documentUri from Jotai store. |
| frontend/src/core/codemirror/lsp/notebook-lsp.ts | Switches merged document URI source to getLspDocumentUri(). |
| frontend/src/core/codemirror/lsp/federated-lsp.ts | Switches federated client document URI source to getLspDocumentUri(). |
| frontend/src/core/codemirror/lsp/tests/notebook-lsp.test.ts | Adjusts test setup/expectations for backend-provided document URI. |
| frontend/src/core/codemirror/language/languages/python.ts | Initializes all Python LSP clients with backend rootUri + workspace folders. |
8a43448 to
e33007c
Compare
📝 Summary
Closes #8662
This PR implements the frontend integration for the LSP workspace information provided by PR #9019. It updates all language server clients (pylsp, ty, pyrefly, basedpyright) to use the backend-resolved
rootUriandworkspaceFoldersinstead of computing them on the frontend.Changes
1. LSP Utility Functions Migration
File:
frontend/src/core/codemirror/lsp/utils.tsReplaced frontend-side path computation with backend-provided values:
getLspRootUri(): Returns the backend-providedrootUrifromlspWorkspaceAtomgetLspWorkspaceFolders(): Constructs workspace folders array fromrootUrigetLspDocumentUri(): Returns the backend-provideddocumentUrifromlspWorkspaceAtom2. Language Server Client Updates
File:
frontend/src/core/codemirror/language/languages/python.tsUpdated all four LSP clients with consistent initialization:
getLspRootUri()andgetLspWorkspaceFolders()getLspRootUri()andgetLspWorkspaceFolders()getLspRootUri()andgetLspWorkspaceFolders()getLspRootUri()andgetLspWorkspaceFolders()Verification (Screenshots)
Verified using a root
pyproject.tomlwith:Before
The project configuration is ignored because the workspace root was not specified. basedpyright incorrectly reports a warning on line 4 (
func()) despite it being disabled inpyproject.toml.After
The configuration is now correctly applied. The warning on line 4 is suppressed, while a legitimate type error (line 2) is still reported.
📋 Pre-Review Checklist
✅ Merge Checklist