Skip to content

Type to search extensions

Pascal

v0.1.0

Pascal language support.

Updated 9 months ago
44k downloads 19 stars Repository ↗

Pascal Zed Extension

Pascal Language extension for Zed

CI

Feature Status
Grammar (highlighting) tree-sitter-pascal
Language Server pasls
Linter Planned
Formatter Planned

Language server (pasls)

On supported platforms the extension downloads a prebuilt pasls binary from the pascal-language-server releases on first use and caches it. No prebuilt binary is available for macOS Intel (x86_64) or Windows ARM64 — on those platforms, install pasls manually on PATH (download a release binary or build from source, then symlink it into a directory on PATH), or set lsp.pasls.binary.path.

The extension spawns pasls from PATH and passes it only the environment variables you set. No environment variables are set by default — configure the CodeTools environment your installation needs under lsp.pascal.binary.env, for example:

"lsp": {
  "pascal": {
    "binary": {
      "env": {
        "PP": "/usr/bin/fpc",
        "FPCDIR": "/usr/share/fpcsrc",
        "LAZARUSDIR": "/usr/local/share/lazarus"
      }
    }
  }
}
  • PP — path to the Free Pascal compiler binary (e.g. /usr/bin/fpc).
  • FPCDIR — Free Pascal source directory (e.g. /usr/share/fpcsrc on Debian/Ubuntu, /usr/local/share/fpcsrc from source or Homebrew).
  • LAZARUSDIR — Lazarus sources directory (e.g. /usr/local/share/lazarus).
  • FPCTARGET — target operating system (e.g. linux, darwin, win32).
  • FPCTARGETCPU — target CPU (e.g. x86_64, aarch64).

Supported dialects

The grammar supports Pascal plus the Object Pascal (Delphi), Free Pascal (including PasCocoa) and Unleashed Pascal dialects. Dialect-specific syntax is controlled by the feature flags at the top of the grammar's grammar.js:

Flag Dialect Enables
delphi Delphi dispinterface, dispid, delayed external, deprecated on typerefs
fpc FPC generic/specialize, +=/-=/*=//=, inline var, bracket declaration hints ([public; alias:'x'; cdecl]), ABI/calling-convention hints
templates both Generic types and routines (Foo<T>, constraints, defaults)
lambda Delphi Anonymous procedures & functions (reference to)
rtti Delphi Extended RTTI attributes, e.g. [MyAttr(42)]
public_name FPC public name '_FOO' declaration hint
objc FPC PasCocoa: objcclass, objcprotocol, objccategory
use_pp both {$if}/{$else}/{$endif} preprocessor wrapper
unleashed Unleashed {$mode unleashed}: match, lock/trylock, async/await, defer, leave, for parallel, tuples, embed/union records, string interpolation, digit separators

Notes