puppetlabs / puppet-editor-services

Puppet Language Server for editors
Apache License 2.0
46 stars 21 forks source link

(GH-139) Provide completions for defined types #204

Closed glennsarti closed 4 years ago

glennsarti commented 4 years ago

Fixes #139

Previously the manifest completion provider would not provide results if the cursor was in a defined type. This commit adds the ResourceTypeDefinition much like the HostClassDefinition.

Previously the completion provider blindly moved the cursor one place back which worked fine if completions were triggered by a character instead of manual. Now that the LSP has provisions for the context of the completion request we can intelligently figure out when to remove the trigger character.

This commit updates the mesasge handler to pass through the CompletionContext object and the completion provider can then determine how to use the context accordingly. This commit also updates the tests for this behaviour.