REST Lens
← Back to Documentation

IDE Integration

Real-time API evaluation in VS Code

The REST Lens VS Code extension provides real-time API design evaluation directly in your editor. Get instant feedback on OpenAPI specifications as you write them.

Installation

From VS Code Marketplace

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
  3. Search for "REST Lens"
  4. Click Install

From VSIX File

Download the latest .vsix file from GitHub Releases and install:

code --install-extension restlens-x.x.x.vsix

Getting Started

1. Sign In

  1. Click the REST Lens: Sign In button in the status bar (bottom right)
  2. Enter your REST Lens API URL (default: https://restlens.com)
  3. Complete authentication in your browser
  4. Select a project when prompted

2. Open an OpenAPI Specification

Open any .yaml, .yml, or .json file containing an OpenAPI specification. The extension automatically detects OpenAPI files by looking for the openapi: or "openapi" key.

3. View Violations

Violations appear as:

  • Inline diagnostics - Squiggly underlines in your code
  • Problems panel - Full list of issues (View > Problems or Ctrl+Shift+M)
  • Status bar - Quick summary with violation count and severity

Features

Real-time Evaluation

The extension evaluates your OpenAPI specification:

  • On save (default) - Evaluates when you save the file
  • On type (optional) - Evaluates as you type with debounce

Status Bar

The status bar shows:

  • Sign In - Click to authenticate
  • Evaluating... - Evaluation in progress
  • X issues - Number of violations found (click to open Problems panel)
  • Ready - No issues found (click to trigger manual evaluation)

Colors indicate severity:

  • Red - Has error-level violations
  • Yellow - Has warning-level violations
  • No color - Info-level only or no issues

Violation Severity

Each violation has a severity level configured in your REST Lens project:

  • Error - Critical issues that should be fixed
  • Warning - Potential issues to review
  • Info - Suggestions and best practices

Configuration

Workspace Settings

Project configuration is stored in .vscode/settings.json:

{
  "restlens.organization": "my-org",
  "restlens.project": "my-project"
}

These are automatically set when you select a project after signing in.

User Settings

Configure extension behavior in VS Code settings:

SettingDefaultDescription
restlens.evaluateOnSavetrueEvaluate specs when saving
restlens.evaluateOnTypefalseEvaluate specs while typing
restlens.debounceMs1000Debounce delay for evaluate-on-type (ms)
restlens.includeInfoSeverityfalseShow info-level violations
restlens.apiUrlhttps://restlens.comFallback API URL

Commands

Access commands via the Command Palette (Ctrl+Shift+P / Cmd+Shift+P):

CommandDescription
REST Lens: Sign InAuthenticate with REST Lens
REST Lens: Sign OutClear stored credentials
REST Lens: Select ProjectChoose a different project
REST Lens: EvaluateManually trigger evaluation
REST Lens: Clear CacheClear cached evaluation results

Troubleshooting

"Sign in to REST Lens to see API design violations"

You need to authenticate first. Click the status bar item or run REST Lens: Sign In.

"Run 'REST Lens: Select Project' to enable evaluation"

After signing in, you need to select a project. Run REST Lens: Select Project from the Command Palette.

Violations not appearing

  1. Ensure the file is a valid OpenAPI specification (has openapi: "3.x.x")
  2. Check that you're signed in (status bar shows "Ready" or violation count)
  3. Try saving the file to trigger evaluation
  4. Check the Output panel (View > Output > REST Lens) for errors

Wrong API URL

The API URL is stored with your authentication. To change it:

  1. Run REST Lens: Sign Out
  2. Run REST Lens: Sign In
  3. Enter the correct API URL when prompted

Security

  • Credentials are stored securely in VS Code's SecretStorage
  • API URL is stored with your authentication tokens
  • Project settings are stored in workspace settings (.vscode/settings.json)
  • No sensitive data is stored in plain text files

Requirements

  • VS Code 1.85.0 or later
  • REST Lens account with at least one project

Source Code

The extension is open source: github.com/Edthing/restlens-ide