redhat-developer / yaml-language-server

Language Server for YAML Files
MIT License
1.1k stars 264 forks source link

Get definition on sequence item #979

Open Willem-J-an opened 5 months ago

Willem-J-an commented 5 months ago

When using a yaml sequence, there seems to be no way to hover the definition of a sequence item:

some_sequence:
  - mysequence_item_key: value # There is no position I can hover from that will give definition of the whole node in sequence
    second_key: value2

other_sequence:
  - { # If I hover on the brace, I do get the definition of the node in the sequence.
       mysequence_item_key: value,
       second_key: value
    }

Describe the solution you would like

Support hovering definition of the sequence item on the - char

some_sequence:
  >>-<< mysequence_item_key: value # Hover on the - to get definition of sequence item
    second_key: value2

Currently this provides no information, and it seems like the most logical place to hover.

Describe alternatives you have considered

Write all sequences items with explicit curly braces, but now all key/value pairs must be delineated with commas, and all sequences and mappings in the sequence item also require explicit braces and brackets.

sequence:
  - {
       key: [sequence, must, have, square, bracket],
       between_keys: {must: [have, commas, and, braces]}
    }