-
Notifications
You must be signed in to change notification settings - Fork 28.8k
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
Default language-specific settings #19733
Comments
Python: default to spaces since PEP 8 recommends spaces as the standard Python coding style. F#: default to spaces since the F# code formatting guidelines forbid using tabs. |
@rmunn Python might be going a bit far since it still works with tabs right? |
@Tyriar Yes, Python does allow tabs, even though its official style guide recommends spaces. But setting spaces as the default in VS Code wouldn't prevent anyone from overriding them with tabs if they choose. I believe that if a language has an official style guide, then any editor capable of per-language settings should default to following that style guide, so that out of the box, the editor will produce code that complies with the style guide. And for Python, that means space indentation, and 4-space indents (https://www.python.org/dev/peps/pep-0008/#id17). Therefore, that's what VS Code should default to for Python files. |
Two questions that will probably come up regarding language-specific defaults:
My personal opinion is that the second answer is obvious: The first answer is less obvious, but I think in the case of editing an existing file that does not match the language-specific settings, the file's existing indentation style could be considered a "more specific setting", specific to that file. E.g., if the Python standards say "uses spaces for indentation", but I'm working on someone else's code where the other coder used tabs, the editor should default to using tabs for this one file, because that creates consistent indentation. (This is also in line with what PEP 8 says, which is "Tabs should be used solely to remain consistent with code that is already indented with tabs.") So I think the following set of rules would be good ones to use regarding language-specific defaults:
|
@rmunn Good questions and suggestions. Agreed that Regarding file specific conflicts, you can always say detect the indentation from the file using the property |
- Extend configuration extension to override default settings for a language - Update configuration registry with overrides - Adopt Defaults config model to read default overrides - Tests
- Define a new extension point `configurationDefaults` for contributing default language specific editor settings
Here is how an extension can contribute default language specific editor configurations. A new contribution point Sample: "configurationDefaults": {
"[markdown]": {
"editor.wrappingColumn": 0,
"editor.quickSuggestions": false
}
} |
Now that we have language specific settings we should consider enabling default language-specific settings to work around some of the annoyances for particular languages:
Markdown: Disable intellisense by default:
Makefile: Always use tabs for indentation since spaces are invalid (related: #4815)
YAML: Always use spaces for indentation since tabs are invalid.
The text was updated successfully, but these errors were encountered: