Cedar policy language for Visual Studio Code
The Cedar policy language extension for Visual Studio Code supports syntax highlighting, formatting, and validation. Install from the Visual Studio Marketplace or by searching within VS Code.
Cedar is an open-source language for writing authorization policies and making authorization decisions based on those policies. Visit the Cedar policy language reference guide for the documentation and the language specification.
Note: The release version of this extension uses Cedar 3.x.
Features
Cedar policy language
Files matching *.cedar
are detected as a Cedar policy language and receive syntax highlighting. Validation is performed on document open, document save, during formatting, and via context menu. IntelliSense for entity types and attributes. Formatting can disabled per file using a leading comment line of // @formatter:off
. Policy navigation using Outline or Breadcrumb. "Go to Definition" on Cedar entity types and action names. Policies are exportable to their JSON representation (*.cedar.json
) and receive syntax highlighting.
Cedar schema
Files named cedarschema
or matching *.cedarschema
are detected as a Cedar schema and receive additional syntax highlighting. Validation is performed on document open, document save, and via context menu. When a Cedar schema file is detected or configured in Settings, additional validation of Cedar files uses that schema. Entity type navigation using Outline or Breadcrumb. "Go to Definition" on Cedar entity types and action names. The Cedar schema JSON format is supported for files named cedarschema.json
or matching *.cedarschema.json
.
Cedar entities
Files named cedarentities.json
or matching *.cedarentities.json
are detected as Cedar entities and receive additional syntax highlighting. Validation is performed against a Cedar schema on document open, document save, and via context menu. Entity navigation using Outline or Breadcrumb. "Go to Definition" on Cedar entity types.
Cedar CLI
Various commands of the cedar
CLI take JSON formatted file inputs. Files named cedarauth.json
or matching *.cedarauth.json
are detected as input to the --request-json
option for the authorize
command. Files named cedartemplatelinks.json
or matching *.cedartemplatelinks.json
are detected as input to the --template-linked
option for the authorize
command. These files receive additional syntax highlighting.
Markdown
Syntax highlighting of cedar
and cedarschema
code fence blocks within markdown (*.md
) files.
Command Palette
To see all available Cedar commands, open the Command Palette and type Cedar.
Settings
Sample .vscode/settings.json
which enables editor
settings for cedar
files, sets a workspace level Cedar schema, and enables auto detection of folder level Cedar schema files.
{
"[cedar]": {
"editor.tabSize": 2,
"editor.wordWrapColumn": 80,
"editor.formatOnSave": true,
"editor.defaultFormatter": "cedar-policy.vscode-cedar",
},
"cedar.schemaFile": "tinytodo.cedarschema",
"cedar.autodetectSchemaFile": true,
}
Troubleshooting
Submit bug reports and feature requests on our GitHub repository. For potential security issues, visit reporting a vulnerability for instructions.