# FWD 4GL language server and VS Code extension: feature list

The language server runs the FWD conversion front end over the editor's unsaved text. The VS Code extension starts it.

## Editor and highlighting

- Opens `.p`, `.cls`, `.i` and `.w` files as Progress 4GL.
- Syntax colouring generated from FWD's own lexer keyword table, including every legal keyword abbreviation.
- Own colour scheme for includes, preprocessor names, constants, tables and fields, in light and dark themes.
- Colouring of `TODO`, `FIXME` and `XXX` in comments, with marks in the scroll bar.
- Block folding: procedures, functions, methods, `DO`/`FOR`/`REPEAT` blocks, property `GET`/`SET` and comments.
- Comment toggling, bracket matching, auto-closing of brackets and quotes.
- 32 snippets: procedures, functions, classes, definitions, data access, blocks, `RUN`, messages, preprocessor directives and a program header.

## Diagnostics (as you type)

- Checks the open file on every edit, unsaved text included, after a short pause.
- Lexer, parser and preprocessor errors at their position.
- An error inside an include is reported in the include and on each `{include}` reference in the program.
- Include not found on the PROPATH, listing the directories searched.
- `RUN` target program not found on the PROPATH.
- Variable defined but never used (faded).
- Database read with no lock mode (default `SHARE-LOCK`), can be turned off.
- Abbreviated field name.
- Open programs that use an include are re-checked when the include is saved or edited (always, ask or never).

## Navigation

- Go to Definition on an `{include}` reference, a `RUN` target, a `{&NAME}` reference and a declared name (variable, parameter, procedure, function, method, buffer, temp-table, field). A name declared in an include opens the include.
- Find References and Document Highlight in the same file, scope-aware.
- Rename Symbol for a name declared in the file, scope-aware, with refusal and a reason where the rename would be unsafe.
- Renaming or moving an include rewrites every `{include}` reference in the project (always, ask or never).

## Hover

- `{&NAME}`: the values the preprocessor resolved and where each comes from.
- Tables and fields: database, type and schema properties (format, label, help, validation and so on).
- Buffers, temp-tables and work-tables: what they are for or like, and their fields.
- Variables, parameters and properties: name, mode and type.

## Completion and signature help

- Include paths after `{`, directory by directory along the PROPATH.
- Preprocessor names after `{&`, with their values.
- Program paths after `RUN`.
- Fields after `record.`, records after a record keyword, and record names as you type.
- Attributes and methods after `:`, from the parser's own member table, optionally with FWD-only members.
- Signature help for procedures and functions declared in the file.

## Outline

- Outline, breadcrumbs and Go to Symbol, grouped: procedures, functions, variables, parameters, temp-tables, buffers, queries, streams, datasets, widgets, triggers and classes.
- Variables and parameters nested under their procedure or function, fields under their temp-table.
- AppBuilder "Definitions Block" and "Main Block" entries, and an "Include files" group.
- An include's own declarations are left out of the program's outline.

## Code actions

- Quick fixes Add `NO-LOCK` and Add `EXCLUSIVE-LOCK` on a read with no lock mode.
- Expand an abbreviated keyword or field name, one at a time or all in the file (source action "Expand abbreviations").
- Correct case: keywords in upper case, names and file names left as written (source action).

## Preprocessed (cache) view

- Show Preprocessed Source: the program's `.cache` file in a read-only view, marked up to date or stale.
- The cache and `.pphints` files are written on save (setting) and on Regenerate, only from text that matches the disk.
- Include regions tinted by nesting depth, labelled with the include name, and foldable (Fold to Source).
- Show Source returns to the program.

## DB Structure view

- Databases, tables, system tables and sequences, with each table's columns, indexes and triggers and their properties.
- Clicking a trigger opens its procedure.
- Table and field names coloured in the code.

## Tasks view

- `TODO`, `FIXME` and `XXX` comments of the whole project or the current file, grouped by priority and file.
- Configurable tags and priorities, owner in brackets.
- Complete Task removes the comment.

## Status bar

- Check state of the current file: warming up, checking, clean, or the counts of errors, warnings and notes. Clicking opens the Problems panel.

## Server

- Started by the extension, which finds the project (`cfg/p2j.cfg.xml`) and the FWD build itself, or uses the configured classpath.
- Long work runs off the message thread. The front end warms up in the background.
- A check writes nothing into the project.
- 15 settings, 10 commands, and the custom requests `fwd4gl/preprocessed`, `fwd4gl/regenerate`, `fwd4gl/tasks` and `fwd4gl/schema`.
