The Pipe VSCode extension provides syntax highlighting, auto-completion, auto-indentation, and code folding for .pipe files. It is bundled in the repository under vscode/.
cp -r vscode/ ~/.vscode/extensions/pipe-lang.pipe-syntax-0.1.0/Then restart VSCode or reload the window (Ctrl+Shift+P → "Developer: Reload Window").
-
Package the extension (see Building the Extension):
make vsix
-
Press
Ctrl+Shift+Pand run "Extensions: Install from VSIX...", then selectvscode/pipe-syntax-1.0.0.vsix.
ln -s $(pwd)/vscode ~/.vscode/extensions/pipe-lang.pipe-syntax-0.1.0/This keeps the extension in sync with the repository during development.
| Property | Value |
|---|---|
| Name | pipe-syntax |
| Display Name | Pipe Language Support |
| Publisher | pipe-lang |
| Version | 0.1.0 |
| Engine | VSCode >=1.85.0 |
| Language ID | pipe |
| File Extension | .pipe |
| Scope Name | source.pipe |
| Categories | Programming Languages |
| Icon | icons/pipe-icon.png |
The TextMate grammar (pipe.tmLanguage.json) provides scoped highlighting for all Pipe language constructs.
-- line comment→comment.line.double-dash.pipe- All text from
--to end of line is colored as a comment
"double-quoted strings"→string.quoted.double.pipe`backtick strings`→string.quoted.other.backtick.pipe- Escape sequences inside double-quoted strings (
\n,\t,\\,\") →constant.character.escape.pipe
- Conditional:
if,else if→keyword.control.conditional.pipe - Control flow:
else,match,while,for,in,try,catch,return,break,continue,defer,import→keyword.control.pipe
true,false→constant.language.boolean.pipenil→constant.language.nil.pipe_(wildcard in match patterns, after|) →constant.language.wildcard.pipe
| Category | Scope Name | Functions |
|---|---|---|
| I/O | support.function.builtin.io.pipe |
print, print_raw, input |
| File | support.function.builtin.file.pipe |
read_file, write_file, append_file, read_lines, file_exists, file_delete, file_move, file_copy, file_size, file_type, list_dir, make_dir, remove_dir |
| Path | support.function.builtin.path.pipe |
path_join, path_base, path_dir, path_ext |
| String | support.function.builtin.string.pipe |
upper, lower, trim, split, join, contains |
| List | support.function.builtin.list.pipe |
len, push, pop, at, sort, range, map, filter, reduce |
| Map | support.function.builtin.map.pipe |
get, set, keys, values |
| Math | support.function.builtin.math.pipe |
abs, min, max, pow, sqrt, round |
| HTTP | support.function.builtin.http.pipe |
http_get, http_post, http_get_json, parse_json, to_json |
| TCP | support.function.builtin.tcp.pipe |
tcp_listen, tcp_connect, tcp_connect_tls, tcp_accept, tcp_read, tcp_read_bytes, tcp_write, tcp_close |
| System | support.function.builtin.system.pipe |
exec, env, sleep, now, format_time, random, random_range, base64_encode, base64_decode, type_of, is_num, is_str, is_list, is_map, is_nil, to_str, to_num, regex_match, regex_replace |
- Assignment:
name: value→ variable name isvariable.other.pipe, colon iskeyword.operator.assignment.pipe - Compound assignment:
name += value→ variable name isvariable.other.pipe, operator iskeyword.operator.assignment.compound.pipe
- Integers:
42→constant.numeric.integer.pipe - Floats:
3.14→constant.numeric.float.pipe
- Vertical pipeline
> function(at line start, after indentation) →keyword.operator.pipeline.pipe
- Arrow:
->→keyword.operator.arrow.pipe - Pattern separator:
|(single) →keyword.operator.pattern.pipe
- Arithmetic:
**,*,/,%,+,-→keyword.operator.arithmetic.pipe - Comparison:
==,!=,<=,>=,<,>→keyword.operator.comparison.pipe - Logical:
not,!,&&,||→keyword.operator.logical.pipe - Concatenation:
++→keyword.operator.concat.pipe - Range:
..→keyword.operator.range.pipe
Configured in language-configuration.json:
( )— parentheses[ ]— square brackets{ }— curly braces
These pairs automatically insert the closing character:
"..."(not auto-closed inside existing strings)`...`(not auto-closed inside existing strings)(...)— parentheses[...]— square brackets{...}— curly braces
When text is selected and a bracket key is pressed, the selection is wrapped:
(...),[...],{...},"...",`...`
Triggered when a line begins with one of these keywords (unless else follows on the same line):
^\s*(if|while|for|fn|match|try|catch|defer)\b(?!.*\b(else)\b)
Meaning: after typing if, while, for, fn, match, try, catch, or defer (as the first keyword on a line), the next line will be auto-indented.
Example:
if x > 0
print "positive" <- auto-indented
Triggered when a line begins with else, else if, or catch:
^\s*(else|else if|catch)\b
Example:
if x > 0
print "positive"
else -- auto-outdented
print "not positive"
The extension supports region-based code folding using comment markers:
- Start region:
-- region [name] - End region:
-- endregion [name]
These markers follow the pattern:
- Start:
^\s*--\s*region - End:
^\s*--\s*endregion
Example:
-- region Initialization
x: 0
y: 1
z: 2
-- endregion Initialization
The entire block between -- region and -- endregion can be collapsed using VSCode's folding controls.
The word pattern for navigation (double-click selection, word-based cursor movement) is:
[A-Za-z_][A-Za-z0-9_]*
This means double-clicking on an identifier like my_var123 selects the entire identifier, including underscores.
Since version 0.1.0 the extension ships an LSP client that connects to the
pipe-lsp server, providing full IntelliSense for .pipe files:
- Auto-completion — user functions, variables, parameters, all builtins, keywords and snippets
- Hover documentation — signatures and descriptions for builtins and user code
- Signature help — parameter lists while typing a call
- Go-to-definition / Find references / Rename — for user symbols
- Diagnostics — parse errors, undefined variables (E001), unused variables (E007)
- Semantic highlighting — tokens classified on top of the TextMate grammar
- Format document — reformats the whole file (
pipe formatter)
Build the pipe-lsp binary once:
make lsp # or: go build -o bin/pipe-lsp ./cmd/pipe-lspThe extension looks for the binary in this order:
- the
pipe.lspPathsetting bin/pipe-lspinside the extension folder<workspace>/bin/pipe-lsppipe-lsponPATH
| Setting | Default | Description |
|---|---|---|
pipe.lspPath |
"" |
Absolute path to the pipe-lsp binary |
pipe.lsp.enabled |
true |
Set to false to disable the language server |
vscode/
├── icons/
│ ├── pipe-icon.png # Extension and language icon
│ └── pipe-icon.svg # Source vector icon
├── src/
│ └── extension.ts # LSP client bootstrap
├── syntaxes/
│ └── pipe.tmLanguage.json # TextMate grammar for syntax highlighting
├── language-configuration.json # Bracket pairs, auto-indent, folding rules
├── package.json # Extension manifest
├── tsconfig.json # TypeScript compiler config
├── .vscodeignore # Files excluded from the .vsix package
├── README.md # Marketplace listing
├── LICENSE # MIT license
├── test-syntax.pipe # Syntax test file (source)
└── pipe-syntax-1.0.0.vsix # Packaged extension (built with `make vsix`)
cd vscode
npm install
npm run compile # compiles src/ to out/
npm run build:server # builds bin/pipe-lsp inside the extensionTo produce an installable .vsix package (runs the prepublish build, then packages):
make vsix # or: cd vscode && npx @vscode/vsce packageThe extension has been tested with the following VSCode features and confirmed working:
- Syntax highlighting: All token categories render with appropriate colors in VSCode's default themes
- Bracket matching:
(),[],{}pairs highlight correctly - Auto-closing pairs: Brackets and quotes auto-close as expected
- Auto-indentation: Indent increase after control keywords, decrease on
else/catch - Code folding:
-- region/-- endregionmarkers create foldable regions - Comment toggling:
Ctrl+/toggles--line comments - Word selection: Double-click selects full identifiers including underscores
- Bracket content: Content inside
(),[],{}is not affected by INDENT/DEDENT logic
Pipe ships a Language Server Protocol (LSP) server (cmd/pipe-lsp, standard library only, no external dependencies). The VSCode extension connects to it automatically; see IntelliSense (Language Server) above.