1

I have installed the up-to-date tree-sitter-typescript, and it works well in typescript files without shebang.

I searched online but couldn't find any particularly similar questions. Some people reported that their treesitter was not functioning properly, but mine was able to parse the AST correctly: Treesitter parses the AST well, but the highlight is improper

Here is my treesitter config:

{ highlight = { enable = true, }, ensure_installed = { "c", "cpp", "lua", "vim", "vimdoc", "regex", "markdown", "markdown_inline", "latex", "javascript", "json", "typescript", }, incremental_selection = { enable = true, keymaps = { init_selection = "<CR>", node_incremental = "<CR>", node_decremental = "<BS>", scope_incremental = "<TAB>", }, }, } 
3
  • Maybe it's just my poor eyesight but with that colorful background image of yours, I wonder how you can read anything at all. Please use text to represent text as much as possible. I understand this is about syntax highlighting (or the lack thereof) and this may be illustrated by an image. I'd appreciate a screenshot with a uniform background. Having said that, what does :echo &filetype print? Commented Aug 1 at 7:16
  • 1
    From the screenshot I believe the filetype is ts. Anyway the Tresitter seems to parse correctly the file. The problem seems to be in the colorization. I'm away from computers for some days. I'll try to reproduce your problem when I can :-/ Commented Aug 1 at 9:13
  • I can't reproduce your problem. The default filetype for typescript files (file with a .ts extension) seems to be typescript. Could you confirm the return value of the :set ft? command? Could you share the content of the file (it make it easier to reproduce your problem)? Commented Aug 4 at 7:19

1 Answer 1

0

Well, it's my fault. I noticed that originally this part would be properly rendered by treesitter, and then it would turn gray after tsserver was loaded. The ultimate reason is that tsserver detected that the import statements here were not being used, so it sent a semantic token to render this part in gray.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.