Reputation: 1424
Recently I created a flutter project and opened the "YAML", getting some error from "YAML" extension. How can I solve this? Is the only solution to uninstall the extension or how to overcome this without uninstalling this extension?
Tried flutter clean, repair, etc. but nothing was helpful.
Errors are:
1 Incorrect type. Expected "string". yaml-schema: pubspec.yaml
2 Property flutter is not allowed. yaml-schema: pubspec.yaml
3 Property cupertino_icons is not allowed. yaml-schema: pubspec.yaml
4 Property flutter_test is not allowed. yaml-schema: pubspec.yaml
5 etc.
Using flutter version is 2.8.1
"YAML" (extension) version v1.5.0
Upvotes: 13
Views: 15305
Reputation: 944
Removing Yaml extension did the trick for me, in fact I don't really see the need for it since VS Code supports YAML formats by default
Upvotes: 2
Reputation: 1438
Please update VSCode's YAML
extension to at least 1.5.1
to resolve the error. Flutter will work as it is with the errors too.
Upvotes: 0
Reputation: 31
I fixed mine by reloading the extension. I went to my extensions tab and the YAML extension needed to be reloaded.
Upvotes: 0
Reputation: 530
For me, in the extensions of VsCode, I looked for YAML and I saw there is a "reload required" next to it. did the reload and the errors went away. It is all fixed now.
Upvotes: 0
Reputation: 408
i have uninstall yaml extention
and reinstall and re-open vs code
it fixes the issue for me
Upvotes: 2
Reputation: 31
I'm having the same issue with VSCode since this afternoon, everything worked well before. I've tried forcing the schema via # yaml-language-server: $schema=<urlToTheSchema>
and yaml.schemas
setting, but no luck.
Edit: could be related to upgrading to yaml extension v1.5.0 (cf: https://github.com/redhat-developer/vscode-yaml/issues/708) Temporarily downgrading back to 1.4.0 no longer throws errors.
Upvotes: 3
Reputation: 39768
The YAML extension is using an incorrect schema to validate your YAML file. Ensure that:
# yaml-language-server: $schema=<urlToTheSchema>
comment or at least does not contain a wrong one.yaml.schemas
setting does not associate your file via glob pattern with an incorrect schema.The correct schema would be https://json.schemastore.org/pubspec.json
. See also Associating Schemas.
Upvotes: 1