Formatter Settings
Relevant source files
The following files were used as context for generating this wiki page:
Formatter Settings define and manage the default code formatting engines for each programming language supported in Acode. This system allows you to standardize code style by selecting between internal tools or external extensions.
Overview
Acode uses the Formatter category within the Settings menu to map specific languages to formatting providers. If a language has multiple formatters available, you must select a default. You can expand the available options by installing additional plugins from the Plugin Registry.
Sources: user-guide/settings/formatter.md:1-5, user-guide/settings.md:46
Accessing Formatter Settings
You can navigate to Formatter settings through the following methods:
| Method | Interaction |
|---|---|
| Main Menu | Open Menu → Tap Settings → Select Formatter |
| Shortcut | Press Ctrl + , then select the Formatter category |
| Command Palette | Search for "Show Settings" and navigate to Formatter |
Sources: user-guide/settings.md:13-21, user-guide/settings.md:46
Architecture and Logic
The Formatter system operates by linking a language identifier to a specific formatting implementation.
Formatter Selection Flow
When you tap a language in the Formatter settings page, the application presents a selection box containing all compatible formatters.
The diagram shows the process of identifying and selecting a provider for a specific language.
Sources: user-guide/settings/formatter.md:7-14
Provider Types
Acode supports two primary types of formatters:
- Built-in: These formatters ship with the Acode application and require no additional installation.
- Plugin-based: These formatters, such as Prettier, are installed via the Plugin Registry. They register themselves as available formatters for specific file types upon installation.
Sources: user-guide/settings/formatter.md:11-14, user-guide/plugins.md:27
Editor Integration
The Formatter Settings work in conjunction with Editor Settings to automate code cleaning. The Format on Save option triggers the active formatter every time you save a file.
Configuration Settings
| Setting | Location | Description | Default |
|---|---|---|---|
| Format on Save | Editor Settings | Automatically runs the selected formatter when a file is saved. | Off |
| Default Formatter | Formatter Settings | Sets the specific engine used for a particular language. | Varies |
The sequence diagram illustrates the logic gate between the Editor's save action and the Formatter implementation.
Sources: user-guide/settings/editor-settings.md:15, user-guide/settings/formatter.md:7-9
Project-Level Configuration (Biome Example)
While Acode manages formatters through UI settings, individual projects may define their own rules via configuration files like biome.json. The application or plugin-based formatters read these files to apply specific styles.
{
"formatter": {
"enabled": true,
"indentStyle": "tab"
},
"javascript": {
"formatter": {
"quoteStyle": "double"
}
}
}
Sources: biome.json:13-25
Summary
Formatter Settings centralize the management of code style engines. By combining built-in tools with the extensible plugin system, Acode provides a flexible environment for maintaining code consistency. Integration with "Format on Save" ensures that formatting logic is applied automatically during the development workflow.