[mod] highlightWhitespace

This commit is contained in:
Andy Bunce 2025-10-20 15:21:47 +01:00
parent 55fef63678
commit be12f0200c
7 changed files with 347 additions and 338 deletions

View file

@ -2,7 +2,7 @@
import { EditorState, StateEffect, Compartment } from '@codemirror/state';
import {
lineNumbers, highlightActiveLineGutter, highlightSpecialChars,
lineNumbers, highlightActiveLineGutter, highlightWhitespace,
drawSelection, rectangularSelection, crosshairCursor, highlightActiveLine,
keymap, dropCursor, EditorView
} from '@codemirror/view';
@ -37,12 +37,14 @@ let create = (v) => {
const compartment = new Compartment();
let curOpts = {
lineWrap: true,
minimap: true
minimap: true,
highlightWhitespace: true
}
// array of extensions reflecting opts
function optExts(opts) {
let exts = []
if (opts.lineWrap) exts.push(EditorView.lineWrapping)
if (opts.highlightWhitespace) exts.push(highlightWhitespace())
if (opts.minimap) exts.push(
showMinimap.compute(['doc'], (state) => {
return {
@ -82,7 +84,6 @@ function simpleWebSocketTransport(uri) {
const baseExts = [
lineNumbers(),
highlightActiveLineGutter(),
highlightSpecialChars(),
history(),
foldGutter(),
lintGutter(),