Peios Learn
Documentation

Peios

Peios Peios Kernel Universal Directory Project

Developer Tools

Trail Acta Provium clackatoo CAF GCSL Pekit

Applications

Framewright

Standards and Conventions

Standards and Conventions Peios Specifications
GCSL

Development Tools

Single-page view · as markdown

Checking and Formatting Programs

GCSL / Development Tools

You can check a GCSL program without running its effects, then format its source consistently. The checker and formatter deliberately have different scopes: checking needs workspace relationships; formatting only needs source text that parses.

Before you start #

You need gcsl and an existing source file or workspace. Commit or save your changes before rewriting files so you can review the formatting diff.

Check and format #

  1. Check a file, including its enclosing workspace if it has one:

    gcsl check main.gcsl
    
  2. Preview whether formatting would change that file:

    gcsl fmt --check main.gcsl
    
  3. Apply the formatter and repeat the check:

    gcsl fmt main.gcsl
    gcsl fmt --check main.gcsl
    

Check the result #

The checker reports its summary on standard error. Warnings alone do not make it fail. The final formatting check succeeds without listing the file when it is already formatted.

A file with lexical or syntax errors is left untouched by the formatter; fix those diagnostics and retry. Formatting does not require a successful type check. It uses one language style rather than editor-specific indent settings.

Checking a tree #

With no paths, both commands use the enclosing workspace and exclude nested workspaces. An explicit directory makes them discover nested workspaces too. However, gcsl check DIRECTORY checks workspaces, not unattached .gcsl files under that directory. Pass each standalone file explicitly when it also needs checking.

For automation, gcsl check --message-format json main.gcsl writes one JSON diagnostic per line to standard output and keeps the summary on standard error. See gcsl(1) for the schema and exit statuses.

Configuring an Editor

GCSL / Development Tools

The GCSL language server supplies diagnostics and navigation from the same checker that runs programs. You can use it in an editor that supports the Language Server Protocol (LSP) over standard input and standard output.

Before you start #

You need the following:

  • An editor with configurable LSP support.
  • The gcsl executable on the editor's command search path.
  • A GCSL file or workspace to open.

Connect the server #

  1. Associate files ending in .gcsl with a GCSL language entry in your editor.
  2. Set the server command to gcsl and its argument list to ["lsp"]. Use standard input and standard output for transport.
  3. Open a GCSL file. For a multifile project, open the workspace directory so the editor can supply file changes and watch notifications.

Check the result #

Hover over a declared name to see its type. Introduce a misspelled name and confirm that the editor displays a diagnostic. When an unambiguous spelling suggestion is available, a quick fix offers the replacement.

The server checks source but does not evaluate programs. It supports completion, signature help, inlay hints, formatting, symbol search, and references. Rename checks the proposed edits before returning them and refuses changes that introduce errors or change name resolution. It does not rename files, directories, or standard-library declarations.

Incomplete source #

The index retains useful information around many syntax errors. For an unbalanced block, a query can use a repaired copy to answer navigation or completion while diagnostics still describe the real text. Rename needs the real source to be valid enough to verify and can be refused instead.

Editor syntax highlighting is a separate integration. The grammar and queries in tree-sitter-gcsl are maintained in their own repository; they are not required for the gcsl lsp process to check your code.

Peios Learn — documentation for Peios software.

Built with Trail.