Skip to content

WIldcard object attributes should consider the character offset when returning completion items #342

@rcjsuen

Description

@rcjsuen

Since the text cursor is on the same level as abc:, we should not be suggesting any object attributes given that the indentation is not correct.

Image
{
    "textDocument": {
        "uri": "file:///tmp/compose.yaml"
    },
    "position": {
        "line": 4,
        "character": 6
    },
    "context": {
        "triggerKind": 1
    }
}
{
    "isIncomplete": false,
    "items": [
        {
            "label": "aliases",
            "detail": "array",
            "documentation": "A list of unique string values.",
            "insertTextFormat": 2,
            "insertTextMode": 1,
            "textEdit": {
                "range": {
                    "start": {
                        "line": 4,
                        "character": 6
                    },
                    "end": {
                        "line": 4,
                        "character": 6
                    }
                },
                "newText": "aliases:\n        - "
            }
        },
        {
            "label": "driver_opts",
            "detail": "object",
            "documentation": "Driver options for this network.",
            "insertTextFormat": 2,
            "insertTextMode": 1,
            "textEdit": {
                "range": {
                    "start": {
                        "line": 4,
                        "character": 6
                    },
                    "end": {
                        "line": 4,
                        "character": 6
                    }
                },
                "newText": "driver_opts:\n        "
            }
        },
        {
            "label": "gw_priority",
            "detail": "number",
            "documentation": "Specify the gateway priority for the network connection.",
            "insertTextFormat": 2,
            "insertTextMode": 1,
            "textEdit": {
                "range": {
                    "start": {
                        "line": 4,
                        "character": 6
                    },
                    "end": {
                        "line": 4,
                        "character": 6
                    }
                },
                "newText": "gw_priority: "
            }
        },
        {
            "label": "interface_name",
            "detail": "string",
            "documentation": "Interface network name used to connect to network",
            "insertTextFormat": 2,
            "insertTextMode": 1,
            "textEdit": {
                "range": {
                    "start": {
                        "line": 4,
                        "character": 6
                    },
                    "end": {
                        "line": 4,
                        "character": 6
                    }
                },
                "newText": "interface_name: "
            }
        },
        {
            "label": "ipv4_address",
            "detail": "string",
            "documentation": "Specify a static IPv4 address for this service on this network.",
            "insertTextFormat": 2,
            "insertTextMode": 1,
            "textEdit": {
                "range": {
                    "start": {
                        "line": 4,
                        "character": 6
                    },
                    "end": {
                        "line": 4,
                        "character": 6
                    }
                },
                "newText": "ipv4_address: "
            }
        },
        {
            "label": "ipv6_address",
            "detail": "string",
            "documentation": "Specify a static IPv6 address for this service on this network.",
            "insertTextFormat": 2,
            "insertTextMode": 1,
            "textEdit": {
                "range": {
                    "start": {
                        "line": 4,
                        "character": 6
                    },
                    "end": {
                        "line": 4,
                        "character": 6
                    }
                },
                "newText": "ipv6_address: "
            }
        },
        {
            "label": "link_local_ips",
            "detail": "array",
            "documentation": "A list of unique string values.",
            "insertTextFormat": 2,
            "insertTextMode": 1,
            "textEdit": {
                "range": {
                    "start": {
                        "line": 4,
                        "character": 6
                    },
                    "end": {
                        "line": 4,
                        "character": 6
                    }
                },
                "newText": "link_local_ips:\n        - "
            }
        },
        {
            "label": "mac_address",
            "detail": "string",
            "documentation": "Specify a MAC address for this service on this network.",
            "insertTextFormat": 2,
            "insertTextMode": 1,
            "textEdit": {
                "range": {
                    "start": {
                        "line": 4,
                        "character": 6
                    },
                    "end": {
                        "line": 4,
                        "character": 6
                    }
                },
                "newText": "mac_address: "
            }
        },
        {
            "label": "priority",
            "detail": "number",
            "documentation": "Specify the priority for the network connection.",
            "insertTextFormat": 2,
            "insertTextMode": 1,
            "textEdit": {
                "range": {
                    "start": {
                        "line": 4,
                        "character": 6
                    },
                    "end": {
                        "line": 4,
                        "character": 6
                    }
                },
                "newText": "priority: "
            }
        }
    ]
}

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions