editorconfig-sublime
editorconfig-sublime copied to clipboard
Editorconfig doesn't work on new files
Can you be a little more depicting?
Also paste in the output of your Sublime console.
Tabbing doesn't work correctly. If you have the default settings in Sublime, indent using tabs and tab size 4. And in the .editorconfig file you use the following file:
root = true
[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
It will not override the default settings when you create a new file. It will use the sublime default settings.
You have multiple indent_style
properties
Ok removed the first indent_style, but the problem still occurs for new files. Editorconfig doesn't override Preference -> Settings -Default on new files
If you tell about new and unsaved file
, is not a bug, because plugin can't find config.
Yes, that's correct. The settings should take effect the moment you save the file though.
For me it doesn't work on new file even after I've saved it, but it works after I've closed the file and reopened it...
@aripalo sorry, I was wrong, what you describe is the intended behavior. We don't want to apply settings without you being able change them back. That's why everything is applied on load (except for charset which has to be applied on save). Should probably mention this in the readme.
Hmm... Well I'd argue that the whole point of the .editorconfig file is to enforce agreed upon code style. Therefore if user chooses to revert back to some other style, she could add an exception (pointing to the file she is editing) to the .editorconfig file before saving.
What do you think?
Maybe this is a job for the Sublime Text configuration file?
Getting the configuration file setting would be a "victory" for me :) I'm annoyed that I need to save and then reopen the files all the time for Sublime to "pick up the code style" & our team isn't that big at the moment that I could check that everyone has the proper "on save" configuration.
But even so I'd still argue that it should be "on save" by default, otherwise it's easy for another team member accidentally mess things up. Also if "on save" would be the default, it'd mean that I'd only have to make sure everyone in the team has the plugin installed without worring about their Sublime configurations.
I’m frustrated that it doesn't add a new line to my files unless I close and re-open them.
@OliverJAsh it does it on save. That how Sublime works: https://github.com/sindresorhus/editorconfig-sublime/blob/79b466e0eee57ef0b8fa50b96350a60543778446/EditorConfig.py#L91
@sindresorhus If it's a new file, when you save it brings up a dialog to ask where you'd like to save. After saving, a new line is not added – if I save again, then it is added.
I won't have time to look into this for a while, but help welcome :)
:+1:
I have a similar problem, but my problem is that my indention style in the .editorconfig
file is different from the default indention style of Sublime, and that results in what you see in the picture below. And that's because when I created the file I wrote the first class, and then saved it, and the next time I opened it I wrote the second one, so it took the configuration from the .editorconfig
file.
I wonder would it make a difference if I was working on a project? I currently just have the folder opened in Sublime, without a defined project.
Thanks! :thumbsup:
I find that since
"tab_size": 2,
"translate_tabs_to_spaces": true
in a sublime-project file do apply to new files created in that project window, this should also apply for .editorconfig configured (soon-to-be-)files.
So whatever is given in the [*]
section, it should be applied to EVERYTHING, saved or not, file or draft, cow or chicken.
@sindresorhus So?
I'm using vscode editor and I meet the same issue. After I installed a plugin called 'editorconfig vs vscode', my new .editorconfig works.