Conversation
30a0b36 to
3c65d55
Compare
There was a problem hiding this comment.
Pull request overview
This PR simplifies the SEL editor configuration surface by centralizing diagnostics/types in @seljs/checker, introducing feature toggles and checkerOptions, and updating editor/React integrations to surface validity alongside value changes.
Changes:
- Switch linting diagnostics types to
@seljs/checkerand simplify linting exports. - Update
SELEditorConfigAPI: addfeatures+checkerOptions, changeonChangeto(value, valid), and remove older validation/custom-extension knobs. - Update editor internals, tests, and React hook/stories to align with the new config API.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/sel-editor/src/linting/sel-linter.ts | Imports SELDiagnostic from @seljs/checker; exports API as export const/interface. |
| packages/sel-editor/src/linting/sel-linter.spec.ts | Updates test type import to @seljs/checker. |
| packages/sel-editor/src/linting/index.ts | Re-exports linting modules via export *. |
| packages/sel-editor/src/linting/diagnostic-mapper.ts | Makes mapCheckResult a direct named export and removes redundant exports. |
| packages/sel-editor/src/editor/types.ts | Introduces SELEditorFeatures, replaces config fields with checkerOptions/features, and updates onChange signature. |
| packages/sel-editor/src/editor/type-display.ts | Refactors to const exports and adjusts update triggering logic. |
| packages/sel-editor/src/editor/index.ts | Removes buildExtensions export; exports new feature type. |
| packages/sel-editor/src/editor/editor-config.ts | Builds extensions based on feature toggles; wires linting to SELChecker; computes validity on change. |
| packages/sel-editor/src/editor/create-editor.ts | Refactors createSELEditor to export const. |
| packages/sel-editor/src/editor/create-editor.spec.ts | Updates tests for new onChange signature and new config fields (checkerOptions, features). |
| packages/sel-editor-react/src/whatsabi-explorer.stories.tsx | Updates story to new features.typeDisplay and adapts onChange. |
| packages/sel-editor-react/src/use-sel-editor.ts | Tracks and returns valid from editor onChange. |
| packages/sel-editor-react/src/use-sel-editor.spec.ts | Updates expectation for new onChange signature. |
| packages/sel-editor-react/src/sel-editor.stories.tsx | Migrates stories from validate/showType to checkerOptions/features. |
| packages/sel-editor-react/src/sel-editor.spec.tsx | Migrates component test from validate to checkerOptions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+64
to
73
| // onChange listener with validity | ||
| if (config.onChange) { | ||
| const onChange = config.onChange; | ||
| extensions.push( | ||
| EditorView.updateListener.of((update) => { | ||
| if (update.docChanged) { | ||
| onChange(update.state.doc.toString()); | ||
| const value = update.state.doc.toString(); | ||
| const result = checker.check(value); | ||
| onChange(value, result.valid); | ||
| } |
Comment on lines
+50
to
+58
| /** | ||
| * Called on every expression change with the current value and validity | ||
| */ | ||
| onChange?: (value: string, valid: boolean) => void; | ||
|
|
||
| /** Debounce delay for validation (default: 300ms) */ | ||
| validateDelay?: number; | ||
| /** | ||
| * Options for the internal SELChecker instance | ||
| */ | ||
| checkerOptions?: SELCheckerOptions; |
| @@ -1,5 +1,4 @@ | |||
| export { createSELEditor } from "./create-editor"; | |||
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.