Pikoc for VS Code
Support for the Pikoc Programming Language: TypeScript-style
syntax, compiled through LLVM to native code and WebAssembly.
reactive count = 0
const doubled = computed(() => count * 2)
const res = await fetch("https://api.example.com/users", {
headers: { "Accept": "application/json" },
})
Requirements
The extension runs the pikoc compiler, which isn't bundled: install a release from the
downloads (macOS, Linux and Windows) and put
its bin directory on your PATH, or point pikoc.server.path at it. Debugging also needs lldb
(lldb-dap; Xcode's on macOS).
Features
- Syntax highlighting for
.pi files and ```pikoc blocks in Markdown, with comment toggling,
bracket matching, auto-closing pairs and /** */ continuation.
- Errors and lint warnings as you type, also those in imported modules.
- Completion: names in scope, members after
., the names a module exports inside
import { … }, and module paths inside from "…": the standard library's modules, the
dependencies in project.json, and the files and directories of relative paths (./, ../).
- Hover with the type or signature and the doc comment, also in code that has errors.
- Go to Definition (into imported modules and the core library), Go to Implementations
(Ctrl+F12) and Rename Symbol (F2: every use in the project, methods with their overrides).
- Format Document with the
pikoc fmt formatter (options from project.json).
- Outline, breadcrumbs and Go to Symbol.
Debugging
Press F5: it debugs the entry of the nearest project.json, or the open file when there's no
project. The program is built in debug mode (cached while nothing changes) and runs under
lldb-dap. Breakpoints, stepping, the call stack, watches and variables work: strings as text,
arrays, maps and sets with their elements, enums by variant, reactive values with their current
value, and the program's globals. A program that doesn't compile shows the compiler's errors
instead. Run Build Task offers pikoc: build.
A pikoc launch configuration takes program (a .pi file, a project directory or an
executable), args, cwd, env and stopOnEntry.
A program that another one starts can't be launched by the debugger: for example, a backend
whose parent talks to it over its stdin and stdout. Attach to it instead. Use pid, or use
program (the executable) with waitFor: true, which attaches to the next process started
from it. The pikoc: Attach snippet writes the second form:
{ "type": "pikoc", "request": "attach", "name": "Attach to the backend", "program": "${workspaceFolder}/build/backend", "waitFor": true }
Settings
| Setting |
Default |
|
pikoc.server.path |
pikoc |
the pikoc binary. VS Code started from a desktop launcher may not have your shell's PATH: set an absolute path if the server doesn't start |
pikoc.server.args |
[] |
arguments before lsp |
pikoc.trace.server |
off |
messages/verbose: the protocol in the "pikoc language server" output |
The command pikoc: Restart Language Server restarts it, after updating pikoc for example.
Links
Website ·
Language tour ·
Specification ·
Issues
Working on the extension
From the repository: scripts/vscode-package.sh --install builds and installs
target/vscode/pikoc-<version>.vsix (it needs Node.js and npm), then reload the window. To debug
the extension itself, open editors/vscode and press F5. syntaxes/pikoc.tmLanguage.json is
generated: edit syntaxes/generate.py and run python3 editors/vscode/syntaxes/generate.py
from the repository root (crates/pikoc-tests/tests/vscode.rs checks it against the lexer).