branch: elpa/typst-ts-mode
commit 7dc8a883d0bdd7d9bc8a1ae83e4f57131ec29d7e
Author: Meow King <mr.meowk...@anche.no>
Commit: Meow King <mr.meowk...@anche.no>

    chore: delete abandoned files
---
 ...block-highlighting-mechanism-explain-0.plantuml |  52 ----------------
 .../raw-block-highlighting-mechanism-explain-0.png | Bin 76229 -> 0 bytes
 ...block-highlighting-mechanism-explain-1.plantuml |  64 --------------------
 .../raw-block-highlighting-mechanism-explain-1.png | Bin 113446 -> 0 bytes
 doc/raw-block-highlighing.md                       |  67 ---------------------
 5 files changed, 183 deletions(-)

diff --git a/assets/raw-block-highlighting-mechanism-explain-0.plantuml 
b/assets/raw-block-highlighting-mechanism-explain-0.plantuml
deleted file mode 100644
index 4ab4c34b6a..0000000000
--- a/assets/raw-block-highlighting-mechanism-explain-0.plantuml
+++ /dev/null
@@ -1,52 +0,0 @@
-@startuml
-start
-floating note
-<color:purple>purple</color>: built-in functions / variables
-<color:blue>blue</color>: typst-ts-mode functions / variable
-<color:red>red</color>: typst-ts-mode raw block configuration variables
-end note
-
-partition customization {
-  :<color:blue>typst-ts-els-lang-tags-map</color>: used in 
<color:purple>treesit-language-at-point-function</color>
-  <color:blue>typst-ts-els-tag-lang-map</color>: used in 
<color:purple>treesit-range-settings</color>
-  <color:blue>typst-ts-embedding-lang-settings</color>;
-  
-  note right
-  use function <color:blue>typst-ts-els--add-lang-tags-relationship</color> and
-  function <color:blue>typst-ts-els--lang-name-remap</color> to change 
variables
-  <color:blue>typst-ts-els-lang-tags-map</color> and 
<color:blue>typst-ts-els-tag-lang-map</color>
-  ====
-  use <color:purple>shortdoc</color> to search for <color:purple>alist</color> 
related
-  functions to modifiy <color:blue>typst-ts-embedding-lang-settings</color>
-  end note
-}
-
-partition mode initialization {
-  :create typst tree sitter parser;
-  
-  if (<color:red> typst-ts-mode-enable-raw-blocks-highlight</color>) is (t) 
then
-  :add <color:blue>typst-ts-els-include-dynamically</color> function to
-  parser notification functions list;
-
-  note right
-  so <color:blue>typst-ts-els-include-dynamically</color> will receive buffer
-  change notification
-  end note
-
-  :set <color:purple>treesit-language-at-point-function</color> and 
<color:purple>treesit-range-settings</color>;
-  
-  note right
-  They are used to create tree sitter parsers. Moreover,
-  <color:purple>treesit-range-settings</color> defined which area these parser
-  will act on.
-  end note
-  
-  :run hooks (functions added in <color:purple>typst-ts-mode-hook</color>);
-
-  if (<color:red> typst-ts-mode-highlight-raw-blocks-at-startup) is (t) then
-  :load and merge predefined settings from variable
-  <color:blue>typst-ts-embedding-lang-settings</color>;
-  endif
-  endif
-}
-@enduml
diff --git a/assets/raw-block-highlighting-mechanism-explain-0.png 
b/assets/raw-block-highlighting-mechanism-explain-0.png
deleted file mode 100644
index e87d0533ad..0000000000
Binary files a/assets/raw-block-highlighting-mechanism-explain-0.png and 
/dev/null differ
diff --git a/assets/raw-block-highlighting-mechanism-explain-1.plantuml 
b/assets/raw-block-highlighting-mechanism-explain-1.plantuml
deleted file mode 100644
index 67fee33a8b..0000000000
--- a/assets/raw-block-highlighting-mechanism-explain-1.plantuml
+++ /dev/null
@@ -1,64 +0,0 @@
-@startuml
-
-floating note
-<color:purple>purple</color>: built-in functions / variables
-<color:blue>blue</color>: typst-ts-mode functions / variable
-<color:red>red</color>: typst-ts-mode raw block configuration variables
-end note
-
-partition editing {
-  if (<color:red> typst-ts-mode-enable-raw-blocks-highlight</color>) is (t) 
then
-    fork
-      partition function: 
<color:purple>treesit-language-at-point-function</color> {
-        floating note: i.e. 
<color:blue>typst-ts-mode--language-at-point</color>
-        :raw block tag (**ignore case**) will be converted to tree sitter
-        language symbol via <color:blue>typst-ts-els-tag-lang-map</color>;
-        if (langauge symbol in map) is (nil) then
-          :use language symbol **typst**;
-        endif
-      }
-
-      if (language symbol **not** in <color:red>treesit-range-settings</color>
-      and dynamic library file for language is loaded) then
-        :treesit will create a toplevel parser of that language;
-        note left
-          which is what we don't want, since it will mess the foncication
-          (i.e. highlight area outside the raw block)
-          we will delete it later
-        end note
-      endif
-      
-    fork again
-      partition <color:purple>treesit-range-settings</color> {
-        :create local parsers (parse specific areas) according to
-        <color:purple>treesit-range-settings</color> (which defines queries for
-        finding area, and specifys parser language for that area);
-      }
-    end fork
-
-    partition function: <color:blue>typst-ts-els-include-dynamically</color> {
-      note
-      this function is called when buffer changes.
-      see <color:red>treesit-parser-add-notifier</color>
-      end note
-
-      :get all parsers (including toplevel, local);
-
-      while (parser in parsers)
-        if (the language of the parser haven't been marked loaded) then
-          if (try load settings via 
<color:blue>typst-ts-embedding-lang-settings</color>) is (not success) then
-            if 
(<color:red>typst-ts-highlight-raw-block-langs-not-in-predefined-settings</color>)
 is (t) then
-              :guess the corresponding tree sitter major mode of the language;
-              :create a temporary buffer with hooks disabled;
-              :load settings from local variables;
-            endif
-          endif
-          :mark the language as loaded;
-        endif
-      endwhile
-    }
-  endif
-}
-
-end
-@enduml
diff --git a/assets/raw-block-highlighting-mechanism-explain-1.png 
b/assets/raw-block-highlighting-mechanism-explain-1.png
deleted file mode 100644
index e85526cc29..0000000000
Binary files a/assets/raw-block-highlighting-mechanism-explain-1.png and 
/dev/null differ
diff --git a/doc/raw-block-highlighing.md b/doc/raw-block-highlighing.md
deleted file mode 100644
index d170422e91..0000000000
--- a/doc/raw-block-highlighing.md
+++ /dev/null
@@ -1,67 +0,0 @@
-# Raw Block Highlighting
-
-## Customization Option
-1. `typst-ts-mode-enable-raw-blocks-highlight`  
-2. `typst-ts-mode-highlight-raw-blocks-at-startup`  
-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
-
-![0](../assets/raw-block-highlighting-mechanism-explain-0.png)  
-![1](../assets/raw-block-highlighting-mechanism-explain-1.png)  
-
-## Customize
-1. add/modify raw block language tags/language relationship.  
-   for example   
-   ~~~typst
-   ```newtag
-   ```
-   ~~~
-   -> customize `typst-ts-els-lang-tags-map` and `typst-ts-els-tag-lang-map`   
-   -> use `typst-ts-els--add-lang-tags-relationship` helper function.  
-2. remap existing raw block language to new raw block language  
-   like `c++` -> `cpp`  
-   -> customize `typst-ts-els-lang-tags-map` and `typst-ts-els-tag-lang-map`  
-   -> use `typst-ts-els--lang-name-remap` helper function.  
-   
-3. add new pre-configured language settings  
-   -> customsize `typst-ts-embedding-lang-settings`  
-   -> use `shortdoc` command to search for `alist` related functions to modify 
it  
-   -> use `typst-ts-embedding-lang-settings-test` function to test your 
configuration.  
-   settings specification: see `typst-ts-embedding-lang-settings`.  
-   explain:  
-   1. key: language name: which is the name specified in your tree sitter 
dynamic library. Or you can find it by:   
-      1. go to the `<xxx>-ts-mode` major mode function  
-      2. find `(treesit-parser-create 'cpp)`. So `cpp` is the language name, 
instead
-      of the `c++`  
-   2. `:feature`: the source file name without extension of the 
`<xxx>-ts-mode`. Or
-      you can find it in variable `features`  
-   3. `:font-lock`: go to the source file, find `treesit-font-lock-settings`  
-   4. `:indentation`: go to the source file, find 
`treesit-simple-indent-rules`  
-   5. `:ts-feature-list`: go to the source file, find 
`treesit-font-lock-feature-list`  
-
-## Current Limitations
-
-1. update raw block language will not delete the old local parser  
-   -> this will cause error of raw block raw block highlighting.
-   -> you need to delete the whole raw block to remove the local parser  
-   -> this is due to the behavior of `treesit--update-ranges-local`  
-   -> currently haven't thought out good way to handle it  
-   
-2. typst raw block cannot live in typst raw block  
-For example:
-~~~typst
-```typ
-= a  // highlight currectly
-```typ
-= b // cannot highlight
-```
-```
-~~~
-This is probably due to the Typst tree sitter parser.
-
-3. Although we also load the indentation configurations, many language in raw 
block
-still cannot do indentation. Some languages like `rust`(`rust-ts-mode`) works.

Reply via email to