{"action":"reopened","issue":{"url":"https://api.github.com/repos/Microsoft/vscode/issues/15989","repository_url":"https://api.github.com/repos/Microsoft/vscode","labels_url":"https://api.github.com/repos/Microsoft/vscode/issues/15989/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/vscode/issues/15989/comments","events_url":"https://api.github.com/repos/Microsoft/vscode/issues/15989/events","html_url":"https://github.com/Microsoft/vscode/issues/15989","id":191399936,"number":15989,"title":"Turn on ```editor.formatOnType``` for a particular language","user":{"login":"DonJayamanne","id":1948812,"avatar_url":"https://avatars.githubusercontent.com/u/1948812?v=3","gravatar_id":"","url":"https://api.github.com/users/DonJayamanne","html_url":"https://github.com/DonJayamanne","followers_url":"https://api.github.com/users/DonJayamanne/followers","following_url":"https://api.github.com/users/DonJayamanne/following{/other_user}","gists_url":"https://api.github.com/users/DonJayamanne/gists{/gist_id}","starred_url":"https://api.github.com/users/DonJayamanne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DonJayamanne/subscriptions","organizations_url":"https://api.github.com/users/DonJayamanne/orgs","repos_url":"https://api.github.com/users/DonJayamanne/repos","events_url":"https://api.github.com/users/DonJayamanne/events{/privacy}","received_events_url":"https://api.github.com/users/DonJayamanne/received_events","type":"User","site_admin":false},"labels":[{"id":366106217,"url":"https://api.github.com/repos/Microsoft/vscode/labels/duplicate","name":"duplicate","color":"E2A1C2","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-11-23T23:11:48Z","updated_at":"2016-11-24T11:33:47Z","closed_at":null,"body":"For the [Python](https://github.com/DonJayamanne/pythonVSCode) extension I have a custom [OnTypeFormattingEditProvider](https://github.com/DonJayamanne/pythonVSCode/blob/master/src/client/typeFormatters/blockFormatProvider.ts) that ensures certain blocks of code are properly indented.\r\n\r\nFor instance if the user were to type the following code in Python:  \r\n```python\r\nif x == y:\r\n    print(x)\r\n    else:\r\n```\r\nAfter typing in the text ```print(x)``` at line 2, the user hits enter:  \r\n- The cursor at this point will be indented and positioned under the letter ```p```   \r\n- Then types the string ```else:```\r\n\r\nIn Python the position of ```else:``` is incorrect. It needs to be at the same indentation level as the corresponding ```if```.  This is where the OnTypeFormattingEditProvider comes in, it will automatically format that line (by removing the unnecessary white space).\r\n\r\nIt works as expected.\r\n\r\nHowever, Python users will have to manually turn on the setting ```editor.formatOnType``` in their user or workspace settings. \r\n\r\n**I.e. almost everyone using this extension will miss out on this (very useful and crucial) feature.**  \r\n\r\n- Is there a way for the extension to turn this on as a default value?  \r\nI know I could manually alter the ```enditor.formatOnType``` value via code. Is that the right approach? Would that not affect other languages as well?  \r\n- Or is there a way to turn this on for a specific language, ```Python``` in this case?  \r\n"}}
{"actor":{"display_login":"DonJayamanne"}}