Sight

June 28, 2026 · View on GitHub

Sight is a static analyzer and language server for the Stata statistical programming language. It resolves what's in scope at each line — catching undefined macros and used-before-defined references even in a single script, and across files by following do/run/include chains — without running your code. Sight ships as an extension for VS Code, bringing real-time diagnostics and code intelligence to your editor as you type; it also runs as a standalone Language Server Protocol (LSP) server for other editors and headlessly via sight check for automated checks in CI.

tl;dr: Sight brings modern IDE superpowers to Stata coding. It goes far beyond syntax highlighting, using semantic analysis to provide workspace-wide symbol resolution and intelligent macro tracking. With features like Go-to-Definition, Autocomplete, and Real-time Diagnostics that trace execution through do and include chains, Sight helps you catch errors before you run your code.

Status: Sight is under active development. It works well for day-to-day use but hasn't been widely announced yet. Bug reports and feedback are welcome!

Quick Start: Install from the VS Code Marketplace or OpenVSX, or download the .vsix from the releases page. See Installation for other methods.

Sight's sister project Raven implements a language server for R. Together they bring cross-file navigation, error detection, and code intelligence to two languages widely used in social science research.

Features

Language Server:

  • Diagnostics: Real-time syntax error detection and undefined macro warnings
  • Code Completion: Context-aware completions for commands, options, macros, and variables
  • Go-to-Definition: Jump to definitions of local/global macros and programs across the workspace
  • Find References: Locate every use of a macro, program, or variable across related files
  • Cross-file awareness: Symbol resolution across do/include chains with position-aware scope
  • Declaration directives: Suppress diagnostics for dynamically-created symbols (sight: local, sight: global; @lsp- remains an alias)
  • Document Outline: Hierarchical code navigation with programs, macros, variables, and code sections
  • Workspace Symbols: Search for symbols across the entire workspace

Editor Extension:

The editor extension enables language server features and further provides:

  • Run Code: Execute code in the Stata application or terminal with intelligent statement detection and working directory management
  • Syntax Highlighting: Rich syntax highlighting with unique features like macro/string nesting depth coloring
  • Auto-Closing Pairs: Intelligently handles Stata's unique conventions for nested macros and compound strings
  • Data Browser: Open .dta files directly in VS Code, or call vview from Stata to send the current dataset to the editor — features a virtualized grid with column resizing/hiding and value labels. In console Stata, browse (and its abbreviations brows/brow/bro/br) works as an alias for vview (the GUI's built-in browse is unaffected)
  • Log Viewer: Render Stata log files (.smcl) with formatted output directly in VS Code
  • Help Viewer: Read Stata help files (.sthlp) directly in VS Code with clickable help-topic links
  • Code Formatting (experimental): Format .do files and normalize comment styles

Documentation

Guides

Per-feature reference pages live in docs/ and are linked from most entries in Features above.

Examples

Undefined local macro

Stata would evaluate `froot' to "" because of the misspelling. In this example, it affects the displayed text. When combined with if-then-else statements, this leads to unexpected control flow. Undefined local macro diagnostic

Command completion

Command completion popup

Syntax highlighting

Sight colorizes nesting depth of compound strings and local macros.

Syntax highlighting with nesting depth colors (dark theme) Syntax highlighting with nesting depth colors (light theme)

Send to Stata

Execute code in Stata directly from the editor. Send to Stata menu

See the Examples Gallery for more screenshots.

Installation

From Extension Registry

From VSIX

  1. Download the latest .vsix from the releases page
  2. In VS Code:
  • Extensions → ... menu → "Install from VSIX..."
  • Or via CLI: code --install-extension sight-<version>.vsix

Note: If you have other extensions installed that provide Stata syntax highlighting (e.g., stata-enhanced or stata-language), disable them to use Sight's syntax highlighting.

From npm

For command-line use or editors that connect to an external LSP server:

npm install -g @jbearak/sight
sight --help

From Homebrew (macOS, Apple Silicon)

brew install jbearak/sight/sight
sight --help

Installs the prebuilt sight CLI from the jbearak/sight tap. Apple Silicon macOS only.

Other Methods

Development

See Development Notes for build instructions, testing, and release process.

License

Copyright © 2026 Jonathan Marc Bearak GPLv3 - This project is open source software. You can use, modify, and distribute it with attribution, but any derivative works must also be open source under GPLv3.