nvim-treesitter-context icon indicating copy to clipboard operation
nvim-treesitter-context copied to clipboard

Add ability to configure context text from nodes

Open camgraff opened this issue 2 years ago • 0 comments

Currently, there is no reliable way to display multi-line nodes for Scala (and other languages). This issue is similar to #65, but the solution implemented in #71 is inadequate here.

In Scala, function definitions can 1) have multiple argument lists and 2) an optional return type. i.e. these are all valid:

def func(a: String, 
  b: String) = {a}

def func(a: String, 
  b: String): String = {a}

def func(a: String)
  (b: String) = {a}

This means that the node which would signal the end of the context could be either 1) the last parameters node or 2) the return_type node if it exists.

So, we can't just add a node to last_types to solve this. Moreover, some users may prefer to only see the first parameter list and return type or other custom display logic. Python (optional return types), Haskell (multiple parameter lists), and other languages suffer from the same issues.

It would be nice to be able to provide my own implementation for get_text_for_node via config

camgraff avatar Nov 07 '21 01:11 camgraff