Vscode-cpptools: In a cpp file asterisk as first non-whitespace character on a line triggers another asterisk on new line

Created on 1 Jun 2018  路  6Comments  路  Source: microsoft/vscode-cpptools

  • VSCode Version: 1.23.1
  • cpptools Version: 0.17.4
  • OS Version: macOS High Sierra

Steps to Reproduce:

Type the following text in a .cpp file

a = a
    * b;

Then hit enter at the end of the line to begin a new line. You'll get

a = a
    * b;
    * 

This is not expected behavior in this context. This is perhaps expected when in the middle of a multiline decorated comment but not otherwise.

This does not happen in an unsaved file, a file with no extension, .txt extension etc. and does not happen if the cpptools extension is disabled and happens when it is re-enabled.

Language Service Visual Studio Code bug external

Most helpful comment

I agree with you, but you may need to ask the vs code team for help here since we are unfortunately limited by the reg exp support.

All 6 comments

Looks like a bug with our comment continuation patterns, i.e. /** is supposed to continue the line with *.

Can you please share the value you have set for "C_Cpp.commentContinuationPatterns"? I don't see this behavior with the default value.

Sorry, I misread the repro. Because the comment continuation stuff is reg-exp based (and not multiline aware), this is actually the expected behavior for the default value. You will observe the same behavior with JavaScript and TypeScript files.

If you want to disable this behavior, you can set "C_Cpp.commentContinuationPatterns": [] in your settings file.

Hi all,

Thanks for looking at the report. From my (user) perspective I expect the behavior to be context aware. So, If I'm in the middle of a multiline comment (I started with /*) I expect this to happen. If I'm not, then I expect this to be disabled.

Thanks!

I agree with you, but you may need to ask the vs code team for help here since we are unfortunately limited by the reg exp support.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrisckc picture chrisckc  路  3Comments

montery8 picture montery8  路  3Comments

ecbrodie picture ecbrodie  路  3Comments

igorPhelype picture igorPhelype  路  3Comments

thndrwrks picture thndrwrks  路  3Comments