-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added guidelines for code formatting on save (#175)
* Add code formatting guidelines * Update code formatting instructions in documentation * Added category name of Source Code * Update docs/manual/98_contributing/05_source/60_codeFormatting.md Co-authored-by: Armando Salazar <[email protected]> * Update docs/manual/98_contributing/05_source/index.md Co-authored-by: Armando Salazar <[email protected]> --------- Co-authored-by: hanzlamateen <[email protected]> Co-authored-by: Armando Salazar <[email protected]>
- Loading branch information
1 parent
adb6f2a
commit 5135342
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
docs/manual/98_contributing/05_source/60_codeFormatting.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Code Formatting | ||
|
||
Prettier helps us maintain consistent code formatting across our projects. | ||
|
||
## Setting up Prettier in VS Code | ||
|
||
### Step 1. Install the Prettier Extension | ||
1. Press `Ctrl` + `P` to open the command palette. | ||
2. Type `ext install esbenp.prettier-vscode` and press `Enter`. | ||
3. Follow the prompts to install the Prettier extension. | ||
|
||
### Step 2. Open VS Code Settings | ||
Press `Ctrl` + `,` together to open the VS Code settings. | ||
|
||
### Step 3. Enable Format on Save | ||
1. In the search bar at the top, type `Format on Save`. | ||
2. You will see three tabs: **User**, **Remote**, and **Workspace**. | ||
3. Check the box next to **Editor: Format on Save** under the User and Remote tabs. | ||
|
||
:::note | ||
Do not check the box under the **Workspace** tab. | ||
::: | ||
|
||
### Step 4. Set Prettier as the Default Formatter | ||
1. Open any file in your workspace. | ||
2. Right-click within the file editor. | ||
3. Select **Format Document With...**. | ||
4. Choose **Configure Default Formatter...**. | ||
5. Select **Prettier - Code Formatter** from the list. | ||
|
||
|
||
|
||
## Verifying Your Setup | ||
|
||
To ensure code is automatically formatted upon saving: | ||
1. Open a file with some unformatted code. | ||
2. Make a small edit and save the file (`Ctrl` + `S`). | ||
3. Check if the code is automatically formatted upon saving. | ||
|
||
By following these steps, you ensure that Prettier is set up as the default code formatter and that formatting occurs automatically on save, reducing formatting issues across the team. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
position: 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import DocCardList from '@theme/DocCardList' | ||
|
||
# Source Code | ||
|
||
This section contains coding standards that help you effectively contribute to the engine's source code. | ||
|
||
<DocCardList /> |