uben0/tree-sitter-typst

Problem with single quote

maxtremblay opened this issue · 3 comments

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

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?

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.

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!