Published on 2 October 2017 by

Announcing Puppet for Visual Studio Code!

We are pleased to announce the technical preview release of the official Visual Studio Code Puppet extension! What started out as a side project done during James Pogran and Glenn Sarti's spare time, has turned into a full-featured official Puppet extension.

The extension supports the following platforms:

  • Microsoft Windows
  • MacOS
  • Linux

Installation

You can install the Puppet VSCode extension either from the Extensions tab in your VSCode editor, through the Visual Studio Code Extension gallery, or manually after downloading the extension.

extension_install

You can find more detailed instructions on installation on the readme.

Feature overview

With the Puppet VSCode extension you can edit any Puppet manifest file (ending with a .pp or a .epp) and receive instant syntax validation and highlighting as you type. This also works with metadata.json files. No need to save the file to initiate a puppet-lint run, and errors and warnings are automatically added to the Problems pane as they are discovered.

syntax

Intellisense supports autocompleting module names, classes, parameters and other symbols as you type. This works by introspecting code both in your manifest and the available modules and classes, providing more than just simple word matching.

intellisense

Hovering over any type, resource or parameter provides context specific help that comes directly from the Puppet modules or your code as it's written.

Hover goes one step further in resolving facts as you hover over their declarations. See the values as they are on the system directly in the editor, without having to run Facter in a separate window!

hover_support

The Puppet VSCode extension integrates with the new Puppet Development Kit, providing command palette invocation of all PDK commands. You can also initiate PDK commands through the editor menu or the right-click menu. In the next version of the extension, we will enable using the PDK instead of requiring a Puppet agent install.

pdk

A common task when starting out writing modules is to use puppet resource to get a quick template generated that you can specialize to your environment. You can run puppet resource directly from VSCode using the command palette and it will paste the generated Puppet code into the editor window.

puppet_resources

You can preview the Puppet node graph of a manifest while you edit your Puppet code. The extension will generate an image in a side pane that you can view while looking at your code.

puppet_node_graph

What does technical preview mean?

We use the Puppet VSCode extension internally here at Puppet, but we’re still figuring out the best workflows and what features to include, so some things may change as we receive feedback. When we are at a point where we're confident on the workflow we'll move to a 1.0 release.

What's next?

We're working on a few new things, the largest of which is an integrated Puppet debugger where you can set breakpoints inside a Puppet run and inspect the catalog. This is still a work in progress, and we’ll share details in the near future.

Let us know what you think!

You can submit suggestions or bug reports at our GitHub repo. We look forward to hearing your feedback about the extension and what new features you think up!

James Pogran is a senior software engineer at Puppet.

Glenn Sarti is a senior software engineer at Puppet.

Learn more

  • Get the Puppet VSCode Extension here
  • Provide feedback to the Puppet VSCode Extension here
  • Read a deep dive into how the extension works at Glenn's blog
  • For more information about the PDK read this blog post
Share via:
Tagged:
Johannes Grumböck

Great news!

Since Geppetto was discontinued time ago, i was looking for the next IDE to code Puppet DSL. We tried IntelliJ Idea but found the style guide and reformatter not as good as in Geppetto.

We'll give it a try in VScode!

Will it be the preffered IDE inside Puppet internal development and so a good way to adopt?

Best regards,

Johannes

Thanks Johannes!

Regarding your question about being a preferred IDE inside Puppet, personally I would say no.  Choosing a text editor is a very personal decision.  James and I started this as personal project as we both used VS Code in our daily jobs.  Particularly as our focus is Windows development and VS Code has fantastic PowerShell support.  But the good news is that much of the work we have done is not limited to VS Code.  For example Erik Dalén has an atom plugin for Puppet (https://atom.io/packages/ide-puppet), which uses the Puppet Language Server which we created for VS Code.  Many of the features we have now, and ones we create in the future, will automatically be available for Atom users too.  We also recently merged a community PR to allow even more editors to be able to communicate with a Puppet Language Server.

e.g. Look at the LSP clients listed in https://langserver.org/

 

 

I see that this extension detects linting errors. Is it able to correct them as well? For instance would it be able to automatically align the rockets on a resource to the longest one?

The content of this field is kept private and will not be shown publicly.

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.