redhat-developer / redhat-developer/yaml-language-server

Completion suggestions for arrays, integers suggest ${} placeholders

Open
#919 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.5k
Forks
352
Avg merge
2d 7h
Merged PRs (30d)
11

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the completion-generation code for array and integer values, which the report says intentionally produces these placeholders. Compare the behavior with the related issue 409 and establish the expected YAML completion format before making a change; done means the default suggestions match that expected format and are covered by the relevant completion tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.