Go to Definition: Navigate to procedure, function, and variable definitions
Hover Information: Documentation for keywords and builtins
Completions: Auto-complete keywords, builtins, and local symbols
Document Symbols: Outline view of procedures and functions
Diagnostics
Parse error detection and reporting
Inline error highlighting
Snippets
Quick templates for common YSH patterns:
proc - Procedure definition
func - Function definition
var - Variable declaration
if - If statement
for - For loop
And more...
Installation
From VS Code Marketplace
Open VS Code
Go to Extensions (Ctrl+Shift+X)
Search for "YSH"
Click Install
From Source
Clone the repository
Navigate to editors/vscode-ysh
Run npm install
Run npm run compile
Press F5 to launch the extension in a new VS Code window
Configuration
Setting
Default
Description
ysh.enable
true
Enable YSH language features
ysh.trace.server
off
Trace communication with the language server
ysh.oilsPath
oils-for-unix
Path to the Oils interpreter
ysh.maxNumberOfProblems
100
Maximum number of problems to report
ysh.lint.enable
true
Enable linting
Usage
File Extensions
The extension activates for files with the following extensions:
.ysh - YSH files
.osh - OSH files (bash-compatible)
Example YSH Code
#!/usr/bin/env ysh
# Define a procedure
proc greet (name) {
echo "Hello, $name!"
}
# Define a function
func add(a, b) {
return (a + b)
}
# Use YSH expressions
var x = 42
var result = $[add(x, 8)]
if (result > 0) {
greet 'World'
}
# Iterate over a list
var items = ['apple', 'banana', 'cherry']
for item in (items) {
echo "Fruit: $item"
}
Commands
Command
Description
YSH: Restart Language Server
Restart the language server
YSH: Show Parse Tree
Show the parse tree of the current file (debugging)