Skip to content

Conversation

@franknoirot
Copy link
Contributor

Built on #9058, more towards #8880. After consolidating KclManager, we need to do a number of things:

  1. Convert as much of the managed state within KclManager that is updated in the execution loop into CodeMirror extensions that register StateFields and EditorView.updateListener.of's to push and pull from CodeMirror state as we can
  2. Eventually, extend KclManager to be able to spin up multiple CodeMirror buffers and manage them independently.
  3. Eventually, remove codemirror-react and instead just mount CodeMirror "statically" as far as React is concerned, because all the state concerning it is completely out of React.

This PR is a small proof-of-concept to show how an aspect of CodeMirror that's bound in React—the theme toggling—can be decoupled from React by converting it to a CodeMirror Extension and adding a method to KclManager to dispatch an effect for it CodeMirror instead. I suspect there might be an even more encapsulated way to define this without a method, which just automatically listens to the reactive value of the setting within the extension definition, but this gets it out of React without losing reactivity for now.

Users should experience no change in behavior after this PR.

@vercel
Copy link

vercel bot commented Nov 26, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
modeling-app Ready Ready Preview Comment Dec 5, 2025 3:24pm

@franknoirot franknoirot changed the base branch from main to franknoirot/8880/kill-a-provider November 26, 2025 17:15
@franknoirot franknoirot force-pushed the franknoirot/8880/editor-theme-extension branch from dfccc37 to fa421d3 Compare November 26, 2025 19:10
@franknoirot franknoirot force-pushed the franknoirot/8880/kill-a-provider branch from b4be5ad to a6ed618 Compare November 27, 2025 05:07
Base automatically changed from franknoirot/8880/kill-a-provider to main December 2, 2025 14:09
@franknoirot franknoirot force-pushed the franknoirot/8880/editor-theme-extension branch from 085bf54 to 24fc7df Compare December 3, 2025 03:55
@franknoirot franknoirot marked this pull request as ready for review December 3, 2025 15:23
@franknoirot franknoirot requested a review from a team as a code owner December 3, 2025 15:23
@franknoirot franknoirot force-pushed the franknoirot/8880/editor-theme-extension branch from 137c0d8 to d597bd3 Compare December 3, 2025 17:35
@franknoirot franknoirot force-pushed the franknoirot/8880/editor-theme-extension branch from d597bd3 to 544d780 Compare December 3, 2025 17:37
Copy link
Contributor

@lee-at-zoo-corp lee-at-zoo-corp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow. This is really good! I'm all for this to not being a proof-of-concept. Tested it out in the Vercel preview.

? getSystemTheme()
: settings.app.theme.current,
extensions: [
// Typically we prefer to update CodeMirror outside of React, but this "micro-editor" doesn't exist outside of React.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Micro-editor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad name but like the KCL input field in the command palette, it uses CodeMirror so we can get previous variable lookups and such.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh!

@lee-at-zoo-corp
Copy link
Contributor

Lemme know when to review again / approve!

@franknoirot
Copy link
Contributor Author

@lee-at-zoo-corp I think this will be green and ready for review, just fixed up the merge conflicts.

@lee-at-zoo-corp lee-at-zoo-corp merged commit 0580480 into main Dec 5, 2025
60 of 61 checks passed
@lee-at-zoo-corp lee-at-zoo-corp deleted the franknoirot/8880/editor-theme-extension branch December 5, 2025 16:01
Irev-Dev pushed a commit that referenced this pull request Dec 8, 2025
* Add artifactGraph as StateField on EditorState, add artifact spans as Decorations (#9133)

* Codex: add a CodeMirror extension to show the artifact graph spans in editor

* Clean up types and use doc comments

* Remove visualizations of artifactGraph in EditorState

I want to have a better way of defining debug behaviors before I add
that.

* Fix tsc and lints

* Dependency inject `sceneInfra` and `sceneEntitiesManager` into non-React code (#9167)

* dep inject sceneInfra into modelingMenuCallbackMostActions

* Dep inject sceneInfra into GizmoRenderer

* Dep inject sceneInfra into selections

* Dep inject sceneInfra into useOnFileRoute

* Dep inject sceneInfra into modelingMachine

* Dep inject sceneEntitiesManager (and friends) into modelingMachine

* Singletons *gone* from modelingMachine, huzzah!

* Singletons imports are *gone* from selections!

* Update dependabot config (#9171)

* Update dependabot config from KittyCAD/ciso

* Update dependabot config from KittyCAD/ciso

* Update dependabot config from KittyCAD/ciso

* Update dependabot config from KittyCAD/ciso

* Update dependabot config from KittyCAD/ciso

* Update dependabot config from KittyCAD/ciso

* Update dependabot config from KittyCAD/ciso

* Bump glob from 11.1.0 to 13.0.0 in /.github/actions/github-release in the major group (#9192)

Bump glob in /.github/actions/github-release in the major group

Bumps the major group in /.github/actions/github-release with 1 update: [glob](https://github.com/isaacs/node-glob).


Updates `glob` from 11.1.0 to 13.0.0
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](isaacs/node-glob@v11.1.0...v13.0.0)

---
updated-dependencies:
- dependency-name: glob
  dependency-version: 13.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump taiki-e/install-action from 2.62.38 to 2.62.62 in the patch group (#9196)

Bumps the patch group with 1 update: [taiki-e/install-action](https://github.com/taiki-e/install-action).


Updates `taiki-e/install-action` from 2.62.38 to 2.62.62
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Commits](taiki-e/install-action@v2.62.38...v2.62.62)

---
updated-dependencies:
- dependency-name: taiki-e/install-action
  dependency-version: 2.62.62
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Convert CodeMirror theme toggling behavior to Extension (#9063)

* Convert theme toggling to CodeMirror Extension

* Remove console.trace

* Fix up editor E2E test locator

* Bump crate-ci/typos from 1.38.1 to 1.40.0 in the minor group (#9199)

Bumps the minor group with 1 update: [crate-ci/typos](https://github.com/crate-ci/typos).


Updates `crate-ci/typos` from 1.38.1 to 1.40.0
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](crate-ci/typos@v1.38.1...v1.40.0)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-version: 1.40.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump the patch group in /rust with 5 updates (#9195)

Bumps the patch group in /rust with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [tracing-subscriber](https://github.com/tokio-rs/tracing) | `0.3.20` | `0.3.22` |
| [csscolorparser](https://github.com/mazznoer/csscolorparser-rs) | `0.8.0` | `0.8.1` |
| [winnow](https://github.com/winnow-rs/winnow) | `0.7.13` | `0.7.14` |
| [insta](https://github.com/mitsuhiko/insta) | `1.44.1` | `1.44.3` |
| [wasm-bindgen-test](https://github.com/wasm-bindgen/wasm-bindgen) | `0.3.55` | `0.3.56` |


Updates `tracing-subscriber` from 0.3.20 to 0.3.22
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](tokio-rs/tracing@tracing-subscriber-0.3.20...tracing-subscriber-0.3.22)

Updates `csscolorparser` from 0.8.0 to 0.8.1
- [Release notes](https://github.com/mazznoer/csscolorparser-rs/releases)
- [Changelog](https://github.com/mazznoer/csscolorparser-rs/blob/master/CHANGELOG.md)
- [Commits](mazznoer/csscolorparser-rs@v0.8.0...v0.8.1)

Updates `winnow` from 0.7.13 to 0.7.14
- [Changelog](https://github.com/winnow-rs/winnow/blob/main/CHANGELOG.md)
- [Commits](winnow-rs/winnow@v0.7.13...v0.7.14)

Updates `insta` from 1.44.1 to 1.44.3
- [Release notes](https://github.com/mitsuhiko/insta/releases)
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md)
- [Commits](mitsuhiko/insta@1.44.1...1.44.3)

Updates `wasm-bindgen-test` from 0.3.55 to 0.3.56
- [Release notes](https://github.com/wasm-bindgen/wasm-bindgen/releases)
- [Changelog](https://github.com/wasm-bindgen/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/wasm-bindgen/wasm-bindgen/commits)

---
updated-dependencies:
- dependency-name: tracing-subscriber
  dependency-version: 0.3.22
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch
- dependency-name: csscolorparser
  dependency-version: 0.8.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch
- dependency-name: winnow
  dependency-version: 0.7.14
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch
- dependency-name: insta
  dependency-version: 1.44.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch
- dependency-name: wasm-bindgen-test
  dependency-version: 0.3.56
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Enable retries on integration tests (#9201)

* Bump glob from 11.1.0 to 13.0.0 in /rust/kcl-language-server in the major group (#9193)

Bump glob in /rust/kcl-language-server in the major group

Bumps the major group in /rust/kcl-language-server with 1 update: [glob](https://github.com/isaacs/node-glob).


Updates `glob` from 11.1.0 to 13.0.0
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](isaacs/node-glob@v11.1.0...v13.0.0)

---
updated-dependencies:
- dependency-name: glob
  dependency-version: 13.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Revert "Keep Text-to-CAD credits for consistency in billing indicator" (#9185)

* Revert "Keep Text-to-CAD credits for consistency in billing indicator (#9175)"

This reverts commit 58ef9bf.

* Bump react-shared

* Update package-lock.json (#9207)

* Fix ZK conversation history loss after manually reconnecting (#9205)

* Fix ZK conversation history loss after manually reconnecting
Fixes #9203

* Fix tests

* KCL: Support unary + operator (#9202)

Basically if -3 works then +3 should also work. Part of #9106.

Currently `+` is just identity, it'll return the argument unchanged.

* Add KCL named function expressions (#9206)

* Add function name in function expressions

* Add binding function name

* Update test to verify fn name binding

* Add NodePath to new function name field

* Add new AST field to the digest

* Skip serializing name if it's none

* Update generated output

* Add reviewValidation to Insert to check on execution (#9187)

Fixes #9141

* Update artifact output

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Frank Noirot <frank@zoo.dev>
Co-authored-by: Max Ammann <max@maxammann.org>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jace Browning <jacebrowning@gmail.com>
Co-authored-by: Pierre Jacquier <pierre@zoo.dev>
Co-authored-by: Adam Chalmers <adam.chalmers@zoo.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants