frozolotl / tree-sitter-typst

A tree-sitter grammar for the typst typesetting language with a focus on correctness
European Union Public License 1.2
76 stars 3 forks source link

Nothing Happens When I try to use this in Helix editor. #1

Closed devanlooches closed 1 year ago

devanlooches commented 1 year ago

Hi I'm probably doing something wrong but I followed the instructions in the README and there does not seem to be any syntax highlighting happening.

Thanks in advance for the help!

frozolotl commented 1 year ago

Oh, the instructions in the README appear to be incomplete.

It appears you will have to copy the contents of the queries folder from this repository into ~/.config/helix/runtime/queries/typst/. Alternatively, clone the repository somewhere and then symlink the queries folder:

$ mkdir -p ~/.config/helix/runtime/queries/
$ ln -s ~/development/tree-sitter-typst/queries/ ~/.config/helix/runtime/queries/typst

Replace ~/development/tree-sitter-typst with the absolute path to your clone.

devanlooches commented 1 year ago

Hello, thank you for the response. I tried symlinking the clone to the folder and this did not seem to do anything. Any ideas?

frozolotl commented 1 year ago

Try running

$ helix --grammar fetch && helix --grammar build

Check if that works.

If not, then does cat ~/.config/helix/runtime/queries/typst/highlights.scm output anything?

devanlooches commented 1 year ago

Running your first command returned: Error: data did not match any variant of untagged enum GrammarSource in "grammar.source"

Running the second command did print:

  (block_comment) @comment.block

  (markup) @markup
  (escape) @string.escape
  (shorthand) @punctuation
  (smart_quote) @punctuation
  (raw) @markup.raw.inline
  (link) @markup.link.url
  (label) @markup.label
  (strong) @markup.bold
  (emph) @markup.italic

  (heading
    (heading_start) @markup.heading.marker
  ) @markup.heading
devanlooches commented 1 year ago

I retried with the newest update and it seems to work now although it only highlights strings a different color. I think that is a problem with my theme though.