Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please support '<' ">' angle bracket in multiple line template in c++ #465

Open
MambaWong opened this issue Dec 24, 2017 · 5 comments
Open
Labels
C: plugins Related to plugins. P: maybe Pending approval of low priority request. T: feature Feature.

Comments

@MambaWong
Copy link

Please support '<' ">' angle bracket in multiple line template in c++ like the 'red' angle brackets in below image.
qq 20171224155749

Because more and more people like to use template In modern C++ 11.
Thank you!

@facelessuser
Copy link
Owner

  1. Please follow the template next time.

  2. Pull requests are welcome.

As I am a C++ user, I may get to this in the future, but it is low priority for me, so a pull request will most likely get it in much quicker.

@SoilRos
Copy link

SoilRos commented Jun 19, 2018

This is something that will be really helpful for me!

I have had horrible bugs in template meta-programming just because sometimes is hard to distinguish if angles were right or not, and the compiler does not help very much.

Another example of use, is to analyse errors of the generated code after some meta-programing. You literally get hundreds of angles, and one of them can give you clues where the error is coming from.

@facelessuser
Copy link
Owner

Unfortunately, I rarely touch templates in the kind of C/C++ coding I do (mostly embedded systems). That's not to say templates aren't used in our code, I just rarely have to touch that area. Because of that, this has been pretty low on my priority list.

Also, If the current syntax language doesn't scope these special, it may be difficult to pull this off as there are many ways angle brackets are used: shifting, comparing, header include, templates, etc.

Anyways, it is on my list, I just can't promise when I'll get around to looking into this.

@SoilRos
Copy link

SoilRos commented Jun 20, 2018

Yes I understand that is very demanding, even compilers had troubles in the beginning to understand these codes. Even if you could program something that can recognise these scopes, I guess it will make BracketHighlighter very slow. So, I don't think that should be the approach here.

Instead I would go in another direction which might be very easy to implement: activate template highlighter (i.e. a simple angle highlighter) with a hotkey when needed. The reason is that outside templates, angle brackets are very messy and difficult to understand and would require a lot of work to distinguish, however, inside templates there cannot be pointer operators, shifts operator, and static comparisons must be done within a parenthesis scope. It means that a simple angle highlighter is more than enough.

Right now my approach is something near to that: I have a simple angle highlighter that I enable by hand only when i really need to be sure that templates are correct.

Do you think that is too hard to add such a hotkey?

@facelessuser
Copy link
Owner

I haven't looked yet, but if I have to code up a special template highlighter, that would be more difficult. I may be able to use existing Scopes, I just don't know yet. When I get a chance, I'll let you know.

@facelessuser facelessuser added T: feature Feature. P: maybe Pending approval of low priority request. C: plugins Related to plugins. labels Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: plugins Related to plugins. P: maybe Pending approval of low priority request. T: feature Feature.
Projects
None yet
Development

No branches or pull requests

3 participants