> 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="https://3933488479-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjpWd52BKwABWxF2lScUK%2Fuploads%2Fgit-blob-511faaf61541dfb13e30a1c1d93f6ce7f1a65d23%2Fscript-editor-formatter.jpg?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
