Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

puppet-language-server: Identify mistyped values #389

Open
lelutin opened this issue Aug 18, 2024 · 1 comment
Open

puppet-language-server: Identify mistyped values #389

lelutin opened this issue Aug 18, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@lelutin
Copy link

lelutin commented Aug 18, 2024

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.

@lelutin lelutin added the enhancement New feature or request label Aug 18, 2024
@pmcmaw
Copy link
Contributor

pmcmaw commented Sep 6, 2024

@davidsandilands is this something you may be able to help with?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: On hold
Development

No branches or pull requests

2 participants