-
-
Notifications
You must be signed in to change notification settings - Fork 234
Open
Description
Summary
Currently, implementing a custom syntax parser (like tree-sitter integration) requires using internal symbols:
lem/buffer/internal::syntax-parser- base class for custom parserslem/buffer/internal::%syntax-scan-region- method to implement syntax scanning
Background
In PR #2046 (tree-sitter integration), we needed to create a custom syntax parser that integrates with Lem's syntax highlighting system. While we refactored to use public APIs for text property manipulation (put-text-property, remove-text-property, text-property-at), the parser class itself still requires internal symbol access.
Current Implementation
;; extensions/tree-sitter/integration.lisp
(defclass treesitter-parser (lem/buffer/internal::syntax-parser)
...)
(defmethod lem/buffer/internal::%syntax-scan-region ((parser treesitter-parser) start end)
...)Proposal
Export a public API for custom syntax parsers:
- Export
syntax-parserclass fromlemorlem-corepackage - Export
%syntax-scan-regiongeneric function (possibly renamed tosyntax-scan-region) - Document the protocol for implementing custom syntax parsers
Benefits
- Enables extensions to implement custom syntax highlighting without internal symbol access
- Follows Lem's convention of using exported symbols
- Makes the syntax parser extension point official and stable
Related
- PR feat: add tree-sitter based syntax highlighting support #2046: tree-sitter syntax highlighting integration
Metadata
Metadata
Assignees
Labels
No labels