/pulumi-lsp

A LSP server for Pulumi YAML

Primary LanguageGoApache License 2.0Apache-2.0

pulumi-lsp

A LSP server for writing Pulumi YAML.

License


Note: The Pulumi YAML LSP Server is in a public beta. If you have suggestions for features or find bugs, please open an issue.

Existing Capabilities

Warnings and Errors

The Pulumi LSP Server should give contextual warnings when:

  1. There is a variable that is never referenced.

The Pulumi LSP Server should give contextual errors when:

  1. The file is not a valid YAML document.
  2. A reference refers to a variable that does not exist.
  3. More then one variable/resource share the same name.

On Hover

When you hover your mouse over a resources type token, you should observe a popup that describes the resource. Likewise for the type token of a function.

Completion

You should get semantic completion when:

  1. Typing in a predefined key for Pulumi YAML such as "resources" or "properties".
  2. Typing in the name of a resource property or function argument..
  3. Entering type tokens for resources or functions.
  4. Referencing a structured variable. For example if "cluster" is a eks:Cluster, then "${cluster.awsPr}" will suggest awsProvider.

Planned Capabilities

Analysis

  • Duplicate key errors

Hover

  • Highlight the variable at point across the file

Completion

  • When entering Pulumi YAML builtin keys.
    • Functions
    • Top level
    • Resources
  • On the return value for invokes

Actions

  • Rename variable
  • Fill in input properties

Setting Up Pulumi LSP

The server is theoretically deployable to any editor that supports LSP.

VS Code

Because VS Code is the most common editor, I used it for initial testing. Running make install vscode-client will install the server on your path and build a .vsix file in ./bin. Running code ${./bin/pulumi-lsp-client-*.vsix} will install the extension. See the docs for details.

Emacs

pulumi-yaml.el provides a major mode for editing Pulumi YAML which should be auto-invoked on relevant documents. It also associates a LSP server emacs-lsp which can be launched the usual way: M-x lsp. Run make install emacs-client to install the server in $GOPATH/bin. A pulumi-yaml.elc fill will be generated in ./bin.