Skip to content

Add option to not highlight std:: namespace functions (i.e., cppSTLfunction) unless prefixed with std:: #36

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

Open
anntzer opened this issue Oct 30, 2016 · 2 comments

Comments

@anntzer
Copy link

anntzer commented Oct 30, 2016

There's a lot of names defined in the cppSTLfunction syntax group. In practice this easily leads to spurious highlighting, especially in a programming style where these functions would always be called with the std:: namespace explicitly.

Bonus points if you can auto-detect whether there's a using namespace std; in the current scope, but I think this may be a bit too difficult to be worth it?

@octol
Copy link
Owner

octol commented Feb 12, 2017

Sounds like something that could be useful to look into in the future. Thanks for the suggestion.

@anntzer
Copy link
Author

anntzer commented Aug 18, 2017

Something like

syntax region cppSTLscoped start='\(std\)\@3<=::\<' end='\>' contains=cppSTLtype

syntax keyword cppSTLtype allocator contained
syntax keyword cppSTLtype auto_ptr contained
syntax keyword cppSTLtype basic_filebuf contained
...

(with separate groups for each namespace if we want to actually check the namespace, or with a single container group just checking for a preceding ::) works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants