uben0 / tree-sitter-typst

Tree Sitter grammar for Typst
MIT License
110 stars 9 forks source link

Problem with single quote #25

Closed maxtremblay closed 6 months ago

maxtremblay commented 6 months ago

I installed tree-sitter-typst via nvim-treesitter.

There is an highlight issue with single quotation mark as shown in the picture.

screenshot_02262024_12_52_48

uben0 commented 6 months ago

I might not be the best person to help you as I don't use nvim myself.

I can't reproduce the behaviour

#import "template.typ": *

#show: template

My neighbour's dog isn't happy.

image

(source_file
    (import
        (string)
        (wildcard))
    (parbreak)
    (show
        (ident))
    (parbreak)
    (text)
    (quote)
    (text)
    (quote)
    (text)
    (parbreak))

It looks like your editor is not even applying the correct grammar because neither the #import nor the #show are highlighted.

Do you have a way to check what language is currently being detected? What file extension are you using?

uben0 commented 6 months ago

My intuition is that currently, NeoVim is recognizing your file as C++. Because for some reason I ignore, the .typ extension is known to hold C++ code (don't ask me why). And your file is starting with something that looks like C++.

Try to change your extension to .typst (even if it's not the official extension) or try to add something at the top of your file that doesn't look like C++.

If it is what is happening, I'll talk to the person that added the grammar to NeoVim.

maxtremblay commented 6 months ago

Ok, so you were right. The problem was that neovim was recognizing my file as an sql file. I installed that plugins to get the typst filetype solving my issue. Thank you!