The official VS Code CUE extension provides rich language support for the CUE language through syntax highlighting and language server (LSP) integration.
CUE makes it easy to validate data, write schemas, and ensure configurations align with policies.
CUE works with a wide range of tools and formats that you're already using such as Go, JSON, YAML, OpenAPI, and JSON Schema.
For more information and documentation, including tutorials and guides, see cuelang.org.
-
Make sure you have CUE installed on the computer that's running VS Code. We recommend installing the latest version.
-
Install the VS Code CUE extension.
-
Open any CUE file to automatically activate the extension. The CUE status bar appears in the bottom right corner of the window and displays your CUE version. The ⚡ sign next to the CUE version indicates the language server is running, and you are ready to go.
-
Use the Command Palette,
Shift+Command+P(Mac) /Ctrl+Shift+P(Windows/Linux), to run CUE-specific commands. Find them through their commonCUE:prefix.
For more details on configuring and using the CUE language server, see LSP: Getting started.
The extension can be configured through VS Code settings. Access settings via:
Code→Preferences→Settings(Mac)File→Preferences→Settings(Windows/Linux)
By default, the extension uses the cue command from your system PATH. You can customize this using the cue.cueCommand setting to point to a specific CUE installation.
Supported path formats:
-
VS Code Variables (recommended for portability):
{ "cue.cueCommand": "${workspaceFolder}/bin/cue" }{ "cue.cueCommand": "${workspaceFolder:my-folder}/bin/cue" }{ "cue.cueCommand": "${userHome}/.local/bin/cue" } -
Absolute paths:
{ "cue.cueCommand": "/usr/local/bin/cue" } -
PATH-resolved commands (default):
{ "cue.cueCommand": "cue" }
Supported VS Code variables:
${workspaceFolder}- The path of the first workspace folder${workspaceFolder:name}- The path of the workspace folder namednamein a multi-root setup${userHome}- The user's home directory
Any other ${...} variable, or a variable that cannot be resolved (for
example a workspace folder name that does not match), is reported as an
error. Relative paths such as ./bin/cue are not supported; use a
variable to construct an absolute path instead, e.g.
${workspaceFolder}/bin/cue.
cue.useLanguageServer- Enable/disable the CUE language server (default:true)cue.languageServerFlags- Additional flags to pass to the language server (e.g.,["-rpc.trace"])cue.enableEmbeddedFilesSupport- Enable CUE LSP for JSON and YAML files (default:true)
We welcome feedback on your experience with the extension. Please file bug reports and share ideas via issues and discussions in the main CUE repository.
This project was started by betawaffle who graciously permitted that it be moved to be part of the CUE project.
See Contributing.