Sans Language Support for VS Code

This extension provides comprehensive language support for the Sans programming language in Visual Studio Code.
One language. Every platform.
Installation
From VS Marketplace (Recommended)
- Open VS Code
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for "Sans Language Support"
- Click Install
Or install via command line:
code --install-extension sans-lang.sans-lang
From VSIX File
Download the latest .vsix file from Releases and install:
code --install-extension sans-lang-0.1.0.vsix
Language Server Setup
The extension requires the Sans Language Server (sans-lsp) for full functionality.
Install with Cargo
cargo install sans-lsp
Build from Source
git clone https://github.com/sans-lang/sans
cd sans
cargo build --release -p sans-lsp
# Add target/release to your PATH
Features
Syntax Highlighting
Full TextMate grammar support for Sans source files with semantic token highlighting.

IntelliSense
- Code Completion: Context-aware completions for keywords, types, functions, and variables
- Hover Information: Documentation and type information on hover
- Signature Help: Parameter hints when calling functions
Navigation
- Go to Definition: Jump to symbol definitions (F12 / Cmd+Click)
- Find All References: Find all usages of a symbol (Shift+F12)
- Document Symbols: Quick navigation via outline view (Ctrl+Shift+O / Cmd+Shift+O)
Diagnostics
Real-time error checking and warnings as you type.
Automatic code formatting with configurable settings:
- Tab size and spaces/tabs preference
- Format on save option
Inlay Hints
Type annotations displayed inline for better code understanding.
Configuration
Access settings via File > Preferences > Settings and search for "Sans".
| Setting |
Default |
Description |
sans.lsp.path |
"" |
Path to the sans-lsp executable. Empty uses PATH. |
sans.lsp.args |
[] |
Additional arguments for the language server |
sans.lsp.trace |
"off" |
Trace LSP communication ("off", "messages", "verbose") |
sans.format.enable |
true |
Enable code formatting |
sans.format.onSave |
false |
Format document on save |
sans.format.tabSize |
4 |
Number of spaces per indentation level |
sans.format.insertSpaces |
true |
Use spaces instead of tabs |
sans.diagnostics.enable |
true |
Enable diagnostic messages |
sans.completion.enable |
true |
Enable code completion |
sans.hover.enable |
true |
Enable hover information |
sans.inlayHints.enable |
true |
Enable inlay hints |
sans.lint.enable |
true |
Enable lint warnings |
sans.lint.showTodoHints |
true |
Show TODO/FIXME comments as hints |
sans.lint.warnEmptyFunctions |
false |
Warn about empty function bodies |
Example settings.json
{
"sans.lsp.path": "/usr/local/bin/sans-lsp",
"sans.format.onSave": true,
"sans.format.tabSize": 2,
"sans.inlayHints.enable": true
}
Commands
Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and type "Sans" to see available commands:
| Command |
Description |
Sans: Restart Language Server |
Restart the LSP server |
Sans: Stop Language Server |
Stop the LSP server |
Sans: Start Language Server |
Start the LSP server |
Sans: Show Output Channel |
View LSP logs |
Sans: Show Version |
Display extension version |
Snippets
The extension includes useful snippets. Type the prefix and press Tab:
| Prefix |
Description |
fn |
Function definition |
afn |
Async function |
main |
Main entry point |
struct |
Struct definition |
enum |
Enum definition |
trait |
Trait definition |
impl |
Implementation block |
let |
Let binding |
if |
If statement |
ifelse |
If-else statement |
match |
Match expression |
for |
For loop |
while |
While loop |
loop |
Infinite loop |
test |
Test function |
mod |
Module declaration |
use |
Use statement |
Troubleshooting
Language server not found
Error: "Cannot find sans-lsp executable"
Solution:
- Ensure
sans-lsp is installed (see Language Server Setup)
- Verify it's in your PATH:
which sans-lsp
- Or set the explicit path in settings:
"sans.lsp.path": "/path/to/sans-lsp"
No syntax highlighting
Solution:
- Ensure the file has
.sans extension
- Check that Sans is selected as the language (bottom-right of VS Code)
- Reload VS Code window: Cmd+Shift+P > "Developer: Reload Window"
Diagnostics not working
Solution:
- Check that
sans.diagnostics.enable is true
- Restart the language server: Cmd+Shift+P > "Sans: Restart Language Server"
- Check output for errors: Cmd+Shift+P > "Sans: Show Output Channel"
High CPU usage
Solution:
- Check for very large files (>10,000 lines)
- Disable features you don't need (inlay hints, lint)
- Set
sans.lsp.trace to "off"
Extension crashes
Solution:
- Check VS Code version (requires 1.80.0+)
- Update to latest extension version
- Report issue with logs at GitHub Issues
Development
Building the Extension
Using Docker (recommended):
cd editors/vscode
docker-compose run --rm compile
Or locally:
npm install
npm run compile
Running in Development
- Open
editors/vscode folder in VS Code
- Press F5 to launch Extension Development Host
- Open a
.sans file to test
Packaging
# Using Docker
docker-compose run --rm vsce-package
# Or locally
npm run package
Publishing
# Set your VS Marketplace token
export VSCE_PAT=your-token-here
# Using the publish script
./vsce-publish.sh --publish
# Or using Docker
docker-compose run --rm vsce-publish
Known Issues
- Semantic highlighting may not work correctly in some edge cases with complex generics
- Large files (>10,000 lines) may experience slight delays in diagnostics
See GitHub Issues for all known issues.
Contributing
Contributions are welcome! Please read our Contributing Guide.
Reporting Issues
- Check existing issues
- Include VS Code version, extension version, and OS
- Attach relevant logs from "Sans: Show Output Channel"
Release Notes
See CHANGELOG.md for detailed release notes.
0.1.0
- Initial release with syntax highlighting, LSP integration, and code snippets
License
Apache-2.0 - See LICENSE for details.
Sans - One language. Every platform.
Website | Documentation | GitHub