Closed fgimian closed 11 months ago
Just some further info, when hovering over ensure
, path
and source
parameters for the file
module, I see the following:
ensure
D, [2023-07-10T17:27:30.161796 #9317] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":15,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///etc/puppetlabs/code/modules/base/manifests/init.pp"},"position":{"line":5,"character":5}}}
---
E, [2023-07-10T17:27:30.164871 #9317] ERROR -- : (textDocument/hover) undefined method `[]' for nil:NilClass
D, [2023-07-10T17:27:30.166414 #9317] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":15,"result":null}
---
path
D, [2023-07-10T17:27:35.017176 #9317] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":16,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///etc/puppetlabs/code/modules/base/manifests/init.pp"},"position":{"line":6,"character":5}}}
---
D, [2023-07-10T17:27:35.021167 #9317] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":16,"result":{"contents":"**path** Parameter\n\nThe path to the file to manage. Must be fully qualified.\n\nOn Windows, the path should
include the drive letter and should use `/` as\nthe separator character (rather than `\\\\`)."}}
---
source
D, [2023-07-10T17:27:38.196046 #9317] DEBUG -- : --- INBOUND
{"jsonrpc":"2.0","id":17,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///etc/puppetlabs/code/modules/base/manifests/init.pp"},"position":{"line":7,"character":5}}}
---
E, [2023-07-10T17:27:38.199981 #9317] ERROR -- : (textDocument/hover) undefined method `[]' for nil:NilClass
D, [2023-07-10T17:27:38.201193 #9317] DEBUG -- : --- OUTBOUND
{"jsonrpc":"2.0","id":17,"result":null}
---
I've tested this with Puppet 7.x and PDK 2.x just to be sure but I see the same behaviour.
Cheers Fotis
hey @fgimian - thanks for raising this! From first glance it does look like a legitimate bug from the language server, so I've went ahead and transferred it to the appropriate repo.
hey @fgimian - just wanted to give you a quick update regarding this.
So after a bit of digging, I've found out why this is happening. puppet-editor-services
compiles its lists of available parameters based on the actual type definitions within the puppet source code, so like here in file for example.
So, you might have gathered that the file resource type has a different structure to most other core types in the link above, and this is where the problem starts to arise. The language server does not know to pull these parameters in as it only looks in the type definition. I'm hoping we can find a solution to this where we can pull in all type parameters, despite the file structure.
I'll keep this thread updated with my findings. Thanks!
What Versions are you running?
OS Version: Ubuntu 20.04 (via Remote SSH extension), host is on Windows 10 Pro VSCode Version: 1.80.0 Puppet Extension Version: Latest stable release and also tested the latest build in CI PDK Version: 3.0.0
What You Are Seeing?
Various parameter seem to be missing from the completion list depending on the module.
Parameters such as 'ensure' and 'source' for example.
Here's how
service
looks:As you can see, it took is missing various parameters.
What is Expected?
I expected to see all possible parameters listed and available via autocomplete.
How Did You Get This To Happen? (Steps to Reproduce)
I built a fresh Ubuntu 20.04 server and installed the Puppet Server as follows:
I then installed PDK:
I changed the ownership of /etc/puppetlabs/code to my user id and created a file under /etc/puppetlabs/code/environments/production/modules/base/manifests/init.pp which is where I attempted to add a
file
resource.Output Log