facelessuser / BracketHighlighter

Bracket and tag highlighter for Sublime Text
https://facelessuser.github.io/BracketHighlighter/
1.75k stars 245 forks source link

Feature requests: toggle to select only the beginning and end lines of the brackets or only lines of their content #593

Open rogeriodec opened 3 years ago

rogeriodec commented 3 years ago

There is an example with an if / end in Lua:

image

The inner instructions (print) have 2 tabs ident, I want to fix them to only 1 tab. So I press ctrl+alt+super+s (Select text between brackets):

image

In this case, it's selecting also the first line (if), but I need only lines 2 and 3 (print): image

In a reverse case, I would like to select only the start and end lines (if / end), for example, to get rid of them and leave only the inner lines (print):

image

facelessuser commented 3 years ago

These types of things are usually implemented with BracketHighlighter plugins.

One of the reasons these types of things are done with BH plugins is to allow people to create whatever functionality they need without having to touch the core BH code, and without having to wait for me to specifically implement and/or accept such functionality officially into the project. They can immediately get one up and running by simply creating a BH plugin file in a subfolder under User and manage their own custom use cases.

My intent is to not necessarily support every possible selection and augmentation functionality a user may desire, but provide some basics and enable people to create their own custom ones if desired. Also, by creating hooks for things like selections via BH plugins, the intent is to also encourage pull requests.


TLDR; In short, if the intent is for me to add this into the core, it is probably a maybe from me with a low priority unless there was a lot of interest for such functionality. With that said, I am more than happy to provide guidance if someone were interested to attempt to write a local custom plugin (I would maybe be open to a pull request as well). I would use the select BH plugin as a guide. There is a bit of complexity there for various selection behaviors, so maybe using it as a guide, but creating a separate line selection plugin is the best route. I fear without some refactoring in the selection plugin, yet another use case would just make things even more complicated there.

@gir-bot remove S: triage @gir-bot add T: feature, P: maybe, C: plugins