Skip to content

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

Closed

Description

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

Activity

  1. 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[/+] on Jun 1, 2018
  2. sean-mcmanus commented on Jun 1, 2018

    @sean-mcmanus
    Contributor

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

  3. bobbrow commented on Jun 1, 2018

    @bobbrow
    Contributor

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

  4. bobbrow commented on Jun 1, 2018

    @bobbrow
    Contributor

    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.

  5. kghose commented on Jun 1, 2018

    @kghose
    Author

    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!

  6. bobbrow commented on Jun 1, 2018

    @bobbrow
    Contributor

    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.

  7. added
    Visual Studio Code
    on Dec 5, 2019
  8. bobbrow commented on Dec 5, 2019

    @bobbrow
    Contributor

    This is being tracked by microsoft/vscode#50952

  9. locked and limited conversation to collaborators on Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Language ServiceVisual Studio Codebugexternal

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions