Skip to content

autoplace semicolon (after class, struct, enum definitions) #3087

Closed as not planned

Description

@oktonion

Type: LanguageService

Describe the bug

  • OS and Version: Windows 10, latest Ubuntu etc...
  • VS Code Version: 1.30.2
  • C/C++ Extension Version: 0.21.0
  • Other extensions you installed (and if the issue persists after disabling them): none

So the suggestion is to auto place semicolon after class, struct, enum and union definition. Since we have already autocompletion for the brackets, when struct A {| completes to struct A{ | } why not to put a semicolon after brackets to complete class, struct etc. definition like struct A{ | };. It really bugs me to put semicolon every time at the end of definition.

To Reproduce

  1. Type struct A {|
  2. Auto complete will do its job: struct A{ | }
  3. Observe error squiggles - missing semicolon after struct definition!
  4. Put semicolon by hand

Expected behavior
Autocomplete with semicolon at the end of class, struct, enum and union definition.

Activity

  1. sean-mcmanus commented on Jan 25, 2019

    @sean-mcmanus
    Contributor

    We have struct/class/etc. snippets that do this. Have you tried that or is the snippet behavior not desirable? VS Code itself auto-completes the }, but there is no way for us to change that behavior and add a ";" at the end.

  2. sean-mcmanus commented on Jan 25, 2019

    @sean-mcmanus
    Contributor

    I've filed a feature request with Visual Studio Code at microsoft/vscode#67090 (you could upvote that).

  3. oktonion commented on Jan 25, 2019

    @oktonion
    Author

    Oh, thank you. It is confusing sometimes to distinguish the job of extension and the editor itself.

  4. xgdgsc commented on Feb 22, 2022

    @xgdgsc

    Is it possible to auto add semicolon after break and continue?

  5. sean-mcmanus commented on Feb 24, 2022

    @sean-mcmanus
    Contributor

    xgdgsc You mean as part of the keyword completion? I think that's the only place it could be added. i.e.
    image

    I've filed an issue at #8932 .

  6. imtangsheng commented on Jun 25, 2022

    @imtangsheng
  7. sean-mcmanus commented on Mar 7, 2023

    @sean-mcmanus
    Contributor

    The VS Code team closed it due to not enough upvotes: microsoft/vscode#67090

  8. ModyxOstora commented on Aug 20, 2026

    @ModyxOstora

    I tried to solve this problem by making an extension called C++ Class/Struct Auto Semicolon & Bracket, I published it in vs code so give it a try🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions