Editor support for the Sun programming language:
a compiled language with Rust-style borrow checking and an LLVM backend.
Features
Syntax highlighting for .sun source files, backed by semantic tokens from the Sun lexer, plus file icons for .sun and .moon bundles.
Diagnostics from the Sun compiler as you type: parse errors, type errors and borrow-checker errors.
Hover to see the type of a variable, field, function or method.
Go to definition, including into library sources: symbols from a .moon bundle open the original .sun file when it is on disk.
Find references to every use of a symbol across the files of a manifest. Referencing an interface member also lists the class members implementing it, and the other way around.
Rename symbol across the files of a manifest. An interface member is renamed together with the class members implementing it. Symbols declared in a library cannot be renamed.
Formatting via "Format Document" and format-on-save.
Cross-file analysis: files listed in a manifest block are analyzed together with their entrypoint. Manifests are discovered automatically, or set explicitly with sun.entrypoints.
Requirements
The extension talks to the Sun language server, sun-lsp, which ships with the Sun compiler.
By default it is looked up on your PATH; set sun.lsp_path to point at it if it lives
elsewhere (for example a local build at build/sun-lsp).
Settings
Setting
Description
sun.lsp_path
Path to the sun-lsp executable. Defaults to sun-lsp on PATH. Relative paths resolve against the workspace folder.
sun.compiler_path
Path to the sun compiler, used by the Test Explorer to run tests. Defaults to sun on PATH; the binary next to sun-lsp is tried as a fallback.
sun.sun_configs
sun-config.json files whose entrypoints lists describe the project. Defaults to the workspace root's. Test discovery and entrypoint resolution use them; when they declare entrypoints, manifest scanning is skipped.
sun.sun_path
Extra directories added to SUN_PATH for module resolution. Defaults to the workspace folder.
sun.entrypoints
Entrypoint files containing a manifest block. When set, replaces automatic manifest discovery.
sun.path_variables
Path variables for manifest entries, e.g. {"LIBS": "libs"} for libraries: ["$LIBS/mathlib.moon"]. Equivalent to the compiler's --path-var flag; relative values resolve against the entrypoint's directory.
A folder can also hold a sun-config.json defining sunPath and
pathVariables for the entrypoints in and below it. Both the compiler and
the language server merge every config from the entrypoint's folder upward
(nearest definitions win; "root": true stops the search), and the merged
definitions override the settings above.