yaml-language-server icon indicating copy to clipboard operation
yaml-language-server copied to clipboard

Completion suggestions for arrays, integers suggest ${} placeholders

Open n8agrin opened this issue 2 years ago • 1 comments

Summary

More of a question than a bug report.

We have a JSONSchema that encodes various values like:

          "aliases" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            }
          },

The yaml-language-server provides a completion that is like:

aliases:
  - ${1:""}

Similarly, we've noticed that integer values like:

          "display_order" : {
            "type" : "integer"
          },

which suggests:

display_order: ${1:0}

Why are these the suggested defaults? I read through the code and it looks intentional. That is, it all happens in code that understands it's generating a suggestion for an array value or an integer value.

I double checked the yaml syntax and don't believe this is a standard array format which left me more confused.

I'm happy to open a PR with a patch, but given how long the implementation has existed in the code, I wanted to check first.

I believe this issue may be related, in that when I first hit the problem, I was trying to find a way to insert an array literal as the suggestion: https://github.com/redhat-developer/yaml-language-server/issues/409

n8agrin avatar Sep 06 '23 18:09 n8agrin

Same question.

Cerebus avatar Aug 01 '24 20:08 Cerebus