-
Notifications
You must be signed in to change notification settings - Fork 96
Convert CodeMirror theme toggling behavior to Extension #9063
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
dfccc37 to
fa421d3
Compare
b4be5ad to
a6ed618
Compare
085bf54 to
24fc7df
Compare
137c0d8 to
d597bd3
Compare
d597bd3 to
544d780
Compare
There was a problem hiding this 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Micro-editor?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh!
|
Lemme know when to review again / approve! |
|
@lee-at-zoo-corp I think this will be green and ready for review, just fixed up the merge conflicts. |
* 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>
Built on #9058, more towards #8880. After consolidating
KclManager, we need to do a number of things:StateFieldsandEditorView.updateListener.of's to push and pull from CodeMirror state as we canKclManagerto be able to spin up multiple CodeMirror buffers and manage them independently.codemirror-reactand instead just mountCodeMirror"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
Extensionand adding a method toKclManagerto 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.