Closed
Labels
area-editor-*User-facing catch-allUser-facing catch-allarea-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugneeds PRReady to be worked onReady to be worked on
Description
I have set
"editor.formatOnType": true
so please don't add
"[python]": {
"editor.formatOnType": true
}
in my settings.
Reacted by Matt Bierner, 四维超立方体 and tiruns
Metadata
Metadata
Assignees
Labels
area-editor-*User-facing catch-allUser-facing catch-allarea-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugneeds PRReady to be worked onReady to be worked on
Activity
rchiodo commentedon Feb 9, 2023
I believe this is actually added by the python core extension. Transferring.
debonte commentedon Feb 9, 2023
Karthik Nadig (@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 commentedon Feb 9, 2023
Erik De Bonte (@debonte) I think we need to preserve the scope of the settings.
/cc Luciana Abud (@luabud)
luabud commentedon Feb 10, 2023
I think we can just check if
formatOnTypehas been set globally already, and then only add the python scoped one if it isn't?mjbvz commentedon Feb 10, 2023
Can you use
configurationDefaultsinstead? 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 commentedon Feb 10, 2023
Matt Bierner (@mjbvz), currently we only set
formatOnTypefor 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 commentedon Feb 10, 2023
Erik De Bonte (@debonte) Want to open an issue against VS Code for running experiments with language specific settings?
debonte commentedon Feb 11, 2023
Matt Bierner (@mjbvz), thanks for suggesting that -- microsoft/vscode#174106
debonte commentedon Feb 11, 2023
Luciana Abud (@luabud), ok. Currently we only check if it's set globally for
[python], either totrueorfalse. 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.formatOnTypeis enabled in the current context (either globally, in the workspace, or workspace folder), and if so make no changes to the user'ssettings.json.However, what if the user has explicitly set
editor.formatOnTypetofalseglobally? Should we respect that?luabud commentedon 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