Skip to content

puppet-language-server: Identify mistyped values #389

Open
@lelutin

Description

@lelutin

This issue might not be sent to the right place since the LSP server is only consuming what other tools report. It's the first line of usage that leads me to want this feature though.

Still, I'm a bit uncertain where this should get reported since I don't think there is some manner of static analysis for puppet DSL in any tool and it doesn't seem like it would fit in the context of a linting tool like puppet-lint. Maybe puppet parser validate should be the place where this happens? I'm also not sure about this.

Please do advise if you think the issue should rather be reported elsewhere

Use Case

I use puppet-language-server with nvim through an LSP plugin (coc.nvim) and I very much like the feedback that I'm getting while editing.
One thing that I can see happening though is that if I assign the wrong type to something, I won't get told. For example the following snippet would say nothing through the LSP even though it's obviously wrong:

class blah (
  Boolean $moo = "nope, this is a string",
) {
  notice("just filling up the class with something")
}

In a similar manner, if in another file I include that class with the wrong type for a parameter, I'll only learn about this error at runtime:

class { 'blah':
  moo => [1, 2, 3, 4, 5],
}

Describe the Solution You Would Like

It would be nice if we could get feedback about those types of cases directly in the editor.

The first case would be relatively trivial for puppet parser validate to verify, but the second one would imply that it could find the right class or defined type in the modulepath to then report about the wrong type for params.

Do you think that puppet parser validate would be the right place to request such a feature? or do you think something else would rather be a better destination? Once the type of error gets reported, this LSP will show it to users without much effort I'm guessing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Has been Actioned

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions