Skip to content

VS Code Extension

Editor support for the CodeCharter DSL with syntax highlighting and auto-completion.

The VS Code Extension brings full editor support for the CodeCharter DSL. When you write custom .ccr rules, you get syntax highlighting, snippets, and auto-completion for schema properties.

Installation

  1. Get codecharter-X.Y.Z.vsix from the portal downloads.
  2. In VS Code: Command Palette → "Extensions: Install from VSIX..." → select the downloaded file.

Alternatively via CLI:

code --install-extension codecharter-X.Y.Z.vsix

The Windows installer does this automatically when it finds code on the PATH.

Features

  • Syntax highlighting for .ccr files with a dedicated tokenizer.
  • Snippets for common rule skeletons.
  • Auto-completion for schema properties (TypeModel, MethodModel, and others) via an integrated language server.
  • Inline validation of rule syntax. Typos in property names or missing required headers are flagged immediately in the editor.

Commands in the Command Palette

  • CodeCharter: Validate current rule file
  • CodeCharter: Analyze workspace (.sln/.slnx/.csproj)
  • CodeCharter: Restart language server
  • CodeCharter: Show language server output

Analyze workspace runs the CodeCharter CLI on the solution or project in the VS Code terminal. Findings appear there as console output.

Configuration

Settings under codecharter.* in VS Code settings:

Setting Default Description
codecharter.serverPath empty Path to the CodeCharter CLI. Empty = auto-detect from PATH.
codecharter.trace.server off LSP tracing: off, messages, verbose.
codecharter.analyze.rulesDirectory empty Rules directory for Analyze workspace. Empty = ./rules in the workspace.

Troubleshooting

If the language server does not start:

  1. Open the Output panel (View → Output) and select CodeCharter in the dropdown.
  2. Check the CLI path. If the CLI is not on the PATH, set codecharter.serverPath explicitly to the full path.
  3. Check permissions on Linux and macOS. The binary must be executable (chmod +x codecharter).

More under VS Code Extension hangs.