forcedotcom / salesforcedx-vscode

Salesforce Extensions for VS Code
https://developer.salesforce.com/tools/vscode
BSD 3-Clause "New" or "Revised" License
954 stars 406 forks source link

False positive error when saving lightning:formattedNumber as currency #965

Closed adriannaude closed 1 month ago

adriannaude commented 6 years ago

Summary

I've trying to display a currency field in a multi-currency org on a lightning component. This throws an error when trying to save the file because the CSS checker is detecting a style error where there is no style command to validate.

Steps To Reproduce:

  1. Define a standard Lightning component.
  2. Add a lightning:formattedNumber component to display a currency, such as
  3. VSCode then shows an error because it thinks the style="currency" element is a CSS component rather than an attribute of lightning:formattedNumber.

Expected result

You should be able to save the Lightning component without error

Actual result

The VSCode editor flags an error and you can't then store the code. If you do the same thing via the developer console then it's fine

Additional information

VS Code Version: Version: 1.27.2 (user setup) Commit: f46c4c469d6e6d8c46f268d1553c5dc4b475840f Date: 2018-09-12T16:17:45.060Z Electron: 2.0.7 Chrome: 61.0.3163.100 Node.js: 8.9.3 V8: 6.1.534.41 Architecture: x64 SFDX CLI Version: 6.34.0-6fec0d751a OS and version: Windows 10 Pro Version 1803 Installed on 18/07/2018 OS Build 17134.285

gmarkay commented 6 years ago

I'm currently having this same issue. Please address this.

VicccccW commented 5 years ago

same issue here and please resolve it.

ekashida commented 5 years ago

Could someone clarify: 1) Is vscode is throwing an error or is a vscode plugin is throwing an error? 2) Does "you can't store the code" mean that you're not able to save the file or something else?

D99000947 commented 5 years ago

This also occurs with <lightning:formattedNumber> when using the "style" attribute such as:

<lightning:formattedNumber value="{! item.value }" style="percent" minimumFractionDigits="1" />

It reports the following in the problems pane:

colon expected css(css-colonexpected)

Which in turn causes it to also report an error at the closing </aura:component> tag.

semi-colon expected css(css-semicolonexpected)

The above errors do not prevent saving the component.

image

Removing the style="percent" attribute causes the errors to go away.

aotolbert commented 5 years ago

Seeing the same errors as D99000947 with seemingly valid style tags "currency", "number" etc. Im able to deploy to org w/o errors and it functions as expected but certainly makes for some ugly red files in the VSCode explorer. Any update on a workaround?

anterey commented 5 years ago

Please get this fixed! I know it's not stopping the component from getting saved but it's a bit annoying to see that there's an error even though there isn't any.

Because of this, I just used instead.

Aldemaro14 commented 4 years ago

Do someone has an update on this, I'm having the same issue......

traymond8 commented 4 years ago

This seriously still hasn't been fixed?

ntotten commented 4 years ago

This is a limitation with VS Code and we cannot fix it until VS Code allows some additional customization of the HTML language server. Related bug here: https://github.com/microsoft/vscode/issues/67871

git2gus[bot] commented 4 years ago

This issue has been linked to a new work item: W-7432029

ghost commented 3 years ago

Experiencing the same issue here with the same exact tag and attribute. Unable to deploy as a result. In addition, it's giving a "semi-colon expected" error for other tags that are actually using CSS. For example: image image

In the meantime, I have disabled HTML > Validate:Styles in Preferences as a workaround. image

mingxuanzhangsfdx commented 1 month ago

Hi folks, this is an error caused by css language server from VSCode. We still have no solution to make css language server ignore the specific component at this time, and we cannot change the aura attribute due to the product decision. A workaround to ignore the false positive is to disable HTML > Validate:Styles in Preferences in VSCode setting as mentioned above.

I am going to close the issue.