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

Update default clang-format style to format "> >" correctly based on cppStandard #3578

Closed
omer-g opened this issue May 3, 2019 · 4 comments
Assignees
Labels
Feature: Code Formatting Feature Request fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix
Milestone

Comments

@omer-g
Copy link

omer-g commented May 3, 2019

Type: LanguageService

Describe the bug

  • OS and Version: Windows 7
  • VS Code Version:
    Version: 1.33.1 (system setup)
    Commit: 51b0b28134d51361cf996d2f0a1c698247aeabd8
    Date: 2019-04-11T08:27:14.102Z
    Electron: 3.1.6
    Chrome: 66.0.3359.181
    Node.js: 10.2.0
    V8: 6.6.346.32
    OS: Windows_NT x64 6.1.7601
  • C/C++ Extension Version:
    Version 0.22.1
  • Other extensions you installed (and if the issue persists after disabling them):
  • A clear and concise description of what the bug is.
    std::vector<std::set<int> > my_vector;
    is automatically corrected to:
    std::vector<std::set<int>> my_vector;

The latter is illegal (at least before C++ 11) and throws the error:
error: '>>' should be '> >' within a nested template argument list

To Reproduce

  1. In a *.cpp file, type this line manually (not copy pasted):
    std::vector<std::set<int> > my_vector;
  2. Press enter.

Expected behavior

That the space between > > would not be removed in cases such as this.

Screenshots

Additional context

@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented May 3, 2019

The intended design is to set the clang-format Language flag to Cpp03 for pre-C++11 formatting, such as with a C_Cpp.clang_format_style like
{ BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 4, TabWidth: 4, BreakBeforeBraces: Allman, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false, ColumnLimit: 0, AccessModifierOffset: -4, Standard: Cpp03 }.

However, it would be better for us to have the out-of-box Visual Studio style to automatically use the current C++ language standard, so we'll use this issue to track that.

@bobbrow bobbrow changed the title Autoformat of "> >" to ">>" in container of containers definition Update default clang-format style to format "> >" correctly based on cppStandard Apr 2, 2020
@bobbrow bobbrow added this to the 1.0.0 milestone Apr 2, 2020
@elahehrashedi elahehrashedi added the fixed Check the Milestone for the release in which the fix is or will be available. label Apr 24, 2020
@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Apr 25, 2020

@elahehrashedi I didn't realize this fix got checked in so it wasn't added to the changelog yet...might rebuild the vsix Monday or just update the release page until 0.28.0-insiders2.

@sean-mcmanus
Copy link
Contributor

@elahehrashedi
Copy link
Contributor

This issue is fixed in 0.28.0.
0.28.0 release: https://github.com/microsoft/vscode-cpptools/releases/tag/0.28.0

@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Feature: Code Formatting Feature Request fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants