aglinxinyuan opened a new pull request, #4997:
URL: https://github.com/apache/texera/pull/4997
Closes #4996.
## Summary
Brings the frontend's Monaco / VS Code language-client stack up to
`monaco-languageclient` v10 (from v8.8.3) and the matching
`@codingame/monaco-vscode-*` v25.1.2 ecosystem. v10 split the old
single-wrapper API into three composable pieces, so the editor component is
rewritten and the build/test pipeline picks up the codingame v25 quirks the new
packages introduce. Adjacent dep cleanups land here too — several codingame
side-deps and the R UDF editor become superfluous once v10 is in place.
## API shape: v8 → v10
```
v8 (before) v10 (after)
─────────────────
──────────────────────────────────
new MonacoEditorLanguageClientWrapper( const api = new
MonacoVscodeApiWrapper(...)
// single config with editor + LSP + workers const app = new
EditorApp(...)
// all in one bag const lc = new
LanguageClientWrapper(...)
).start(htmlContainer) await api.start();
// global vscode-api init
await
app.start(container);// mount editor
await lc.start();
// open WebSocket to LS
```
`code-editor.component.ts` is rewritten against the new shape, plus a
`whenReady()` handshake on the default language extensions and a post-mount
`forceTokenization` loop to fix a TextMate first-paint race that otherwise
renders every token as the default `mtk1` class.
## Diff at a glance (excluding `yarn.lock`)
| Area | File(s) | Change |
|---|---|---|
| API rewrite | `code-editor.component.ts` | v10 wrapper triplet,
`whenReady()` await, forceTokenization fix |
| Worker bundling | `workers/{editor,extension-host,textmate}.worker.ts` |
three one-line trampolines that re-export the codingame worker entries (see
*Worker bundling* below) |
| Webpack config | `custom-webpack.config.js` | patches
`license-webpack-plugin` for codingame's empty `descriptionFileRoot`, adds
`oneOf` CSS rule with `exportType: 'css-style-sheet'`, aliases codingame's
css-loader/style-loader paths |
| Test polyfills | `jsdom-svg-polyfill.ts` | inline `data:`-URL Node ESM
loader hook that swallows transitive `.css`; stubs for Constructable
Stylesheets, `CSS.escape`, `matchMedia`, `requestIdleCallback`, WebSocket |
| Editor scaffolding | `code-debugger.component.ts`,
`result-table-frame.component.spec.ts` | small follow-on edits to match new
monaco types |
| Dep cleanup | `package.json`, `LICENSE-binary`, `yarn.lock` | drop ~6
codingame side-deps + the `vscode` direct dep + resolution + retire R UDF; pin
via the new v25 stack |
Total non-`yarn.lock` diff: 12 files, **+527 / −169** lines.
## Worker bundling: why three trampolines
```
code-editor.component.ts
workers/editor.worker.ts (1 line)
│ │
│ new Worker(new URL("./workers/editor.worker", │ import
"@codingame/monaco-vscode-editor-api/
│ import.meta.url), │
esm/vs/editor/editor.worker.js";
│ { type: "module" }) │
│ │
↓ ↓
webpack 5: literal relative URL → emits worker chunk codingame source
becomes the
esbuild : same literal → resolves on-disk → bundles bundled worker
entry
the imported codingame module into specs
```
Both extremes were tried. Inlining `new URL("@codingame/...",
import.meta.url)` makes webpack happy but esbuild treats the spec as a literal
relative URL and the spec pre-bundle fails. A `fileReplacements`-swapped
factory file works but adds an `angular.json` delta. Trampolines satisfy both
bundlers with zero `angular.json` change.
## What gets dropped
| | Why |
|---|---|
| `@codingame/monaco-vscode-textmate-service-override` | now a transitive of
the v25 wrapper; not needed at top level |
| `@codingame/monaco-vscode-theme-defaults-default-extension` | same —
pulled in transitively by the language extensions |
| `@codingame/monaco-vscode-r-default-extension` | upstream stopped
publishing; R UDF editor retired |
| `vscode` (package alias + `resolutions`) | v10 no longer needs the alias
for type-only `vscode.Uri` references |
| `webpack-bundle-analyzer` + `analyze` script | dead — script never ran in
CI |
| `content-disposition` + `@types/content-disposition` | dead `require` in
`download.service.ts`, never read |
## Verification
- [x] `yarn install` resolves cleanly
- [x] `yarn build` exits 0; worker chunks identical hashes/sizes (~1.3 MB
textmate, ~518 KB ext-host, ~220 KB editor)
- [x] `yarn test` stays at **63 / 269** spec parity
- [ ] Smoke-test the Python UDF editor (language detection, syntax colour
first paint, breakpoints, collaborative cursors)
## Test plan
- [ ] Open a workflow with a Python UDF — confirm syntax highlighting
renders correctly on first open
- [ ] Set / clear / step through a breakpoint with the debugger panel
- [ ] Verify the AI-assistant "Add Type Annotation" / "Add All Type
Annotations" actions still work
- [ ] Check that two browser tabs editing the same workflow show each
other's coeditor cursors
- [ ] Run a Java UDF and confirm the editor shows Java syntax (no LSP, just
grammar)
## Notes for reviewers
- This branch overlaps with #4980 (drop unused `content-disposition` dep).
Once #4980 lands, rebasing this branch will auto-resolve those lines (the
duplicate-removal commit becomes a no-op for them).
- The umbrella issue (#4996) carries the high-level rationale; this PR is
the implementation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]