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 193 forks source link

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

Open Jell opened 10 years ago

Jell commented 10 years ago

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 "...")

Fuco1 commented 10 years ago

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).

Wilfred commented 8 years ago

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.

Fuco1 commented 8 years ago

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.