You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -56,7 +56,7 @@ These are some of the projects using Prettier Solidity:
56
56
Prettier provides a flexible system to configure the formatting rules of a project. For more information please refer to the [documentation](https://prettier.io/docs/en/configuration.html).
57
57
The following is the default configuration internally used by this plugin.
58
58
59
-
```json
59
+
```JSON
60
60
{
61
61
"overrides": [
62
62
{
@@ -122,7 +122,7 @@ Many versions of the Solidity compiler have changes that affect how the code sho
122
122
123
123
One example of this are import directives. Before `0.7.4`, the compiler didn't accept multi-line import statements, so we always format them in a single line. But if you use the `compiler` option to indicate that you are using a version greater or equal than `0.7.4`, the plugin will use multi-line imports when it makes sense.
124
124
125
-
The solidity versions taken into consideration during formatting are:
125
+
The Solidity versions taken into consideration during formatting are:
126
126
127
127
-`v0.7.4`: Versions prior `0.7.4` had a bug that would not interpret correctly imports unless they are formatted in a single line.
128
128
@@ -178,7 +178,7 @@ The solidity versions taken into consideration during formatting are:
178
178
179
179
You might have a multi-version project, where different files are compiled with different compilers. If that's the case, you can use [overrides](https://prettier.io/docs/en/configuration.html#configuration-overrides) to have a more granular configuration:
180
180
181
-
```
181
+
```JSON
182
182
{
183
183
"overrides": [
184
184
{
@@ -237,7 +237,7 @@ version installed in the vim plugin's directory. The vim-plug directory depends
237
237
let g:prettier#exec_cmd_path = '~/.vim/plugged/vim-prettier/node_modules/.bin/prettier'
238
238
```
239
239
240
-
To check that everything is working, open a solidity file and run `:Prettier`.
240
+
To check that everything is working, open a Solidity file and run `:Prettier`.
241
241
242
242
If you also want to autoformat every time you write the buffer, add these lines:
243
243
@@ -250,16 +250,24 @@ Now Prettier will be run every time the file is saved.
250
250
251
251
### VSCode
252
252
253
-
VSCode is not familiar with the solidity language, so [`solidity`](https://marketplace.visualstudio.com/items?itemName=JuanBlanco.solidity) support needs to be installed.
253
+
VSCode is not familiar with the Solidity language.
254
+
There are 2 extensions that you can install to provide support for Solidity:
This extension provides basic integration with Prettier for most cases no further action is needed.
265
+
> :warning:**These 2 extensions offer similar functionality and will clash with each other**: Please choose which one matches your projects better.
266
+
267
+
These extensions provide basic integration with Prettier; in most cases, no further action is needed.
260
268
261
269
Make sure your editor has format on save set to true.
262
-
When you save VSCode will ask you what formatter would you like to use for the solidity language, you can choose `JuanBlanco.solidity`.
270
+
When you save VSCode will ask you what formatter would you like to use for the Solidity language, you can choose `JuanBlanco.solidity` or `NomicFoundation.hardhat-solidity`.
263
271
264
272
At this point VSCode's `settings.json` should have a configuration similar to this:
265
273
@@ -268,7 +276,8 @@ At this point VSCode's `settings.json` should have a configuration similar to th
268
276
"editor.formatOnSave": true,
269
277
"solidity.formatter": "prettier", // This is the default so it might be missing.
To interact with 3rd party plugins, `prettier-vscode` will look in the project's npm modules, so you'll need to have `prettier` and `prettier-plugin-solidity` in your `package.json`
@@ -318,7 +327,7 @@ Prettier Solidity does its best to be pretty and consistent, but in some cases i
318
327
319
328
Modifiers with no arguments are formatted with their parentheses removed, except for constructors. The reason for this is that Prettier Solidity cannot always tell apart a modifier from a base constructor. So modifiers in constructors are not modified. For example, this:
0 commit comments