Review main Merged Breaking

73466[!!!][TASK] Upgrade to CodeMirror v6

Benjamin Franzke CR +2 V +2 Nightmare +1102 −8403 updated 09/19/22, 09:25

Commit message

CodeMirror v6 is a major rewrite of CodeMirror v5.
Existing addons and language parsers need to be rewritten.
There is a compatibility layer for parsers though, which we
use for our TypoScript parser (which itself is based on
an old CodeMirror javascript parser).

A migration to a grammar based lexer (based on codemirror @lezer
infrastructure) would be desirable in future.

The TypoScript code completion code is adapted via a small shim
that calculates the line-oriented token-state from the
CodeMirror v6 syntax tree. Rewriting the code completer (which
also parses the object structure) has not been an option, without
also rewriting the TypoScript syntax highlighter.
Ideally, both the parser and the code completion would be based
on a modern lezer grammar based parser, allowing to perform
code completion on a proper TypoScript syntax tree.

CodeMirror v6 is authored as ES6 modules and can therefore
be integrated into our JavaScript importmap infrastructure,
without bundling.

Note that also JavaScript invoke instruction for exported functions
are adapted to allow for empty invoke() JavaScriptModule instructions
to call exported functions as plain function without a `this`-context.
Exported methods must not be called with the ES6 module passed
as this-value/context, as that is forbidden for ES6 module exports:
`JavaScriptModuleInstruction->create('@my/module.js', 'myExport')->invoke()`
instead of
`JavaScriptModuleInstruction->create('@my/module.js')->invoke('myExport')`.
This is needed to be able to use JavaScriptModuleInstruction's
for CodeMirror v6 function exports.

Commands executed:

  npm remove codemirror
  npm install \
    @lezer/common \
    @lezer/lr \
    @codemirror/autocomplete \
    @codemirror/commands \
    @codemirror/language \
    @codemirror/lint \
    @codemirror/search \
    @codemirror/state \
    @codemirror/view \
    @codemirror/lang-css \
    @codemirror/lang-html \
    @codemirror/lang-javascript \
    @codemirror/lang-json \
    @codemirror/lang-php \
    @codemirror/lang-sql \
    @codemirror/lang-xml \
    @codemirror/theme-one-dark
  npm run build

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 2

Files 331

Show 311 more files