Skip to content

Commit 71706b0

Browse files
committed
document editor integration for VSCode
1 parent 875f575 commit 71706b0

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,52 @@ nmap <F8> <Plug>(ale_fix) " Fix on F8
107107
```
108108

109109
Change all of these to your taste.
110+
111+
#### VSCode
112+
113+
114+
One can configure VSCode either in the [User 'settings.json' file](https://code.visualstudio.com/docs/configure/settings#_settings-json-file), or in a local [`.vscode/settings.json`](https://code.visualstudio.com/docs/configure/settings#_workspace-settingsjson-location).
115+
116+
117+
1. Install the [Python extension by Microsoft](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
118+
119+
1. Because ni-python-styleguide is a wrapper around `flake8`, you can add the following configuration
120+
to make it uses ni-python-styleguide's rules.
121+
122+
If using Poetry:
123+
```json
124+
"flake8.path": [
125+
"poetry",
126+
"run",
127+
"ni-python-styleguide",
128+
"lint"
129+
],
130+
```
131+
If ni-python-styleguide is directly installed
132+
```json
133+
"flake8.path": [
134+
"ni-python-styleguide",
135+
"lint"
136+
],
137+
```
138+
139+
(alternatively, tell `flake8` to use the ni-python-styleguide config)
140+
```json
141+
"flake8.args": [
142+
"--config=.venv\\lib\\site-packages\\ni_python_styleguide\\config.ini"
143+
],
144+
```
145+
146+
1. Telling the formatter to use ni-python-styleguide's settings
147+
148+
(telling VS Code to use `black` and telling `black` to use `ni-python-styleguide`'s settings file)
149+
```json
150+
"[python]": {
151+
"editor.formatOnType": true,
152+
"editor.defaultFormatter": "ms-python.black-formatter"
153+
},
154+
"black-formatter.args": [
155+
"--config=.venv\\lib\\site-packages\\ni_python_styleguide\\config.toml"
156+
],
157+
```
158+

0 commit comments

Comments
 (0)