Skip to content

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

Closed

Description

I have set

"editor.formatOnType": true

so please don't add

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

in my settings.

Activity

  1. rchiodo commented on Feb 9, 2023

    @rchiodo

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

  2. debonte commented on Feb 9, 2023

    @debonte

    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.

  3. karthiknadig commented on Feb 9, 2023

    @karthiknadig
    Member

    Erik De Bonte (@debonte) I think we need to preserve the scope of the settings.

    /cc Luciana Abud (@luabud)

  4. added
    bugIssue identified by VS Code Team member as probable bug
    needs PRReady to be worked on
    and removed
    triage-neededNeeds assignment to the proper sub-team
    on Feb 9, 2023
  5. luabud commented on Feb 10, 2023

    @luabud
    Member

    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?

  6. mjbvz commented on Feb 10, 2023

    @mjbvz

    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

  7. debonte commented on Feb 10, 2023

    @debonte

    Matt Bierner (@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.

  8. mjbvz commented on Feb 10, 2023

    @mjbvz

    Erik De Bonte (@debonte) Want to open an issue against VS Code for running experiments with language specific settings?

  9. debonte commented on Feb 11, 2023

    @debonte

    Matt Bierner (@mjbvz), thanks for suggesting that -- microsoft/vscode#174106

  10. debonte commented on Feb 11, 2023

    @debonte

    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?

    Luciana Abud (@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?

  11. luabud commented on Feb 14, 2023

    @luabud
    Member

    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

  12. locked as resolved and limited conversation to collaborators on Mar 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-editor-*User-facing catch-allarea-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.bugIssue identified by VS Code Team member as probable bugneeds PRReady to be worked on

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions