GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - zaneduffield/pasfmt: Delphi code formatter

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

397 Commits
397 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
core
core
 
 
docs
docs
 
 
front-end
front-end
 
 
misc
misc
 
 
orchestrator
orchestrator
 
 
web
web
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
CHANGELOG.md
CHANGELOG.md
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
LICENSE.txt
LICENSE.txt
 
 
NOTICE.txt
NOTICE.txt
 
 
README.md
README.md
 
 

Repository files navigation

pasfmt

pasfmt is a complete and opinionated formatter for Delphi code.

Goals

  1. Enforce a sensible, opinionated, and consistent formatting style.
  2. Format the entire file - none of the input code is left unformatted.
  3. Support all modern Delphi language features.
  4. Fast.
  5. Format invalid or incomplete code (within reason).

Getting Started

Try the web demo, download the latest release, or build from source.

To format one pas, dpr, or dpk file (in-place), run

pasfmt path/to/file.pas

To recursively format all supported files in a directory (in-place), run

pasfmt path/to/directory/

To show all command-line options, run

pasfmt --help

Configuration

Some aspects of formatting style can be controlled from a configuration file.

The full list of available options is here, and can also be printed from the command line by running pasfmt -C help.

To customise the configuration, create a file called pasfmt.toml in the root directory of the project you are formatting. Make sure that pasfmt is being run from that directory, or a child directory.

For example:

# in a file called pasfmt.toml

# change the target line length
wrap_column = 100

# in most cases, it is not necessary to configure the encoding
encoding = "UTF-8"

Specific pasfmt.toml files can also be used from the command-line:

pasfmt --config-file path/to/pasfmt.toml path/to/file.pas

Additionally, configuration options can be specified on the command-line, which will override values from the file:

pasfmt -C wrap_column=100

Disabling formatting

If there are sections of code that you would rather the formatter skip over, you can temporarily disable formatting:

// pasfmt off
const ValueMap: TArray<Integer> = [
    1, 2,
    3, 4,
    5, 6
];
// pasfmt on

Integrations

  • pasfmt-rad: a Delphi IDE extension for pasfmt
  • pasfmt-action: a GitHub Action for integrating pasfmt into GitHub CI workflows

Building from Source

  1. Install Rust (>= 1.82)
  2. cargo build --release

Licence

This project is licensed under LGPL-3.0.

About

Delphi code formatter

Resources

Readme
License
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.