Skip to content

Hover not working on keys whose value is a non-empty array #788

@ipkiss42

Description

@ipkiss42

When using a JSON schema, hovering over a key triggers the LSP "hover" action, which displays the description of that key. However, I noticed that this doesn't work when the value of that key is a non-empty array.

Sample TOML file to reproduce the issue (hover.toml):

# Not an array value: hover on the key works fine
string = "foo"
# Empty array value: hover on the key works fine
empty_array = []
# Non-empty array value: hover on the key is broken
non_empty_array = ["bar"]

Corresponding JSON schema:

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Hover Test Schema",
    "description": "A schema to test hover functionality in Taplo",
    "type": "object",
    "properties": {
        "string": {
            "type": "string",
            "description": "A simple string value. Hover on this key should work fine."
        },
        "empty_array": {
            "type": "array",
            "description": "An empty array. Hover on this key should work fine.",
            "items": {
                "type": "string"
            }
        },
        "non_empty_array": {
            "type": "array",
            "description": "A non-empty array. If you see this description when hovering, it means the bug is fixed.",
            "items": {
                "type": "string"
            }
        }
    }
}

I used the following ~/.taplo.toml file to connect the two (adjust the path to the schema accordingly):

[[rule]]
include = ["**/hover.toml"]

[rule.schema]
path = "/path/to/hover-schema.json"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions