Skip to content

jbearak/sight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

709 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sight - Language Server for Stata

An open source Language Server Protocol (LSP) implementation for the Stata statistical programming language, with a corresponding extension for VS Code.

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.

Development Status: Sight is an early-stage implementation. While functional, it requires substantial testing and code review. Contributions 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 provides Stata language support for VS Code, its forks (Antigravity, Cursor, Kiro, Positron, and Windsurf), and Zed. This repository, Sight, contains the language server, editor extension, and TextMate grammar. The corresponding Zed extension is in zed-stata, and the tree-sitter grammar is in tree-sitter-stata. Like the language server, the grammar can be used in any editor.

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:

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

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
  • Quote Auto-Close: Intelligently handles Stata's unique conventions for nested macros and compound strings

Documentation

Guides

Features

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

  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-client-<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. Extensions like stataRun (which launches Stata from VS Code) can remain enabled.

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages