Skip to content

Commit

Permalink
Upgrade to CodeMirror 6.
Browse files Browse the repository at this point in the history
Some features of this change are improved syntax highlighting and
the addition of autocompletion.  To see available autocompletions at the
current cursor location, you can type Ctrl-Space.  In many cases,
autocompletions are offered automatically when certain things have been
typed.

CodeMirror 6 can not be used via script tags.  So a PGProblemEditor
package has been created for this.  The repository for that is
https://github.com/openwebwork/pg-problem-editor.  An initial package
has been published in npm at
https://www.npmjs.com/package/@openwebwork/pg-codemirror-editor. The
real work is done in the codemirror-lang-pg package that adds support
for the PG language in CodeMirror 6.  The repository for that package is
https://github.com/openwebwork/codemirror-lang-pg, and the npm package
at https://www.npmjs.com/package/@openwebwork/codemirror-lang-pg.  This
package is designed so that it can be used by webwork2, the standalone
renderer, and possible others that want a PG problem editor.  It may
need a few tweaks to make it work for webwork3 in the future, but should
also work for that.

Note that the configuration of theme, keymaps, and such are now part of
the pg-codemirror-editor, and are shown in a panel of the editor
instead of below as before.

Emacs and Vim keymaps are available, but at this point there is not a
Sublime keymap for CodeMirror 6.

The themes that are available include a basic default theme (that is
part of the pg-problem-editor package and just adds some syntax
highlighting that is missing from the CodeMirror 6 default), the OndDark
theme that is the only other theme provided by the CodeMirror 6
developers directly, the themes in the thememirror package, and the
themes from https://github.com/craftzdog/cm6-themes which are in several
separate npm packages.  Note that both thememirror and
craftzdog/cm6-themes provide a solarized light theme, and that is why
there are two of those.  They are slightly different though.

I am sure that there is a lot more work to do on this, and there are
other things available with CodeMirror 6 that could probably be
implemented.  In any case, this is a good start.
  • Loading branch information
drgrice1 committed Oct 7, 2024
1 parent 137ed73 commit fb84404
Show file tree
Hide file tree
Showing 15 changed files with 964 additions and 2,209 deletions.
1,567 changes: 0 additions & 1,567 deletions htdocs/js/PGCodeMirror/PG.js

This file was deleted.

287 changes: 0 additions & 287 deletions htdocs/js/PGCodeMirror/comment.js

This file was deleted.

Loading

0 comments on commit fb84404

Please sign in to comment.