sdk
sdk copied to clipboard
Completion in pubspec.yaml is not completing top-level properties
At least for me, the top-level completers in the pubspec don't work. eg.
name: foo
dep # Completion doesn't give me anything here, I would expect "dependencies"
I'm using VS-code.
I do get completion for individual package names, and for the version constraint:
environment:
sdk: ^3.2.0
dependencies:
analyzer: ^6.2.0
ya # suggests yaml, yaml_edit etc...
One thing though, if I try to insert a new dependency at the top of the list, I don't get completion:
name: pub
environment:
sdk: ^3.2.0
dependencies:
ya # No completion here
analyzer: ^6.2.0
I haven't investigated, but I suspect that this has to do with the way the YAML parser recovers (or fails to recover) from errors in the file.
Confirming that it is indeed the case where the YAML parser fails to recover from the errors, and so is unable to parse the incomplete yaml. Hence no suggestions.
@bwilkerson , is there anything we can do here?
We could try adding an issue on the yaml parser. I opened https://github.com/dart-lang/yaml/issues/102 and Danny made one fix, perhaps having another concrete use case would get more recovery work done.