bug: typescript syntax highlighting break when importing with the 'type' keyword
patrickswijgman opened this issue · comments
Did you check existing issues?
- I have read all the tree-sitter docs if it relates to using the parser
- I have searched the existing issues of tree-sitter-typescript
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version
)
No response
Describe the bug
Hello!
I've started using neovim and have installed the nvim-treesitter plugin. All treesitter health checks seem OK (and all parser features are enabled for typescript)
However when I'm importing a Typescript interface using the 'type' keyword a good portion of the code looks like a comment:
I've looked through this repo for similar issues but couldn't find any, but I did find this one from another syntax highlighting plugin for typescript: HerringtonDarkholme/yats.vim#251 where this solution within this comment fixes the issue: HerringtonDarkholme/yats.vim#251 (comment)
I have no clue if this is helpful, feel free to ask anything if you need any additional information, otherwise this issue may be closed :D
Steps To Reproduce/Bad Parse Tree
- install https://github.com/nvim-treesitter/nvim-treesitter
- install typescript language in tree-sitter
TSInstall typescript
- create a typescript file
- import an interface using the 'type' keyword
Expected Behavior/Parse Tree
The 'type' keyword in import statements are correctly parsed by tree-sitter
Repro
import { type ResCollection } from 'resclient';
import { initialized } from '@/lib/resgate.ts';
import { type UserAvailabilityModel } from '@/lib/types/UserAvailabilityModel.ts';
import { getUserFromStorage } from '@/lib/user.mjs';
/**
* Get the user availabilities.
*
* This endpoint returns UserAvailability model that holds initial data and can be used to
* listen for changes per user.
*/
export async function getUserAvailabilities() {
const { clientUuid, uuid } = await getUserFromStorage();
const resgate = await initialized();
I didn't have highlight enabled 😅 closing this issue
I am facing the same issue. Where can I find the highlight in tree-sitter-typescript
Edit:
Enabling highlights in tree-sitter helped. Helpful link for anyone stuck - https://github.com/nvim-treesitter/nvim-treesitter?tab=readme-ov-file#modules