Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .vscode/settings.json #9295

Merged
merged 5 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ docker-compose.override.yml
### VSCode
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json

### tmux
.tmux.conf
Expand Down
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,7 @@ testCourse/**/*.html

# JSON files in tests are formatted explicitly to check for loading behaviour, so should not be formatted automatically
apps/prairielearn/src/tests/*/**/*.json

# EJS files are treated as HTML by VSCode, which will try to format them as such.
# This won't work, so exclude them.
apps/prairielearn/src/**/*.ejs
31 changes: 31 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
// If the following is ever addressed, we can update our config to use whatever
// the official shared config is:
// https://github.com/microsoft/vscode/issues/40233

// This is required to load extensions, which in turn is required to be able
// to format SQL files.
// https://github.com/prettier/prettier-vscode/issues/3235
"prettier.configPath": "./.prettierrc.json",
Comment on lines +6 to +9
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the key to getting SQL files formatting again; there's no need to install a separate extension.

Hopefully prettier/prettier-vscode#3235 gets addressed soon.


"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the configs I see add an argument to the isort command: https://stackoverflow.com/a/72667901

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import sorting works fine for me without this. Doesn't isort pick up any needed config from pyproject.toml?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are only some cases where black and isort might differ in behavior, but I had the same thought, it might just pick up the config from pyproject.

},

"[javascript][typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
},

"[html][css][json][yaml][sql][markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
}
Loading