luochen1990 / rainbow

Rainbow Parentheses Improved, shorter code, no level limit, smooth and fast, powerful configuration.
Apache License 2.0
1.78k stars 95 forks source link

Allow bundling parentheses into clusters to provide more flexibility and deal with more complex occasions #176

Open 91khr opened 2 years ago

91khr commented 2 years ago

(This pr is the successor of #175) (Currently this is only a draft since its documents are not yet updated)

As introduced in #174 and #161, some languages may have different syntax for parentheses inside and outside some environments; though they can be solved without adding any features, there are some issues beyond the issue themselves. Typically, a solution is adding a new vim syntax matching the special region, and define the parentheses to be containedin them. The shortcoming of the solution is that the environment itself (usually would be considered as parentheses) can't be rainbowed, and the parentheses inside the environment would have its rainbow level reset to 0.

This patch offers a way to solve these within rainbow. By bundling the toplevel parentheses, the region markers, and the parentheses within the regions into different clusters and assigning correct containing relation for them, they can cascade and all be rainbowed in correct levels.

However, after all, the patch may add too much complexity to rainbow... If this feature is considered worthwhile to be introduced into rainbow, Senioria will update the documents...

CoelacanthusHex commented 2 years ago

Considering rainbow.vim not too heavy, and this plugin is used to indicate syntax units. So I think accuracy is more important than speed.

91khr commented 2 years ago

But every huge project is piled up with such not-too-heavy pieces... Senioria think this unnecessary because there may be nobody relying on the rainbow color level to distinguish the nesting level and this is not a good practice; furthermore, it seems that few people had ever desired handle all parentheses in rainbow or have such accuracy... And once the feature is added, whether it's used or not, the cost it introduces exist and it should be kept for the sake of compatibility...

After all, efficiency is not the most important point: there are too many plugins consuming much more time, and the limited complexity of languages ensured rainbow just need to process a rather small set of rules at startup.

On Sun, Dec 05, 2021 at 12:06:57AM -0800, Coelacanthus wrote:

Considering rainbow.vim not too heavy, and this plugin is used to indicate syntax units. So I think accuracy is more important than speed.

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/luochen1990/rainbow/pull/176#issuecomment-986184831

91khr commented 2 years ago

However, the issues this pr intended to fix is not actually fixed yet, because it remains uncertain how shell codes and html templates should be highlighted...