> For the complete documentation index, see [llms.txt](https://docs.servoy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.servoy.com/reference/servoy-developer/object-editors/scripting-editor/code-formatting.md).

# Code Formatting

## Overview

This section provides detailed instructions on how to format your code within the Servoy Scripting Editor. It covers automatic code formatting on save, setting project-specific formatting profiles, and force formatting multiple projects. These features help ensure consistent code style across your development team, enhancing readability and maintainability of the codebase.

## Formatting Code on Save

A project's code can be automatically formatted (line breaks, indentations, etc) on save. To do this, the project-specific settings must be activated:

1. In Solution Explorer, select the currently active project and access the context menu (right-click).
2. Click on `Properties` at the bottom.
3. In the `Javascript` node, under Editor, click on `Save Actions`.
4. Click the checkbox to `Enable project specific settings`. The checkbox option for Format source code on save will be un-grayed.
5. Click the checkbox to `Format source code on save`.

## Project-Specific Formatting

Different format profiles can be set for different projects. The information is saved to the SVN in team development environments, allowing all developers working on a project to use the same format profile.

To set a project-specific format profile:

1. In Solution Explorer, select the currently active project and access the context menu (right-click).
2. Click on `Properties` at the bottom.
3. In the `Javascript` node, under Editor, click on `Formatter`.
4. Click the checkbox to `Enable project specific settings`.
5. Select a profile from the Drop-down list, or create/import a new profile using the respective buttons. (Note that you can also click on Edit to edit the default format profile.)

{% hint style="info" %}
Note\
If you select `New`, you will be prompted to type in a Profile name with the option to open the Edit Profile dialog. This dialog provides customizable options for general settings, Indents, Braces, White Space, and Control Statements.
{% endhint %}

<figure><img src="/files/wbiuOp4uGGcdR4GUHcgM" alt=""><figcaption></figcaption></figure>

## Force Formatting the Code Base of Entire Projects

Several projects can be formatted at once using the following steps:

1. Open the Script Explorer View using the main menu `Window > Show View > Other > Dynamic Languages > Script Explorer`.
2. Select the project(s) on which you want to perform the formatting.
3. Right-click to access the context menu (make sure your mouse pointer is hovering on top of a selected project).
4. Click on the menu item `Source > Format`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.servoy.com/reference/servoy-developer/object-editors/scripting-editor/code-formatting.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
