Editor support generalized: shared core, language server, Vim and VS Code (from dev eb5baf9cbe59)

doc/edit/ now holds a shared Python implementation of the language's
structural layer (klammertext_edit.py) and a dependency-free language
server (klammertext_ls.py), with integrations for Emacs, Sublime Text,
Vim, and Visual Studio Code.  The editor test suite in tst/ covers the
core's API and CLI, the language server protocol, the VS Code
extension, headless Vim, and Emacs byte-equality.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-27 15:01:49 +02:00
parent 73ed7f3d5d
commit f855c5ccae
27 changed files with 3918 additions and 1170 deletions

View File

@@ -14,7 +14,7 @@
;; (require 'klammertext-align)
;;
;; Comment that line out to disable alignment entirely. The Sublime Text
;; port doc/sublime/Klammertext_align.py implements the same algorithm —
;; port doc/edit/sublime/Klammertext_align.py implements the same algorithm —
;; keep the two in step.
;;
;; Alignment is for SMALL data items (2026-07-27):
@@ -42,8 +42,11 @@
;; aligned row; run TAB / `indent-region' first if the rows disagree.
;;
;; SYNC: `klammertext-align-klammers' / `-cell-max' / `-row-max' are
;; mirrored as ALIGN_KLAMMERS / CELL_MAX / ROW_MAX in Klammertext_align.py
;; (a Sublime plugin cannot read these defcustoms).
;; mirrored as ALIGN_KLAMMERS / CELL_MAX / ROW_MAX in the shared Python
;; core doc/edit/shared/klammertext_edit.py (the single implementation
;; behind the Sublime, Vim, and VS Code integrations and the language
;; server; this elisp unit stays independent, held equal by
;; tst/editor_test.sh's byte-equality checks).
;;; Code:

View File

@@ -48,11 +48,14 @@
;; Known limitation: a raw @ inside a ^'...'^ literal region would confuse
;; the depth scan (the same limitation as the font-lock scanner).
;;
;; SYNC: the Sublime Text port doc/sublime/Klammertext_indent.py duplicates
;; this file's policy (a Sublime plugin cannot read these defcustoms). When
;; you change `klammertext-indent-offset', `klammertext-transparent-klammers'
;; or `klammertext-code-klammers', mirror the change in that file's
;; INDENT_OFFSET / TRANSPARENT_KLAMMERS / CODE_KLAMMERS.
;; SYNC: the shared Python core doc/edit/shared/klammertext_edit.py — the
;; single implementation behind the Sublime, Vim, and VS Code integrations
;; and the language server — carries this file's policy as INDENT_OFFSET /
;; TRANSPARENT_KLAMMERS / CODE_KLAMMERS (an elisp defcustom cannot be read
;; from Python, so this unit remains an independent implementation, held
;; equal by tst/editor_test.sh's byte-equality checks). When you change
;; `klammertext-indent-offset', `klammertext-transparent-klammers' or
;; `klammertext-code-klammers', mirror the change there.
;;; Code:

View File

@@ -121,14 +121,17 @@ Register one with `klammertext-add-literal-klammer', e.g. in your init file:
:type '(repeat string)
:group 'klammertext)
;; SYNC: the Sublime Text port in doc/sublime/ duplicates this list statically
;; (a Sublime syntax/plugin cannot read this Emacs defcustom). When you add or
;; remove a literal klammer, mirror it in ALL of:
;; * LITERAL_KLAMMERS in doc/sublime/Klammertext.py
;; * LITERAL_KLAMMERS in doc/sublime/Klammertext_indent.py
;; SYNC: the shared Python core doc/edit/shared/klammertext_edit.py (used by
;; the Sublime, Vim, and VS Code integrations and the language server) holds
;; this list as LITERAL_KLAMMERS, and the static per-editor syntax files
;; restate it (a tokenizer cannot read a defcustom or a Python module). When
;; you add or remove a literal klammer, mirror it in ALL of:
;; * LITERAL_KLAMMERS in doc/edit/shared/klammertext_edit.py
;; * the @NAME literal rule + literal_NAME context in
;; doc/sublime/Klammertext.sublime-syntax
;; All four are currently seeded with just "code".
;; doc/edit/sublime/Klammertext.sublime-syntax
;; * the @NAME verbatim region in doc/edit/vim/syntax/klammertext.vim
;; * the @NAME rule in doc/edit/vscode/syntaxes/klammertext.tmLanguage.json
;; All are currently seeded with just "code".
(defun klammertext-add-literal-klammer (name)
"Register NAME as a klammer whose literal content must not be interpreted.