smartparens icon indicating copy to clipboard operation
smartparens copied to clipboard

`show-smartparens-mode` should highlight tag when point in tag

Open Jell opened this issue 12 years ago • 3 comments

It would be great to highlight the matching delimiters when the cursor is in the tag, not only before or after.

All of the following should be highlighted:

|begin
  "hello"
end

be|gin
  "hello"
end

begin|
  "hello"
end

begin
  "hello"
|end

begin
  "hello"
en|d

begin
  "hello"
end|

I haven't look at the code, but I suppose that it's implemented with (or (looking-at-p "...") (looking-back-at "...")), and could maybe be replaced by a (thing-at-point-looking-at "...")

Jell avatar Sep 25 '13 07:09 Jell

This is implemented in sp-show--pair-function. It also has more problems like highlightning also the skipped matches, it needs to be fixed in similar way sp-get-thing was (using the sp--valid-initial-delimiter-p macro).

If anyone wants to give it a shot, please. If not, I'll try to fix it sometime this or next week (I'm leaving for 4 days now).

Fuco1 avatar Sep 25 '13 10:09 Fuco1

FWIW, show-paren-mode in recent Emacsen handles almost all those cases (except begin| and |end) in ruby-mode.

However, I can confirm this still occurs on current smartparens.

Wilfred avatar Dec 11 '15 12:12 Wilfred

It would also be an option to split the show functionality into a separate package or just deprecate it in favour of the built-in thing, provided it could handle user-registered pairs.

Fuco1 avatar Dec 11 '15 16:12 Fuco1