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

In a cpp file asterisk as first non-whitespace character on a line triggers another asterisk on new line #2072

Closed
kghose opened this issue Jun 1, 2018 · 6 comments
Labels
bug external Language Service Visual Studio Code Caused by (or depends on changes from) VS Code

Comments

@kghose
Copy link

kghose commented Jun 1, 2018

  • 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.

@kghose kghose changed the title In a cpp file asterisk at start of line triggers another asterisk on new line In a cpp file asterisk as first non-whitespace character on a line triggers another asterisk on new line Jun 1, 2018
@sean-mcmanus
Copy link
Collaborator

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

@bobbrow
Copy link
Member

bobbrow commented Jun 1, 2018

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

@bobbrow
Copy link
Member

bobbrow commented Jun 1, 2018

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.

@kghose
Copy link
Author

kghose commented Jun 1, 2018

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!

@bobbrow
Copy link
Member

bobbrow commented Jun 1, 2018

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.

@bobbrow
Copy link
Member

bobbrow commented Dec 5, 2019

This is being tracked by microsoft/vscode#50952

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug external Language Service Visual Studio Code Caused by (or depends on changes from) VS Code
Projects
None yet
Development

No branches or pull requests

3 participants