> Markdown version of [Editor Settings](https://vaadin.com/docs/next/contributing/editor-settings). Section index: [llms.txt](https://vaadin.com/docs/next/contributing/llms.txt)

# Editor Settings for Contributors

Setting up your development environment as do Vaadin employees makes it easier to review and accept code contributions.

## <a id="general-formatting-rules"></a>General Formatting Rules

- **Spaces instead of tabs**

- **UTF-8 encoding**

- **Unix-style line endings** `\n`

## <a id="code-conventions"></a>Code Conventions

1. Open **Window** **›** **Preferences** (Windows) or **Eclipse** **›** **Preferences** (Mac)

2. On the **Java** **›** **Code Style** **›** **Formatter** page, import your local copy of [VaadinJavaConventions.xml](https://github.com/vaadin/flow/blob/main/eclipse/VaadinJavaConventions.xml)

3. On the **Java** **›** **Code Style** **›** **Organize Imports** page, import your local copy of [flow.importorder](https://github.com/vaadin/flow/blob/main/eclipse/flow.importorder)

4. On the **Editor** **›** **Save Actions** tab, make sure that in case **Format source code** is active, the **Format edited lines option** is selected. Never use the **Format all lines** option, as that may introduce loads of unnecessary code changes, making code reviews a nightmare.

5. Go to **General** **›** **Workspace**

   1. Set **Text file encoding** to **UTF-8**

   2. Set **New text file line delimiter** to **Unix**

6. Go to **XML** **›** **XML Files** **›** **Editor** and ensure the settings are configured as follows:

   - **Line width**: **80**

   - **Format comments**: **true**

   - **Join lines**: **true**

   - **Insert whitespace before closing empty end-tags**: **true**

   - **Indent using spaces**: **true**

   - **Indentation size**: **4**

**Eclipse**

```java
```

1. Install the **Eclipse Code Formatter** plugin, then restart IDEA

2. Open **Settings** (`Ctrl`+`Alt`+`S` or `⌘`+`,`)

3. On the **Other Settings** **›** **Eclipse Code Formatter** page

   1. Check **Use the Eclipse code formatter**

   2. In the **Supported file types** section, check **Enable Java**

   3. In **Eclipse Java Formatter config file**, browse to your local copy of [VaadinJavaConventions.xml](https://github.com/vaadin/flow/blob/main/eclipse/VaadinJavaConventions.xml)

4. Go to **Editor** **›** **Code Style**, and set **Hard wrap at (columns)** to **80**

**Imports**

1. Open **Settings** (`Ctrl`+`Alt`+`S` or `⌘`+`,`)

2. Go to **Editor** **›** **General** **›** **Auto Import** and un-check **Optimize imports on the fly**

3. Go to **Editor** **›** **Code Style** **›** **Java** and on the **Imports** tab

   1. Make sure that **Use single class import** is checked

   2. Set both **Class count to use import with '\*'** and **Names count to use static import with '\*'** to **99**

   3. On the **Import Layout** pane, make sure that **Layout static imports separately** is checked

   4. Remove all the packages in the list **Packages to Use Import with '\*'**

   5. Organize Java imports to comply to the convention defined below:

**IntelliJ IDEA**

```java
import javax.*
import java.*
<blank line>
import all other imports
<blank line>
import com.google.gwt.*
import com.vaadin.*
<blank line>
import elemental.*
import static all other imports
```

## <a id="copyright-notice"></a>Copyright Notice

All source code files need to include a copyright notice at the beginning of the file.

1. Open **Window** **›** **Preferences** (Windows) or **Eclipse** **›** **Preferences** (Mac)

2. On the **Java** **›** **Code Style** **›** **Code Templates** page, edit the **Comments** **›** **Files** template to add the copyright text:

**Eclipse**

```txt
Copyright 2000-${currentDate:date('yyyy')} Vaadin Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under
the License.
```

1. Open **Settings** (`Ctrl`+`Alt`+`S` or `⌘`+`,`)

2. Go to **Editor** **›** **Copyright** **›** **Copyright Profiles** and create a new profile named **Vaadin**, with the copyright text as defined below.

3. Go one level higher, to **Editor** **›** **Copyright**, and set **Default project copyright** to the **Vaadin** profile you created

**IntelliJ IDEA**

```txt
Copyright 2000-$today.year Vaadin Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under
the License.
```

`A0EF8ED7-DED5-454E-A5D0-DA4F9669F650`
