Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sight — an open-source language server for Stata

    Dear Statalisters,

    I'd like to share Sight, a free, open-source language server for Stata with a companion VS Code extension. It provides features like go-to-definition, autocomplete, document symbols, find references, formatting, and live error-checking.

    A few concrete examples of where it helps:

    - A typo in a local macro name — `froot' for `root' — silently evaluates to the empty string in Stata, which can quietly flip which branch of an if statement runs, with no error. Sight flags it before you run anything.

    - When your code is split across files — say a setup.do that defines globals and programs, pulled in with do/run/include — Sight follows the chain. Go-to-definition on a global or program jumps to where it's set in the other file, completion offers it, and the undefined-symbol check knows it's in scope, so you don't get false warnings for things defined upstream.

    - On a large or inherited project, you can jump to the definition of a program, variable, or macro — or list every place one is used across the codebase, instead of grepping. A document outline shows the macros, programs, and variables in a file at a glance.

    The extension also adds a data browser for .dta files, with value labels and a virtualized grid for large datasets — or you can push the current dataset from a running Stata session into it with vview. There are viewers for .smcl logs and .sthlp help files. And you can send a selection, the current statement, or the whole file to the Stata app or to Stata running in VS Code's integrated terminal — an RStudio-style editor-and-console setup in one window.

    Because it's a VS Code extension, it runs in compatible editors too — Positron, for instance, so you could use one IDE for both R and Stata. The server works with any LSP client (Neovim setup is documented).

    VS Code: https://marketplace.visualstudio.com...=jbearak.sight
    Open VSX: https://open-vsx.org/extension/jbearak/sight
    GitHub: https://github.com/jbearak/sight

    Sight was built with substantial help from AI coding tools. A code-analysis tool seemed a fair place to use them — the analysis is read-only, so it never touches your data or results; a warning it misses leaves you no worse off, and a false one you can ignore and report. I've relied on it on large codebases for months.

    Sight is free and GPL-3.0 licensed. Bug reports and contributions are welcome, and thanks for taking a look.

    Best,
    Jonathan Bearak
Working...
X