Update syntax: alternative block comment and nvim-lsp based highlights for bold and italic#106
Update syntax: alternative block comment and nvim-lsp based highlights for bold and italic#106yangwenbo99 wants to merge 2 commits intokaarmu:mainfrom
Conversation
… for bold and italic
|
Thanks for the PR! I've seperated the comment fix to branch Regarding bold/italics, I really appreciate relying on LSP. Though, I want to hold on to that a little bit. Moreover, even though LSPs can perhaps better/more easily capture the right highlight group, I am also aiming to have standalone support as much as possible. |
|
I think For bold/italics, on the one hand, I do think it is very challenging to do it using vim's syntax file. On the other hand, there are a lot of restrictions for LSP-based highlighting, even though it is faster and more robust:
In my proposed (temporary) modification, I added an option for users to choose whether to use LSP or not. In the long run, I think it would be better to offer two options, (a) pure vim syntax file highlighting, with limited capability and (b) (mostly) LSP/treesitter-based highlighting. There is already a treesitter implementation for typst, and I am looking at it. |
… to support tinymist
Hi,
I just have some time to fix two problems I have encountered in recent months.
The first one is inserting a "/*" in a large document stresses my CPU and destroys the whole file's syntax. I use Vim's C syntax highlight file's strategy to replace the block comment.
The second issue is about italic and bold fonts. I added an option "typst_syntax_use_lsp" to use LSP for highlighting. See the attachment for the effects.
Since there are so many marginal cases for Typst syntax, I am thinking that syntax highlighting should probably be done using LSP in the future. However, the current LSP is rather limited in highlighting, as it does not provide any tree-based highlighting.
Before:

After:
