Open sean-mcmanus opened 6 years ago
Yes, this was cut from TypeScript for similar reasons (https://github.com/Microsoft/vscode/issues/13295). The language-configuration.json
isn't smart enough to be able to handle these properly. We'd need some other mechanism to do it.
Just wondering if anything has changed in the past two years that might make it possible to address this? I do a lot of template metaprogramming in VSCode, and matching the angled brackets would be very nice to have.
No. Unfortunately, no "provider" has been added to allow our extension to do this. But perhaps this could be done with decorators. Please add a 👍 to the first post in the issue to add your vote for us to investigate. If it gets enough votes, we will look into it.
This feature request has received enough votes to be added to our backlog.
As long as there is no solution you can always turn it on (and accept the issues). To get angle bracket pairing in vscode to work, change: /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/cpp/language-configuration.json See: https://stackoverflow.com/questions/62068072/how-to-activate-automatic-angle-bracket-pairing-completion-in-visual-studio Works fine in most contexts.
Can we include the solution above to the master branch?
No, it will fail for things like: if (x < 0 || x > 10)
. We're not satisfied with a regex implementation of this feature.
A quick hack for that would be to check file extension (.h .hpp) and ignore the line if there are any parentheses.
The file extension doesn't matter. You can write function bodies in the header file too. There are many cases where a conditional can trigger this without parentheses on the line. I was just giving a single example. Here's another: bool b = x < 0 || x > 10;
It would be nice if angle bracket matching worked when working with deeply nested templates. I suspect this is impossible to do with the regular expression mechanism due to the difficulty of parsing the angle brackets as an operator versus template arg.