Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable "fake" closing-bracket comments in Visual Studio Code?

I'm not sure what the name of this feature is, but it is driving me nuts. I have only written a little bit of Dart in Visual Studio Code, so I don't know if this happens in other language modes.

Given the following code:

class FriendlychatApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: "Friendlychat",
      home: new ChatScreen(),
    );
  }
}

VSCode will show:

class FriendlychatApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: "Friendlychat",
      home: new ChatScreen(),
    ); // MaterialApp
  }
}

This happens if the closing bracket is a paren ()) or square bracket (]).

Note that // MaterialApp is not actually written to the file, it is only rendered on screen.

This gets noisy rather quickly, and is quite redundant as VSCode displays indent lines already.

Is there a setting to disable this?

like image 485
felideon Avatar asked May 14 '18 21:05

felideon


People also ask

How do I get out of bracket in VS Code?

As in, when you press "tab" key near a closing bracket, the cursor will jump over it instead of adding a new tab.

How do you remove a comment in VS Code?

📝 Usage. Once installed, remove comments in your code by opening the command palette ( Ctrl + Shift + P ), entering "Remove all comments" and pressing enter. Voilà, all the comments are gone 🎉 !

How do you set VS Code to use spaces instead of tabs?

Type “Indentation” into the search field then head to the “Editor: Tab Size” section. Replace the default space number with your preferred one: Your setting will be applied and reflected immediately. If this doesn't happen (it's a little lag sometimes), just reload or restart your VS Code.


1 Answers

You can disable them by adding

"dart.closingLabels": false

in your vscode settings file. Once you save the settings file it will ask you to Reload the Project.

Source: Disable vscode comments - Flutter

like image 127
Viezevingertjes Avatar answered Sep 29 '22 14:09

Viezevingertjes