Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new params to completion snippet #388

Merged

Conversation

p-spacek
Copy link
Contributor

What does this PR do?

When object is type anyOf (array: null | string[]) some code completion doesn't work properly.
For example snippets on array it's not working very well.

"anyOf_arrayObj": {
  "anyOf": [
    {
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    {
      "type": "null"
    }
  ],
  "defaultSnippets": [
    {
      "label": "- (array item)",
      "type": "array",
      "suggestionKind": 9,
      "body": {
        "key": ""
      }
    }
  ]
},

Helps also in scenarios where yaml parser doesn't know that parent is array:

anyOf_arrayObj:
  # invoke array completion here

This new parameters can specify:

  • type: type of snippet.
  • symbolKind: id of symbol that is displayed on completion panel.

This feature probably doesn't solve the cause of the problem. But offers workaround.

What issues does this PR fix or reference?

Completion-Snippet: add parameters to defaultSnippets to specify the type and simbolKind

Is it tested? How?

added unit test

Copy link
Contributor Author

@p-spacek p-spacek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

src/languageservice/jsonSchema.ts Outdated Show resolved Hide resolved
@evidolob
Copy link
Collaborator

evidolob commented Mar 3, 2021

@p-spacek Sorry for the delay, there are some tests fail. Could you fix them ASAP? I want to include this PR in to next release.

@coveralls
Copy link

coveralls commented Mar 3, 2021

Coverage Status

Coverage increased (+0.3%) to 77.439% when pulling 9a9a5ad on p-spacek:feat/snippet-paramater-type-kind into 501d75f on redhat-developer:master.

@p-spacek
Copy link
Contributor Author

p-spacek commented Mar 3, 2021

@evidolob, I fixed the test.

@evidolob evidolob merged commit 6ebd797 into redhat-developer:master Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants