-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Support file-type-specific settings #1587
Comments
👍 |
It's a nice idea but maybe It's a better idea to use an array instead of a map of globbing patterns. The order in which you specify the rules matter because what should be done in this case? "files.settings": {
"**/*.idt": {
"editor.insertSpaces": false,
"diffEditor.ignoreTrimWhitespace": false
},
"**/file.idt": {
"editor.insertSpaces": true,
"diffEditor.ignoreTrimWhitespace": true
},
} Maps don't keep their order so the result in this case is not known untill you test it. If When using an array, the order is kept and you know the outcome of the following settings. "files.settings": [
{
"files": ["**/*.idt", "**/*.json"],
"editor.insertSpaces": false,
"diffEditor.ignoreTrimWhitespace": false
},
{
"files": "**/index.idt",
"editor.insertSpaces": true,
"diffEditor.ignoreTrimWhitespace": true
}
] This way, you know for sure that We had a similar discussion in the XO linter for overridable configs. More information can be found here xojs/xo#58 |
adding to @SamVerschueren's idea, the pattern should conform to a |
This would also help with editing patch files. Gets tiring accidentally bricking them because of the trailing space on empty lines :( |
Also nice for word wrapping in markdown or HTML files, but not code. A great improvement for developers who write a lot. |
Following is the proposal for introducing file (glob pattern) / language based editor settings. Defining a new setting called
@Microsoft/vscode Please provide your feedback and suggestions. Thanks |
Looks good to me. As a sidenote to everyone reading this topic, much of this already can be done with the |
Here is a little bit different suggestion (variant of yours): {
"workbench.editor.showTabs": true,
"editor.overrides": [
{
"files": [
"**/*.idt",
"**/*.json"
],
"settings": {
"editor.insertSpaces": false,
"diffEditor.ignoreTrimWhitespace": false
}
}
{
"files": "**/index.idt",
"settings": {
"editor.insertSpaces": true,
"diffEditor.ignoreTrimWhitespace": true
}
},
{
"language": "markdown",
"settings": {
"editor.wordWrap": 0
}
}
]
} Difference:
|
With respect to configurable tab size and being able to specify filetype extension. I would suggest the following, it's pretty compact and flexible.
|
The current implementation looks more compact and doesn't sacrifice readability & ease of use. Users can simply copy & paste syntax settings straight into their "editor.tabSize": 4,
"[js,html,css,ts]": {
"editor.tabSize": "2"
},
"[h,hpp,c,cpp,cc]": {
"editor.tabSize": 3
} Your implementation would require users to add the syntax settings into multiple areas of their |
Just to make sure that, as beginning and to be simple, we only support one language per entry. Multiple languages as a single key is not supported. So, one can write only as follows
|
Closing - the plan item is done. |
@egamma, in which version this functionality available? |
@IgorNovozhilov Language based settings are available in current insiders. With respect to the issue you mentioned, I will take a look |
@sandy081 any idea when the 1.9 insider might hit stable? |
@wopian here are the iteration plans: https://github.com/Microsoft/vscode/wiki/Iteration-Plans It says early February. |
@IgorNovozhilov There is a bug in the feature that following settings are not respected by language
Thanks for catching this scenario and reporting. I will be filing a separate issue to track this - #19511 |
@sandy081 it looks like it is not possible to set extension properties within a language-specific configuration block? For example, the following does not work: "[rust]": {
"vim.textwidth": 100
}, I also get the green underlining, with a warning saying "Unknown Identifier. Use language identifiers". I suspect this might be related to #19511, and perhaps also #4891? |
@jonhoo Yes only core editor settings are supported in language-specific configuration block. Regarding warning, it is shown if there is no such language defined (in this case |
So how does this work in the end? I want to set word-wrapping for some filetypes. What do I do? Is this documented? |
So is later support of multiple langauges per key/entry something planned for the future? |
@myfairsyer Its not yet planned.. Feel free to file an issue for that. Thanks. |
In our project we have a number of files where tabs are strictly required (a format we do not control). However, we want to normalize tabs to spaces throughout the rest of the project.
For now, I just ask that people don't edit those files in VSCode. I even considered adding them to the ignore list for VSCode itself. But it's not uncommon to have file-specific settings, so I thought it would be nice if VSCode allowed for more complex patterns - much like
files.exclude
, perhaps something like:The text was updated successfully, but these errors were encountered: