-
Notifications
You must be signed in to change notification settings - Fork 331
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
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.
"editor.formatOnSave": false, | ||
"editor.formatOnType": false, | ||
"editor.wordBasedSuggestions": "off", | ||
"editor.defaultFormatter": "ms-python.black-formatter" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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:
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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.
FYI, I am using some other extensions to check the content of various files such as YAML and Markdown:
On the repository side, we use Super Linter
|
so that we all have the same, no matter the multi workspace file
…formatter add the julia extension to recommended ones
including using the black formatter
This PR is about update settings in VSCODE for improving our common dev environment accross OS
Challenges
The team develop on Windows and Unix environment, and there are some known difference like binary extension (
deno.exe
vsdeno
orquarto.cmd
vsquarto
Also, we all have different workflow but we all use VSCODE (I believe). So it would be best to leverage VS CODE own settings feature to insure we use the same toolings (like extensions, which drives code practice like linting, formatting, tool configurations ...)
Context
Currently we have two settings file in repo
.vscode/settings.json
quarto-cli.code-workspace
The project folder settings will alway be loaded and applied when opening the folder in VSCODE.
The workspace file settings will be loaded only when workspace is opened (e.g. opening using
code quarto-cli.code-workspace
).code-workspace
In the last example, this shows the order of settings
Windows specific
Some settings we have can't work for windows
quarto-cli/quarto-cli.code-workspace
Line 16 in 14c65d4
On windows the path is arch specific to
./package/dist/bin/tools/x86_64/deno.exe
quarto-cli/quarto-cli.code-workspace
Line 21 in 14c65d4
On windows, the dev quarto file is
./package/dist/bin/quarto.cmd
Main problem is that VSCODE does not support per-os settings. This is too bad, but we can't do what was done in
launch.json
to support multi settingsquarto-cli/.vscode/launch.json
Lines 30 to 32 in 14c65d4
So what I do is that I don't use
quarto-cli.code-workspace
which contains the Unix specific settings, to have another workspace file that will set the settings for Windows.The project folder settings
.vscode/settings.json
still applies, butquarto-cli.code-worspace
do not, and I need to duplicate the settings with some modifications for windows.More of a question: Conflicted settings ?
We have duplicate of
deno.importMap
settingsIn
.vscode/settings
, which is the one that appliesquarto-cli/.vscode/settings.json
Line 18 in 14c65d4
In
quarto-cli.code-workspace
, another valuequarto-cli/quarto-cli.code-workspace
Line 12 in 14c65d4
I don't know which one should be the right one for when we are in VSCODE developping, but it may be worth removing the one we don't one.
What this PR is about ? The proposal
For main OS paths issue
I suggest
.vscode/settings.json
so that it applies correctly for for windows user and avoid duplicatesquarto-cli.code-workspace
only the settings that can't be in project settings (it seems some are likefiles.associations
) and the Unix path.This allows Windows dev (aka me 😅) to create a workspace
.code-workspace
file to have the windows path for the settings.Other changes
We use different languages, and different tooling for Quarto cli. I figured it would be worth using the same VSCODE extensions, and settings with different language. So I added Python and Julia as settings, and some extensions as recommended like
pyling
for python linting, and black for formatters.This is for discussion, and I'll comment inline about some settings choice.
For the
deno.importMap
settingI don't know which one of the
dev_import_map.json
orimport_map.json
should be used. The currently the latter is the one used, I supposed this is ok and we can remove the one from quarto-cli.code-workspace. I'll add a note inline to discuss.@cscheid @gordonwoodhull this is really for discussion. We can also discuss this live at our next meetting. No hurry, I just wanted to take notes on my findings as I needed to tweak all this to fix the deno settings.