Skip to content

Lint behaves weird when fixing a top-level structured fact reference #189

Closed
@jay7x

Description

@jay7x

What Versions are you running?

OS Version: MacOS 14.2.1 (arm64)
VSCode Version: VSCodium Version: 1.85.2
Puppet Extension Version: v1.5.1 (from the open-vsx repo)
PDK Version: 3.0.1

What You Are Seeing?

Let's say I have the following example manifest with a (custom) top-level structured fact reference:

$foo = $::my_structured_fact['foo']

When I select "Format Document" from the context menu I got this:

$foo = $facts['my_structured_fact['foo']']

As you may see it's wrong syntax and it breaks the future file checks and formatting.

What is Expected?

$foo = $facts['my_structured_fact']['foo']
# -OR-
$foo = $facts.get('my_structured_fact.foo')

Though I'm not sure if it's easy to fix at all. So mostly leaving it here for your awareness.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions