@jbearak/sight
v0.14.1
Published
A static analyzer and language server for the Stata statistical programming language
Downloads
1,166
Maintainers
Readme
Sight
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
doandincludechains, 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
.vsixfrom 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/includechains 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
.dtafiles directly in VS Code, or callvviewfrom 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 abbreviationsbrows/brow/bro/br) works as an alias forvview(the GUI's built-inbrowseis 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
.dofiles and normalize comment styles
Documentation
Guides
- Configuration - All settings and options
- CLI -
sight checkfor CI and command-line diagnostics - Standalone Installation - CLI usage, release binary, build from source
- Editor Integrations - Generic LSP clients, AI agents
- Neovim Setup - Configure Sight for Neovim
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.
Command completion
Syntax highlighting
Sight colorizes nesting depth of compound strings and local macros.
Send to Stata
Execute code in Stata directly from the editor.
See the Examples Gallery for more screenshots.
Installation
From Extension Registry
From VSIX
- Download the latest
.vsixfrom the releases page - 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-enhancedorstata-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 --helpFrom Homebrew (macOS, Apple Silicon)
brew install jbearak/sight/sight
sight --helpInstalls the prebuilt sight CLI from the
jbearak/sight tap. Apple Silicon
macOS only.
Other Methods
- Standalone CLI / Build from Source: See Standalone Installation
- Other Editors & AI Agents: See Editor Integrations
- Neovim: See Neovim Setup Guide
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.
