Skip to content

Commit 8556be8

Browse files
committed
Release v0.3.1
- demo: tab indentation (real \t, displayed as 4 columns), Tab key bound to indent via indentWithTab so it stays in the editor. - Bump package.json#version.
1 parent cb49d3f commit 8556be8

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

examples/demo.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
// structure inline with the surrounding BSL tree.
88

99
import {EditorView, basicSetup} from "codemirror"
10+
import {keymap} from "@codemirror/view"
1011
import {EditorState, type Extension} from "@codemirror/state"
11-
import {syntaxTree} from "@codemirror/language"
12+
import {syntaxTree, indentUnit} from "@codemirror/language"
13+
import {indentWithTab} from "@codemirror/commands"
1214
import {oneDark} from "@codemirror/theme-one-dark"
1315
import {NodeProp, type Tree as TreeT, type TreeCursor} from "@lezer/common"
1416
import {bsl} from "../src/index"
@@ -268,6 +270,13 @@ function commonExtensions(): Extension[] {
268270
basicSetup,
269271
bsl(),
270272
astUpdater,
273+
// Indentation: real tab character, displayed at 4 columns. `indentWithTab`
274+
// binds the Tab key to insert/dedent rather than focus-shift away from
275+
// the editor, which is the usual surprise when CM6 is dropped onto a
276+
// page without it.
277+
indentUnit.of("\t"),
278+
EditorState.tabSize.of(4),
279+
keymap.of([indentWithTab]),
271280
...(dark ? [oneDark] : [])
272281
]
273282
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@1c-syntax/codemirror-lang-bsl",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"description": "1C:Enterprise / OneScript (BSL) language support for CodeMirror 6",
55
"keywords": [
66
"codemirror",

0 commit comments

Comments
 (0)