shellRaining / hlchunk.nvim

This is the lua implementation of nvim-hlchunk, you can use this neovim plugin to highlight your indent line and the current chunk (context) your cursor stayed
MIT License
472 stars 29 forks source link

Using treesitter for chunk indentation doesn't seem to work in zig files #111

Closed amlanjlahkar closed 1 month ago

amlanjlahkar commented 1 month ago

As the title says, if use_treesitter = true (which is default behavior for chunk style indenting) then no indentation lines are drawn in zig filetypes.

I can confirm the latest treesitter parser for zig is installed and working correctly.

Tested on neovim latest stable release(v0.10.0)

To Reproduce

  1. Open any valid zig file with hlchunk enabled

Expected behavior Indentation lines are drawn properly

shellRaining commented 1 month ago

I have never learned the Zig language before, and I am not very familiar with its treesitter tree node types. Could you provide me with a sample code containing various syntax (such as how to write loops and conditional statements)? I will try my best to improve it.

amlanjlahkar commented 1 month ago

I'm new to zig as well, I was going through the ziglings(https://ziglings.org) excercises when I discovered the issue. As for sample code, this should do to get a hang of the syntax https://ziglang.org/learn/samples/

shellRaining commented 1 month ago

Recently I have been quite busy and may not be able to spare too much time to study Zig. You can try setting the pattern for chunks by yourself, the specific method is as follows:

  1. create a new file name lua/hlchunk/utils/ts_node_type/zig.lua
  2. open a zig file, and type command InspectTree
  3. check the node type you want to match, such as IfExpr or Block...

feel free to add chunks pattern that you think need highlighting. PR are welcome.

amlanjlahkar commented 1 month ago

I'll submit a PR if I can