Fuco1 / smartparens

Minor mode for Emacs that deals with parens pairs and tries to be smart about it.
GNU General Public License v3.0
1.81k stars 194 forks source link

Highlight the pair point is inside #366

Closed tuhdo closed 9 years ago

tuhdo commented 9 years ago

It would be great if smartparens can highlight pair point is inside, so we know where the pair is without having move point to opening/ending of a pair. highlight-parentheses does this but it is slow on fairly large file.

Fuco1 commented 9 years ago

Unfortunately, that is an expensive operation in smart-parens framework. I left some performance suggestion to the highlight-parentheses author, so hopefully they can make it a bit more responsive.

But, on large files, every method is going to be slow, because you have to reparse a lot of the buffer each time.

Check https://github.com/zk-phi/indent-guide which does something similar, but based on indentation so it's very local behaviour. There's also https://github.com/istib/rainbow-blocks and http://github.com/jlr/rainbow-delimiters and packages based on that which can do block-highlighting fairly fast.

tuhdo commented 9 years ago

I tried all of those packages. indent-guide has problem with large file as well. rainbow-blocks is the same as hl-sexp that highlights a block, but I find it inconvenient because it shadows other highlightings such as highlight-symbol that automatically highlights symbol at point. rainbow-delimiter doesn't do the same thing. Only highlight-parentheses does the thing I want.

Unfortunately, that is an expensive operation in smart-parens framework. I left some performance suggestion to the highlight-parentheses author, so hopefully they can make it a bit more responsive.

Nice. Thanks.

Fuco1 commented 9 years ago

However, check the setting sp-show-enclosing-pair-commands, you can add commands there after which the enclosing pair is highlighted. By default it shows you the bounds when you slurp/barf.

There's also a function sp-show--pair-enc-function which you could in theory put on an idle timer (similar to show-smartparens-mode). But as other modes, it will get quite slow on larger buffers.