First Language
Language support for the First programming language in VS Code — a functional-first language with dependent types, refinement types, and built-in theorem proving.
Features
- Syntax highlighting — keywords, types, literals, comments, theorem declarations, and tactics
- Diagnostics — real-time compiler errors and type errors as you type
- Hover — type information for any expression under the cursor
- Go-to-definition — jump to function, type, and theorem declarations
- Completion — keywords, functions, types, and local variables
All features are powered by first-lsp, the First language server.
Requirements
Install the First compiler (which includes first-lsp):
macOS:
brew tap akkeshavan/first
brew install first-compiler
Linux (x86_64):
curl -sSfL https://raw.githubusercontent.com/akkeshavan/first/main/scripts/install-linux.sh | bash
The extension finds first-lsp on your PATH automatically after installation.
Getting Started
- Install the compiler (above)
- Open any
.first file — the language server starts automatically
- Create a new project with
fir new hello && cd hello && fir run
The full language reference is in the First Book.
Settings
| Setting |
Default |
Description |
first.lspPath |
"" |
Override path to the first-lsp binary. Leave empty to use first-lsp on PATH. |
first.trace.server |
"off" |
Trace LSP communication. Set to "messages" or "verbose" to debug. |
Example
import "Prelude"
// Pure function — compiler enforces no side effects
function safeDivide(a: Int, b: Pos) -> Int {
return a / b;
}
// Theorem proved at compile time, erased at runtime
theorem add_comm(a: Int, b: Int) : a + b = b + a {
by ring
}
interaction main() -> Unit {
println("100 / 5 = " + intToString(safeDivide(100, 5)));
}
Links
- First Book — full language reference (24 chapters)
- GitHub — compiler, stdlib, examples
- Issues — bug reports and feature requests