skip to Main Content

It is shown as underlined when naming wrong while writing code in Android Studio. However, I did not see such a thing in VS Code. Is there a way to turn it on or is there no such feature?

enter image description here
enter image description here

2

Answers


  1. Install Camel Case Navigation Extensions

    Download from here or Go to Extensions or search "Camel Case Navigation"

    Login or Signup to reply.
  2. I think you are trying to 2 do things at once here.

    First, dart has 2 lints rules that ensure your code is using camelCase

    The rules are by default included in the recommended set of lint rules.

    They prevent you from writting:

    const PI = 3.14;
    const kDefaultTimeout = 1000;
    final URL_SCHEME = RegExp('^([a-z]+):');
    
    class Dice {
      static final NUMBER_GENERATOR = Random();
    }
    
    var Item;
    
    HttpRequest http_request;
    
    ALIGN(clearItems) {
      // ...
    }
    

    But they don’t prevent you from writing

    var userage;
    var familyname;
    var studentnumber;
    

    because those names verify the camelCase regexp.

    • userAge is a combination of 2 words ("user" and "age").
    • userage implies your variable is one single word ("userage"). This word doesn’t exist in English but dart doesn’t know that.

    What you want now is to verify the spelling of your variables.

    You can install the VSCode extension cSpell for that and it will verify that each sub-words of a variable exist and are properly spelled.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search