branch: elpa/typst-ts-mode commit 8ab7a3e60d4ed18655934bc2f3bb7ebf959139ec Author: Meow King <mr.meowk...@anche.no> Commit: Meow King <mr.meowk...@anche.no>
disable raw block highlighting by default since it needs performance refinement --- README.md | 5 +++-- doc/raw-block-highlighing.md | 5 +++-- typst-ts-mode.el | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index dc7dd5850f..d7bac446e4 100644 --- a/README.md +++ b/README.md @@ -108,10 +108,11 @@ because Typst itself do this style. You may find `auto-save-visited-mode`, ### Raw block highlighting Only support tree-sitter languages. +This is an experimental feature, so it is disabled by default. For more detailed documentation about raw block highlighting see [this documentation](./doc/raw-block-highlighing.md) -1. `typst-ts-mode-enable-raw-blocks-highlight` (default `t`) -2. `typst-ts-mode-highlight-raw-blocks-at-startup` (default `t`) +1. `typst-ts-mode-enable-raw-blocks-highlight` (default `nil`) +2. `typst-ts-mode-highlight-raw-blocks-at-startup` (default `nil`) 3. `typst-ts-highlight-raw-block-langs-not-in-predefined-settings` (default `t`) ### Consult Imenu Integration diff --git a/doc/raw-block-highlighing.md b/doc/raw-block-highlighing.md index d9ba736fc5..d170422e91 100644 --- a/doc/raw-block-highlighing.md +++ b/doc/raw-block-highlighing.md @@ -3,8 +3,9 @@ ## Customization Option 1. `typst-ts-mode-enable-raw-blocks-highlight` 2. `typst-ts-mode-highlight-raw-blocks-at-startup` -Due to the lazy fontification feature of `treesit`, raw blocks won't be -highlighted at the startup by default. Set it to `t` to enable this feature. +If it is `nil`, then you need to manually change the buffer a bit (like insert/delete +a character) to trigger function `typst-ts-els-include-dynamically` to merge other +language settings, so that highlighting works. 3. `typst-ts-highlight-raw-block-langs-not-in-predefined-settings` ## Mechanism diff --git a/typst-ts-mode.el b/typst-ts-mode.el index 733ad03c5a..0bf1ecfcbc 100644 --- a/typst-ts-mode.el +++ b/typst-ts-mode.el @@ -54,12 +54,13 @@ :type 'integer :group 'typst-ts) -(defcustom typst-ts-mode-enable-raw-blocks-highlight t +;; TODO currently set nil as default, since it still needs refinement +(defcustom typst-ts-mode-enable-raw-blocks-highlight nil "Whether to enable raw block highlighting." :type 'boolean :group 'typst-ts) -(defcustom typst-ts-mode-highlight-raw-blocks-at-startup t +(defcustom typst-ts-mode-highlight-raw-blocks-at-startup nil "Whether to highlight raw blocks at *mode startup*. Note: this may take some time for documents with lot of raw blocks." :type 'boolean