feat: replace the CodeMirror 5 code editor with CodeMirror 6 - #557
Draft
lightbulbman wants to merge 16 commits into
Draft
feat: replace the CodeMirror 5 code editor with CodeMirror 6#557lightbulbman wants to merge 16 commits into
lightbulbman wants to merge 16 commits into
Conversation
…er text like the background
…to the code editor
…to the code editor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ad of widening the page
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.
Replaces the CodeMirror 5 code editor, loaded from WordPress through
wp_enqueue_code_editor(), with CodeMirror 6 bundled with the plugin. Targeted for release 4.1.0 or 4.2.0; the changelog entries are under4.1.0 (UPCOMING).Changes
Editor
code_snippets_codemirror_attsfilter is still applied.Themes
config/webpack/postcss-codemirror-theme.ts). Theme names are unchanged, so saved settings carry over.Linting
Autocompletion
scripts/generate-function-index.php(npm run generate:function-index) and loaded on first use.Settings and keymaps
@replit/codemirror-emacs; Vim via@replit/codemirror-vim, loaded only when selected. The Sublime Text keymap provides the most-used Sublime Text shortcuts.Extensibility
code_snippets.editor.extensionsJavaScript filter (@wordpress/hooks) for adding CodeMirror extensions, for code built with the plugin.Dependencies
@wordpress/hooks, and the Replit Emacs, Vim and indentation markers packages. Removes the unused@codemirror/fold0.19 package and@types/codemirror.codemirror@5moves todevDependencies, used only as the source of the theme stylesheets.Developer-facing changes
wp.codeEditorinstances or.CodeMirrorelements.code_snippets_codemirror_attsonly applies the editor settings' own options; WordPress code editor options such asmode,guttersandextraKeysare ignored..cm-editor,.cm-gutters,.cm-activeLine, and so on).enqueue_code_editor()no longer takes a snippet type;enqueue_code_preview_editor()takes the handle of the script that shows previews.Verification
tests/unit/Utils/Editor_Test.phpand updatedManage_Menu_Assets_Test.tests/e2e/code-editor.spec.tscovers loading, keyboard save, bracket closing and indentation, token highlighting, linting, settings, keymaps, the settings preview, autocompletion in each language, templates, indentation guides, trailing spaces, fold markers and preview wrapping.1f36c6ec.tsc --noEmitreports one existing error inInsightsChartViewToggle.tsx, which is unchanged by this branch.editor.jsis about 262 KB gzipped. WordPress's CodeMirror bundle and linters were about 355 KB. The function index is a separate 88 KB chunk and the Vim keymap a separate 38 KB chunk.🤖 Generated with Claude Code