Skip to content

wwestrop/langserver-puppet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Puppet intellisense in VS Code

README

This is an extension for Visual Studio Code providing auto-complete support for documents written in the Puppet language.

It implements the Language Server Protocol (LSP), and as such it should be possible to install in other compatible editors - although this might require some adaptation. Popular LSP-compliant editors include Atom and Sublime, and there is a full list here.

Note: The VS Code marketplace had extensions providing syntax colouring, snippets, and linting; but nothing providing autocompletion when I began the project.

It seems however that the guys over at PuppetLabs have been working on this too, almost in parallel. You can check out their new extension here.

Currently supported

  • When using resource-style syntax, class and parameter completion are available for built-in Puppet types.
    • In addtion, completion support is available for parameter values of enum types. This could be extended to booleans, and maybe other types too.
    • For custom types, independent parsing of the file containing that type will need to be implemented to provide completion.
    • Support for in-built resources is hardcoded and thus does not reflect any updates made in later Puppet releases.
    • Information about the types is scraped from PuppetLabs' website and is thus not totally reliable (does the information exist in machine-readable format somewhere?)

Known limitations

Ideally, these would need to be resolved before tackling any extra features from the TODO list.

  • Comments are not supported :eek:
  • Hashes are not supported
  • If/Unless blocks are not handled

Features remaining

  • Completion for include-like statements, e.g. "include filebeat", "require nginx"
  • Completion for class pseudo-resource (resource-style class declaration)
  • Completion support for types other than built-in ones.
    • This could include searching a directory for forge modules and custom types
    • Or, it may be given an R10K file and support fetching and parsing modules from here in order to provide completion support.
  • Completion for Ruby types (I will probably never do this)
  • Argument tips for functions such as each, epp, versioncmp, and so forth
    • When using a templating function, a nice feature would be to parse the variables out of the template files and present them to the user for auto-completion.
  • Providing pop-up documentation for types and parameters, in addition to just their names.
  • When declaring a reference to a resource in the format ResourceType['name'], autocompletion could provide the appropriate list of resource names (and for the case of Class['name'], assistance should be available for the name as well).

About

VS Code extension providing auto-completion for Puppet manifests

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published