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.82k stars 195 forks source link

C++ template angle brackets not supported <> #463

Open jgarvin opened 9 years ago

jgarvin commented 9 years ago

So obviously C++ has syntactic ambiguities that means support will be imperfect, but it would be nice to be able to at least highlight a region and press < to enclose it in angle brackets.

For determining if <> should be considered a comparsion, shift, or an opener/closer I think this is a decent heuristic based on common style:

Additionally can infer closers/openers based on the following being invalid syntax otherwise (optionally may have spaces between parts):

Fuco1 commented 9 years ago

Well, this should all be possible and some code could probably be recycled from the ruby setup.

(Aditionally I'm currently working on a simple parser library that could be used to determine these situations, I plan to integrate it into SP somehow.)

That being said, I'm not going to implement this myself. I don't use C++ and so I would (rather selfishly) concentrate on things that bring benefit to me :)

If you come up with something I'm happy to merge and give you push rights so you can maintain the C++ support.

Wilfred commented 8 years ago

@jgarvin if you're still interested on working this, I've recently had to solve essentially the same problem in rust-mode. Take a look at smartparens-rust.el and test/smartparens-rust-test.el for examples.