Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions integrations/logseq-native-modes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,32 @@ EJS, ERB, ASP.NET and JSP use the default CodeMirror 5 scriptlet delimiters.
The Elixir tokenizer covers source highlighting, including interpolation and
sigils. It does not parse the contents of regular expressions or embedded
templates.

## Scheme and Common Lisp bracket matching

Logseq enables structural bracket highlighting for Clojure and EDN. The legacy
Scheme and Common Lisp modes provide syntax highlighting, but their token
types cannot reliably identify structural delimiters. With the generic bracket
matcher enabled and the caret just after the opening parenthesis, these inputs
produce the following matches (zero-based UTF-16 offsets).

| Mode | Input | Expected closing offset | Actual closing offset |
| --- | --- | --- | --- |
| Scheme | `'(")")` | 5 | 3 (inside the string) |
| Scheme | `(#\))` | 4 | 3 (character literal) |
| Common Lisp | `(\))` | 3 | 2 (escaped symbol) |

The [Scheme tokenizer](legacy-modes/mode/scheme.ml) uses the same `atom` style
for quoted list delimiters and their contents. It also does not consume the
delimiter glyph in a `#\)` character literal as part of the literal. The
[Common Lisp tokenizer](legacy-modes/mode/commonlisp.ml) consumes the backslash
before classifying the next character, so an escaped `)` gets the same
`bracket` style as a list closer.

The [generic matcher](../../packages/language/bracket_matching.ml) compares
syntax node types when scanning raw characters without delimiter metadata.
The native catalog and upstream CodeMirror Legacy Modes 6.5.5 with Language
6.13.1 reproduce these results. Disabling token merging in upstream
`StreamLanguage` leaves the results unchanged. Reliable matching requires
reader-aware recognition of literals and escapes, plus a way for the matcher
to use only explicitly identified structural delimiters.
Loading