Skip to content

Offer sensible default VSCode settings #9436

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

Merged
merged 3 commits into from
Jan 8, 2023

Conversation

Avasam
Copy link
Collaborator

@Avasam Avasam commented Dec 31, 2022

Offer sensible default VSCode settings.
These are the workspace settings, specific to typeshed, that I've been using and filling in over the past few months.
Workspace settings override user settings, so we can offer sensible, all-ready configurations for the typeshed workspace, reducing a lot of the pains a new contributor can have if their favorite editor is VSCode.

These settings obviously won't configure any extension not specified in .vscode/extensions.json > recommendations, and will assume the user may not have all recommended extensions installed or set as the formatter. Hence I've also configure some basic VSCode settings.


The recommended extensions include:

  • The full python extensions suite needed for typeshed
  • .editorconfig support and syntax highlighter
  • A yaml formatter and validator
  • A TOML syntax highliter and validator (no formatting)
  • Mardown pack for syntax highlighting, and for the Mardown preview to match Github's (no formatter, though I'd recommend davidanson.vscode-markdownlint)
    For those not familiar with VSCode: Note that recommendations are not forced onto the user, a popup appears once to mention the workspace has recommended extensions, then they'll only show up under the "recommended" tab in the extensions menu.

It can still make sense for a user to want to modify .vscode/settings.json if they want to configure one of their extension to work properly with typeshed, without having to outright disable it for the workspace. It's also up to the dev to decide if they wanna follow these specific editor settings.

Unfortunately, VSCode doesn't (yet) offer any way to have "workspace defaults" or "user-worspace settings", so offering defaults to copy is the best we can do at the moment. And is what I've seen done in other open-source projects.

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Thanks for sharing, but I'm -0.5 on this. I don't want to get in the business of maintaining editor configurations, nor do I think typeshed has sufficiently unique needs to really justify shipping editor configurations. But maybe other maintainers feel differently!

@AlexWaygood
Copy link
Member

But maybe other maintainers feel differently!

I don't use VSCode, so I'm pretty neutral here :)

In general I agree that I don't really want us into the business of maintaining editor configs (once we add one editor config, it gets hard to justify not adding all the other ones). So I guess I'm -0.5 as well.

@Avasam
Copy link
Collaborator Author

Avasam commented Jan 6, 2023

I can understand the reticence

it gets hard to justify not adding all the other ones

Fair, as I would be for adding the popular python ones (ie PyCharm, w/e most of you use, etc.) if it's useful.

The idea being that this can tremendously help new contributors, reduce friction with misconfigured editors, formatters and less reliance on waiting for pre-commit / CI for feedback. As well as help them see errors and they're contributing (red/yellow squigglies).

As someone is who is more more experienced with VSCode settings, and already had to go through weeks of figuring out the right configurations, I figured I'd offer them so that other users of the editor don't have to redo all that figuring-out by themselves.


misconfigured editors, formatters

It's also to help with that that I added a YAML formatter to pre-commit (and looking at markdownlint)

less reliance on waiting for pre-commit / CI for feedback

That's also why I added scripts/run_tests.py (which I use a lot actually)

So its obviously not the only way to achieve those goals, just another parallel approach.
(these are also generally good exercises for me to develop the knowledge and experience of those tools anyway)

@AlexWaygood
Copy link
Member

AlexWaygood commented Jan 7, 2023

FWIW: I used to use PyCharm, until I started contributing to typeshed and CPython. Hacking on CPython in particular just seemed to break PyCharm's brain completely, so I abandoned it and went back to the editor I used before PyCharm, namely..... IDLE (don't laugh). It's as basic as they come, but the advantage of using an editor with 0 features is that none of them get broken when you try to hack on CPython itself 😛

I've tried using VSCode a few times, but it never seems to "click" for me. Don't know why, exactly.

@AlexWaygood
Copy link
Member

Maybe we could put these settings somewhere else online, and link to them from typeshed's contributing guide. That way future contributors won't have to wade through the weeks of figuring things out, like you did, but we also don't have the pressure of having to maintain a settings file that we don't necessarily understand the ins and outs of. Thoughts? :)

@JelleZijlstra
Copy link
Member

I'm actually supportive of merging this (and similar settings for other major editors, if someone contributes them). We can add a disclaimer comment that the maintainer team doesn't commit to maintaining the file or something, but in the meantime this can definitely help contributors.

@AlexWaygood
Copy link
Member

I'm actually supportive of merging this (and similar settings for other major editors, if someone contributes them). We can add a disclaimer comment that the maintainer team doesn't commit to maintaining the file or something, but in the meantime this can definitely help contributors.

Then let's do it. @Avasam, can you add the disclaimer comment somewhere? :)

@Avasam
Copy link
Collaborator Author

Avasam commented Jan 8, 2023

Feel free to wordsmith! I feel the disclaimer in the config file itself is fine as it doesn't pollute documentation and only concerns those who know of its existence in the first place

@Avasam Avasam requested a review from hauntsaninja January 8, 2023 09:21
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Thanks @Avasam!

@AlexWaygood AlexWaygood merged commit f115a3c into python:main Jan 8, 2023
@Avasam Avasam deleted the default-vscode-settings branch January 8, 2023 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants