Sloppy for VS Code
Support for Sloppy, a small compiled language for making games that
feels like a scripting language:
- highlighting, with names coloured by what they are (semantic tokens from the compiler)
- errors as you type (several at once, when they are in different functions), with quick fixes
where an error says what to change (a misspelled name,
loop mut, a mut parameter, a
number of another type)
- hover: types, signatures and doc comments
- go to definition (also into the standard library), find references, highlight uses, rename
- completion: names in scope, fields and functions after
., enum variants after a bare .
- signature help while typing arguments
- inlay hints: the inferred types of variables and function results
- outline (document symbols), and symbols across the workspace's files (Ctrl+T)
- debugging (F5, or Sloppy: Debug File): breakpoints, stepping, the call stack and the
variables (strings, arrays, maps and optionals shown as values), stopping where a program
panics; through CodeLLDB
or Microsoft's C/C++ extension (on Windows the C/C++ extension, with
lib/debug/sloppy.natvis)
- formatting (
sloppy fmt), on save by default ("[sloppy]": {"editor.formatOnSave": false} turns
that off)
- run the file in a terminal (Ctrl+F5, or the run button), in the browser, or its tests
- Sloppy: New Project: a folder with a game (or a program) to start from, which runs as it is
The language features come from the compiler itself: sloppy lsp is a language server that any
editor with LSP support can use.
The compiler
The extension needs the sloppy compiler (Linux on x86-64 or arm64, macOS on Apple silicon, or
Windows on x86-64). If it cannot find one, it offers to install the latest release (into
~/.sloppy, or %LOCALAPPDATA%\sloppy on Windows); or install it from a terminal, which also puts
it on your PATH:
curl -fsSL https://sloppy-lang.org/install | bash
On Windows, in PowerShell:
irm https://sloppy-lang.org/install.ps1 | iex
sloppy upgrade (or the command Sloppy: Install or Update the Sloppy Compiler) installs newer
releases.
The extension uses the setting sloppy.path if it is set, else bin/sloppy when the Sloppy
repository is the open folder, else sloppy from the PATH, else ~/.sloppy/bin/sloppy.
Links
| |