Vscode-yaml: Auto-completion on sub-objects doesn't work

Created on 5 Oct 2017  路  8Comments  路  Source: redhat-developer/vscode-yaml

First of all: Thanks a lot for your awesome progress on this plugin today!

I've just tried it and it seems to work well on the root level. However, auto-completion doesn't seem to work on a sub-level. Here is an example:

# auto-complete works for `my_field`
my_root_field: 42

my_other_root_field:
  some_dynamic_key: # this key can be chosen arbitrarily
    sub_field: 0 # this again is a concrete, pre-defined key: auto-completion doesn't work
bug

All 8 comments

Out of curiosity is sub_field a child node of some_dynamic_key and some_dynamic_key a child node of my_other_root_field? If this is the case then it looks to be a bug. The autocompletion was built to be context dependent so as long as some_dynamic_key is a child of my_other_root_field then it should autocomplete with sub_field.

Heres a demo of how it should behave:
out
(I used http://json.schemastore.org/swagger-2.0 as my schema)

What you've posted seems to work for me but here is what doesn't work for me:

    "yaml.schemas": {
        "https://raw.githubusercontent.com/graphcool/graphcool-json-schema/master/src/schema.json": "graphcool.yml"
    },

do-25

At the current time the auto completion is context dependent only. Since some_name isn't a child of functions we won't be able to autocomplete anything under some_name. Additionally, auto completion is provided for results that are valid according to the schema, since some_name isn't valid in the schema as far as I can see it wouldn't autocomplete on that either.

I'm not sure why you think it's not valid? As you can see here in the definition functions is of type: object which should allow for arbitrary keys. The values however are of type: #/definitions/function.

So either we've misunderstood JSON schema or this seems like something this plugin should support 馃檪

I'm working on adding this now. I think I was just confused as I haven't seen that before

It's awesome that you're working on this. Is there any rough eta?

It should be ready in the next few days!

@schickling We just updated the extension with a brand new autocompletor! It now fixes this issue and does autocompletion on values in the schema as well!

Was this page helpful?
0 / 5 - 0 ratings