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

Please don't modify my settings when I have enabled editor.formatOnType #20673

Closed
ZhuangQu opened this issue Feb 9, 2023 · 10 comments · Fixed by #20710
Closed

Please don't modify my settings when I have enabled editor.formatOnType #20673

ZhuangQu opened this issue Feb 9, 2023 · 10 comments · Fixed by #20710
Assignees
Labels
area-editor-* User-facing catch-all area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug needs PR Ready to be worked on

Comments

@ZhuangQu
Copy link

ZhuangQu commented Feb 9, 2023

I have set

"editor.formatOnType": true

so please don't add

"[python]": {
    "editor.formatOnType": true
}

in my settings.

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Feb 9, 2023
@rchiodo
Copy link

rchiodo commented Feb 9, 2023

I believe this is actually added by the python core extension. Transferring.

@rchiodo rchiodo transferred this issue from microsoft/pylance-release Feb 9, 2023
@debonte
Copy link

debonte commented Feb 9, 2023

@karthiknadig, I initially thought that this was caused by this change, but I think this may always have behaved this way. I'm happy to look at this if you'd like.

@karthiknadig
Copy link
Member

@debonte I think we need to preserve the scope of the settings.

/cc @luabud

@karthiknadig karthiknadig self-assigned this Feb 9, 2023
@karthiknadig karthiknadig added bug Issue identified by VS Code Team member as probable bug area-editor-* User-facing catch-all needs PR Ready to be worked on and removed triage-needed Needs assignment to the proper sub-team labels Feb 9, 2023
@karthiknadig karthiknadig removed their assignment Feb 9, 2023
@luabud
Copy link
Member

luabud commented Feb 10, 2023

I think we can just check if formatOnType has been set globally already, and then only add the python scoped one if it isn't?

@mjbvz
Copy link

mjbvz commented Feb 10, 2023

Can you use configurationDefaults instead? Here's an example of it being used for markdown:

https://github.com/microsoft/vscode/blob/f12d88d698d1f9aa692a1662b147de702d352b44/extensions/markdown-language-features/package.json#L572

This is preferred over automatically writing into user's settings

@debonte
Copy link

debonte commented Feb 10, 2023

@mjbvz, currently we only set formatOnType for users in our auto-indent experiment. Assuming that experiment turns out well, my plan was to enable it for all users using the approach you describe above.

@mjbvz
Copy link

mjbvz commented Feb 10, 2023

@debonte Want to open an issue against VS Code for running experiments with language specific settings?

@debonte
Copy link

debonte commented Feb 11, 2023

@mjbvz, thanks for suggesting that -- microsoft/vscode#174106

@debonte
Copy link

debonte commented Feb 11, 2023

I think we can just check if formatOnType has been set globally already, and then only add the python scoped one if it isn't?

@luabud, ok. Currently we only check if it's set globally for [python], either to true or false. And if so, we make no change.

In additional to being set globally, it could be set at the workspace or workspace folder level.

So my instinct is to just check if editor.formatOnType is enabled in the current context (either globally, in the workspace, or workspace folder), and if so make no changes to the user's settings.json.

However, what if the user has explicitly set editor.formatOnType to false globally? Should we respect that?

@karrtikr karrtikr added the area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. label Feb 13, 2023
@luabud
Copy link
Member

luabud commented Feb 14, 2023

Good question, I think it might be best to be conservative and respect it. So in this case we wouldn't enable it for Python if it's disabled globally

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-editor-* User-facing catch-all area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug needs PR Ready to be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants