Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Contextual Data Models (CDM) Language SupportNew to Visual Studio Code? Get it now.
Contextual Data Models (CDM) Language Support

Contextual Data Models (CDM) Language Support

Larner.dev

|
2 installs
| (0) | Free
Language support for CDM (Contextual Data Model)
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

CDM Language Support for VS Code

Official Visual Studio Code extension for the CDM (Contextual Data Model) language.

Features

  • ✅ Syntax highlighting - Basic syntax highlighting for CDM files
  • ✅ Real-time validation - Errors and warnings appear as you type
  • ✅ Error diagnostics - Inline error messages with severity indicators
  • 🚧 Code completion - Autocomplete for types, keywords, and more (coming soon)
  • 🚧 Go to definition - Jump to type and model definitions (coming soon)
  • 🚧 Hover information - See type information on hover (coming soon)
  • 🚧 Document formatting - Format files on save (coming soon)

Requirements

The extension requires the cdm-lsp language server to be installed and available in your PATH.

Installing the Language Server

# From the CDM repository root
cargo install --path crates/cdm-lsp

Or, if you're developing the extension:

# Build the LSP server
cargo build -p cdm-lsp --release

# Add to PATH or configure the path in VS Code settings

Installation

From VSIX (Local Development)

  1. Build the extension:

    cd editors/vscode-cdm
    npm install
    npm run compile
    npm run package
    
  2. Install the generated .vsix file:

    code --install-extension cdm-0.1.0.vsix
    

From VS Code Marketplace (Coming Soon)

Search for "CDM Language Support" in the VS Code extensions marketplace.

Extension Settings

This extension contributes the following settings:

  • cdm.server.path: Path to the cdm-lsp server binary (default: "cdm-lsp")
  • cdm.format.indentSize: Number of spaces for indentation when formatting (default: 2)
  • cdm.validation.checkIds: Check for missing entity IDs and show warnings (default: true)
  • cdm.trace.server: Trace LSP communication for debugging (default: "off")

Commands

  • CDM: Restart Language Server - Restart the CDM language server

Usage

  1. Open or create a .cdm file
  2. Start editing - the language server will provide real-time validation
  3. Errors and warnings will appear inline with red/yellow squiggles
  4. Hover over errors to see detailed messages

Example

Create a file schema.cdm:

// Type alias with validation
Email: string {
  @validation { format: "email", max_length: 320 }
} [#1](https://github.com/cdm-lang/cdm/issues/1)

// Model with fields
User {
  id: string [#1](https://github.com/cdm-lang/cdm/issues/1)
  email: Email [#2](https://github.com/cdm-lang/cdm/issues/2)
  name: string [#3](https://github.com/cdm-lang/cdm/issues/3)
  status: "active" | "pending" = "pending" [#4](https://github.com/cdm-lang/cdm/issues/4)

  @sql { table: "users" }
} [#10](https://github.com/cdm-lang/cdm/issues/10)

The extension will:

  • Highlight syntax
  • Validate the schema in real-time
  • Show errors if you reference undefined types
  • Warn about missing entity IDs (if checkIds is enabled)

Troubleshooting

Language server not starting

  1. Verify cdm-lsp is in your PATH:

    which cdm-lsp
    
  2. Check the output channel:

    • View → Output
    • Select "CDM Language Server" from the dropdown
  3. Enable verbose logging:

    • Set cdm.trace.server to "verbose" in settings
    • Check the "CDM Language Server Trace" output channel

Errors not showing up

  1. Ensure the file has a .cdm extension
  2. Check if the language mode is set to "CDM" (bottom right of VS Code)
  3. Try restarting the language server with the command palette (Ctrl+Shift+P): "CDM: Restart Language Server"

Development

Running the Extension in Development Mode

  1. Open the extension directory in VS Code:

    cd editors/vscode-cdm
    code .
    
  2. Install dependencies:

    npm install
    
  3. Press F5 to open an Extension Development Host window

  4. Open a .cdm file to test the extension

Building for Production

npm run compile
npm run package

This creates a .vsix file that can be installed in VS Code.

Known Issues

  • Code completion not yet implemented
  • Go-to-definition not yet implemented
  • Hover information not yet implemented
  • Multi-file validation (via @extends) shows errors for inherited types

See the GitHub issues for a full list.

Release Notes

0.1.0 (Initial Release)

  • Basic syntax highlighting
  • Real-time validation with diagnostics
  • Error and warning reporting
  • Language server integration

Contributing

Contributions are welcome! Please see the CDM repository for contribution guidelines.

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft