fennel.vim icon indicating copy to clipboard operation
fennel.vim copied to clipboard

neovim: Indentation is incompatible with tree-sitter highlighting

Open t-gebauer opened this issue 8 months ago • 0 comments

Indentation breaks in subtle ways, when using nvim-treesitter for syntax highlighting. For example, the following code is indented

(print "foo(bar"
            true)

instead of

(print "foo(bar"
       true)

The reason seems to be, that some parts of the indentation function check for syntax highlighting with synID. But synID returns 0 everywhere, because no "normal" syntax highlighting takes place, instead highlighting is based on treesitter queries.

Output of :lua= vim.inspect_pos():

{                                                                                                                                  
  buffer = 1,
  col = 12,
  extmarks = {},
  row = 7,
  semantic_tokens = {},
  syntax = {},
  treesitter = { {
      capture = "string",
      hl_group = "@string.fennel",
      hl_group_link = "String",
      lang = "fennel",
      metadata = {}
    } }
}

t-gebauer avatar Jun 17 '24 15:06 t-gebauer