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

[VSCODE] developer environment update on settings #9817

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"recommendations": [
"denoland.vscode-deno",
"esbenp.prettier-vscode",
"sumneko.lua"
"sumneko.lua",
"quarto.quarto",
"julialang.language-julia",
"ms-python.black-formatter",
"ms-python.pylint"
]
}
34 changes: 33 additions & 1 deletion .vscode/settings.json
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Among all our language, we usually set editor.formatOnSave: false, also because we opt in to true as a default (see lower in config file) https://github.com/quarto-dev/quarto-cli/pull/9817/files#diff-a5de3e5871ffcc383a2294845bd3df25d3eeff6c29ad46e3a396577c413bf357R30

This means our file are never auto formatted for some languages, but this can be trigger using Command pallet in VSCODE. For all others, it will be formatted using prettier.

I believe we did opt-out because prettier does not support everything, and some files where not style at first. Meaning if we set to true now, we will have a lot of style change, but better future I would say :)

If we want to enforce the same formatting for every files, and every language, we would activate this settings. Probably lots of style commits to do (in one big PR or over time), but this would ensure same style everywhere for everyone.

Currently, I left the config to false. This includes Lua. Currently, I don't think we use automatically the formatting feature from the Lua extension we use.

Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,43 @@
"[html]": {
"editor.formatOnSave": false
},
"[ejs]": {
"editor.formatOnSave": false
},
"[lua]": {
"editor.defaultFormatter": "sumneko.lua",
"editor.formatOnSave": false
},
cderv marked this conversation as resolved.
Show resolved Hide resolved
"[julia]": {
"editor.formatOnSave": false,
"editor.wordBasedSuggestions": "off",
"editor.defaultFormatter": "julialang.language-julia",
"editor.wordSeparators": "`~#$%^&*()-=+[{]}\\|;:'\",.<>/?"
},
"[python]": {
"diffEditor.ignoreTrimWhitespace": false,
"gitlens.codeLens.symbolScopes": ["!Module"],
"editor.formatOnSave": false,
"editor.formatOnType": false,
"editor.wordBasedSuggestions": "off",
"editor.defaultFormatter": "ms-python.black-formatter"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I found we could use Black formatter for Python from VSCODE doc: https://code.visualstudio.com/docs/python/formatting#_choose-a-formatter

The extension is this one:
https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter

Again if we do this, next time we'll update some .py file, there will be some style change. So if we choose to do this, I can't make a PR only with style change to anticipate

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It seems Ruff could be a good option too: https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff

Community based, but it seems a wide used formatter now (see #python discussion on slack)

Copy link
Collaborator

Choose a reason for hiding this comment

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

You might also want to add/use isort to organise Python imports which linter such as PyLint will flag:

Copy link
Collaborator

Choose a reason for hiding this comment

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

FYI, when working with Python, I am using: Pylance, isort, and Black Formatter.

},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.tabSize": 2,
"deno.enable": true,
"deno.lint": true,
"deno.unstable": true,
"deno.importMap": "./src/import_map.json"
"deno.importMap": "./src/import_map.json",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the settings we use, but it is overwriting the other one.

Is the value ok ? I believe so.

"deno.suggest.imports.hosts": {
"https://deno.land": true,
"https://den.o.land": false
},
"deno.inlayHints.enumMemberValues.enabled": false,
"deno.inlayHints.functionLikeReturnTypes.enabled": false,
"deno.inlayHints.parameterNames.enabled": "none",
"deno.inlayHints.parameterTypes.enabled": false,
"deno.inlayHints.propertyDeclarationTypes.enabled": false,
"deno.inlayHints.variableTypes.enabled": false,
"deno.inlayHints.variableTypes.suppressWhenTypeMatchesName": false
}
22 changes: 1 addition & 21 deletions quarto-cli.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,15 @@
}
],
"settings": {
"editor.tabSize": 2,
"debug.javascript.unmapMissingSources": true,
"julia.format.indent": 2,
"julia.format.indents": false,
"deno.importMap": "./src/dev_import_map.json",
"deno.lint": true,
"deno.enable": true,
"deno.unstable": true,
"deno.path": "./package/dist/bin/tools/deno",
"deno.suggest.imports.hosts": {
"https://deno.land": true,
"https://den.o.land": false
},
"quarto.path": "./package/dist/bin/quarto",
"files.associations": {
"*.ejs.md": "ejs",
"*.ejs.yml": "ejs",
"*.ejs.html": "ejs",
"*.ejs.js": "ejs"
},
"[ejs]": {
"editor.formatOnSave": false
},
"deno.inlayHints.enumMemberValues.enabled": false,
"deno.inlayHints.functionLikeReturnTypes.enabled": false,
"deno.inlayHints.parameterNames.enabled": "none",
"deno.inlayHints.parameterTypes.enabled": false,
"deno.inlayHints.propertyDeclarationTypes.enabled": false,
"deno.inlayHints.variableTypes.enabled": false,
"deno.inlayHints.variableTypes.suppressWhenTypeMatchesName": false
}
}
}
Loading