nvim-treesitter / nvim-treesitter/nvim-treesitter-context

Expose API to replace the open/close functions

Open
#205 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Janet
Stars
3.2k
Forks
241
PR merge metrics
No merged PRs in 30d

Description

I would like to display the treesitter context a little differently - in a winbar via other plugins like LuaLine or Feline. Those plugins already provide you with the custom sections where you can put any arbitrary text, and this text in my case would be the treesitter context hierarchy.

Would it be possible to allow overriding the built-in open/close function? When a user-supplied function is specified, then the plugin will not draw any UI.

Example:

require'treesitter-context'.setup{
  -- ...
  on_open = function(ctx) 
    -- ctx here is for example an array of items to display, it could have some additional properties as needed.
  end,
  on_close = function() 
  end,
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the plugin's built-in open and close functions and the setup configuration that controls them. Implement the requested callback configuration so supplied functions receive the context or close event and prevent the plugin from drawing its own UI; done means the context can be consumed by winbar plugins without built-in rendering.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.