0

This is infuriating. I copy and paste this html from the trailhead module:

  <template>
  <lightning-card title="HelloWorld" icon-name="custom:custom15">
    <div class="slds-m-around_medium">
      <p>Hello, {greeting}!</p>
      <lightning-input
        label="Name"
        value={greeting}
        onchange={changeHandler}
      ></lightning-input>
    </div>
  </lightning-card>
</template>

Then when I press ctrl + s or when I save with the file menu it automatically throws quotes around {greeting} and {changeHandler}.

This then becomes invalidl, the error message says:

LWC1001: Ambiguous attribute value onchange="{changeHandler}". If you want to make it a valid identifier you should remove the surrounding quotes onchange=

What do I do ? I have no other extensions installed other than salesforce expansion pack.

  • 1
    I'm not observing that behavior (just tried it). Are you sure you're on the latest version of VS Code, Salesforce Extension Bundle, and sfdx? Try updating everything and try again. – sfdcfox Mar 21 at 15:54
  • thanks, just installed yesterday, guess everything hadn't finished installing. wow! – SallyRothroat Mar 21 at 16:03
  • Ok this is still a problem – SallyRothroat Mar 22 at 17:32
  • I tried adding "editor.autoSurround": false to settings – SallyRothroat Mar 22 at 17:32
  • editor.formatOnSave – SallyRothroat Mar 22 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.