Open jgarvin opened 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.
@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.
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):