vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

C_Cpp.vcFormat.space.beforeConstructorColon inverted effect

Open jb2170 opened this issue 3 years ago • 5 comments

Environment

  • OS and Version: Arch Linux 2022-12-11
  • VS Code Version: 1.73.1 6261075646f055b99068d3688932416f2346dd3b x64
  • C/C++ Extension Version: v1.13.7
  • Other extensions you installed (and if the issue persists after disabling them): NA
  • If using SSH remote, specify OS of remote machine: NA
  • A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc).

The setting C_Cpp.vcFormat.space.beforeConstructorColon has inverted effect, that is when set to true (default), there is no space between function declaration end parenthesis and colon before initialiser list eg

WithSignalBlocked::WithSignalBlocked(int signum): signum(signum)

with the setting false we obtain

WithSignalBlocked::WithSignalBlocked(int signum) : signum(signum)

Bug Summary and Steps to Reproduce

Create a .cpp file with the following

struct WithSignalBlocked {
  int signum;

  WithSignalBlocked(int signum);

  ~WithSignalBlocked();
};

WithSignalBlocked::WithSignalBlocked(int signum): signum(signum) {} /* LINE X */

Observe how the formatter does not insert a space before the : on the line with comment 'LINE X'. Now toggle the setting to false in settings, and rerun the formatter; a space is inserted.

Expected behavior

The setting's effect should be inverted

Code sample and Logs

NA

Screenshots

No response

Additional context

No response

jb2170 avatar Dec 11 '22 02:12 jb2170

Thank you for submitting this issue. We will look to get a fix out as soon as possible.

browntarik avatar Dec 12 '22 18:12 browntarik

This may actually be an existing bug with Visual Studio, I am currently investigating further.

browntarik avatar Dec 13 '22 18:12 browntarik

This may actually be an existing bug with Visual Studio, I am currently investigating further. this bug is still exists!

moondie avatar Mar 30 '23 20:03 moondie

@moondie Thanks for the ping. We should have a fix in the next update.

sean-mcmanus avatar Apr 04 '23 01:04 sean-mcmanus

Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.15.2 .

sean-mcmanus avatar Apr 13 '23 20:04 sean-mcmanus