Skip to content

Invalid path when string literal contains { or } #11

@Roguelazer

Description

@Roguelazer

Given the following JSON document:

{
    "builders": [
        {
            "type": "amazon-ebs",
            "ami_name": "foo-{{timestamp}}",
            "instance_type": "t3.small"
        }
    ]
}

Moving the cursor to line 6 character 14 (the "i" in instance_type) and running :JsonPath, the result is builders.0.ami_name.instance_type when it should clearly be builders.0.instance_type. This appears to corrupt all subsequent parsing of the file, yielding amusing results on the very large Packer template I was testing with.

This appears to be due to the {{timestamp}} in the string literal; the vimscript parser doesn't actually parse correctly and can't handle JSON inside string literals. Presumably this would be better if I had linked Python into my vim, but alas I do not have such a build.

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