A few days after launching the public beta of Dagger, we asked the community a simple question: how can we improve our developer experience? The most popular request was for a VS Code extension with proper Language Server integration. So we took the community's advice and got to work.
Today, we're happy to introduce the first version of Dagger for VS Code, bringing a first-class Dagger development experience straight to one of the world's most popular IDE. We're also open-sourcing our LSP implementation for CUE, so that every other IDE and text editor can benefit from an improved CUE development experience as well. For example, here is a guide for adding CUE LSP support to vim.
For the first release, Dagger for VS Code includes three features: jump to definition; hover; and syntax highlighting. All three features can be used from other IDEs, using the cuelsp implementation.
Now, we have a simple way to explore the Dagger Universe and all its definitions. The Dagger Universe is a collection of reusable components, so we can use the “go to definition” feature to pick the one you need quickly.
You will need a basic understanding of CUE definitions to get the most out of Dagger. To decrease the learning curve, we have added the ability to show references inline. This provides an easy way to see the overall description of an action and its internal type.
When using “go to definition” and “show definitions”, you will have a complete overview of all CUE definitions used in your Dagger project.
We took inspiration from the Golang syntax to create our LSP theme so you can find the essential information quickly.
A Language Server Protocol (LSP) is a standard used between an editor and a language server to provide language-specific features like auto(completion), go to definition, show references, etc. An LSP is a developer's best friend since it enables an easier way of exploring and understanding code libraries, directly from your code editor:
Creating a CUE language server differs from standard languages like Golang, Python, or C++. In a typical language server, you work directly with the files and interpret them to provide language features.
With CUE, it’s the same, but you also need to work with the CUE engine to compile CUE values to simplify the implementation further.
When creating the Dagger CUE LSP, this constraint added a layer of complexity that we addressed by building a multi-component architecture. We decided to split the responsibility of file loading, jump to definition, hover, etc., into small pieces of code so we can extend it with new features later.
This resulted in the architecture below:
If you're using VS Code, give the Dagger extension a try! If you are using vim, follow our CUE LSP setup guide.
We love hearing from you! To give us feedback, you can start a discussion, create an issue, or join our Discord server.