> Markdown version of [Impostazioni dell'editor](https://vaadin.com/docs/latest/it/contributing/editor-settings). Section index: [llms.txt](https://vaadin.com/docs/latest/it/contributing/llms.txt)

# Impostazioni dell’editor per i collaboratori

Configurare l’ambiente di sviluppo come fanno i dipendenti Vaadin rende più semplice revisionare e accettare i contributi di codice.

## <a id="regole-generali-di-formattazione"></a>Regole generali di formattazione

- **Spazi invece di tabulazioni**

- **Codifica UTF-8**

- **Terminatori di riga in stile Unix** `\n`

## <a id="convenzioni-di-codice"></a>Convenzioni di codice

1. Apra il **Window** **›** **Preferences** (Windows) oppure **Eclipse** **›** **Preferences** (Mac)

2. Nella pagina **Java** **›** **Code Style** **›** **Formatter**, importi la copia locale di [VaadinJavaConventions.xml](https://github.com/vaadin/flow/blob/main/eclipse/VaadinJavaConventions.xml)

3. Nella pagina **Java** **›** **Code Style** **›** **Organize Imports**, importi la copia locale di [flow.importorder](https://github.com/vaadin/flow/blob/main/eclipse/flow.importorder)

4. Nella scheda **Editor** **›** **Save Actions**, si assicuri che, nel caso in cui **Format source code** sia attivo, sia selezionata l’opzione **Format edited lines option**. Non utilizzi mai l’opzione **Format all lines**, poiché potrebbe introdurre numerose modifiche di codice non necessarie, rendendo le revisioni del codice un incubo.

5. Vada a **General** **›** **Workspace**

   1. Imposti **Text file encoding** su **UTF-8**

   2. Imposti **New text file line delimiter** su **Unix**

6. Vada a **XML** **›** **XML Files** **›** **Editor** e si assicuri che le impostazioni siano configurate come segue:

   - **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. Installi il plugin **Eclipse Code Formatter**, quindi riavvii IDEA

2. Apra **Settings** (`Ctrl`+`Alt`+`S` oppure `⌘`+`,`)

3. Nella pagina **Other Settings** **›** **Eclipse Code Formatter**

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

   2. Nella sezione **Supported file types**, selezioni **Enable Java**

   3. In **Eclipse Java Formatter config file**, indichi il percorso della copia locale di [VaadinJavaConventions.xml](https://github.com/vaadin/flow/blob/main/eclipse/VaadinJavaConventions.xml)

4. Vada a **Editor** **›** **Code Style**, e imposti **Hard wrap at (columns)** su **80**

**Import**

1. Apra **Settings** (`Ctrl`+`Alt`+`S` oppure `⌘`+`,`)

2. Vada a **Editor** **›** **General** **›** **Auto Import** e deselezioni **Optimize imports on the fly**

3. Vada a **Editor** **›** **Code Style** **›** **Java** e, nella scheda **Imports**

   1. Si assicuri che **Use single class import** sia selezionato

   2. Imposti sia **Class count to use import with '\*'** sia **Names count to use static import with '\*'** su **99**

   3. Nel riquadro **Import Layout**, si assicuri che **Layout static imports separately** sia selezionato

   4. Rimuova tutti i package nell’elenco **Packages to Use Import with '\*'**

   5. Organizzi gli import Java in conformità alla convenzione definita di seguito:

**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="avviso-di-copyright"></a>Avviso di copyright

Tutti i file di codice sorgente devono includere un avviso di copyright all’inizio del file.

1. Apra il **Window** **›** **Preferences** (Windows) oppure **Eclipse** **›** **Preferences** (Mac)

2. Nella pagina **Java** **›** **Code Style** **›** **Code Templates**, modifichi il template **Comments** **›** **Files** per aggiungere il testo di copyright:

**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. Apra **Settings** (`Ctrl`+`Alt`+`S` oppure `⌘`+`,`)

2. Vada a **Editor** **›** **Copyright** **›** **Copyright Profiles** e crei un nuovo profilo denominato **Vaadin**, con il testo di copyright come definito di seguito.

3. Torni un livello sopra, a **Editor** **›** **Copyright**, e imposti **Default project copyright** sul profilo **Vaadin** creato

**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`
