sindresorhus / editorconfig-sublime

Sublime Text plugin for EditorConfig - Helps developers maintain consistent coding styles between different editors
MIT License
1.77k stars 108 forks source link

Rules for files in subdirectory doesn't apply #38

Closed Janfy closed 5 years ago

Janfy commented 9 years ago

Hi, In ST3, it seems rules for files in subdirectories are not working.

Here is my .editorconfig file (full path: C:\gR\forge-config-mgt\.editorconfig) :

root = true
[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.yml]
indent_style = space
indent_size = 2

[host_vars/*]
indent_style = space
indent_size = 2

[group_vars/*]
indent_style = space
indent_size = 2

When i create a file named testinto subdirectory host_vars, rules are not applied. Console output:

EditorConfig
C:\gR\forge-config-mgt\host_vars\test
{'charset': 'utf-8',
 'end_of_line': 'lf',
 'indent_size': '4',
 'indent_style': 'tab',
 'insert_final_newline': 'true',
 'tab_width': '4',
 'trim_trailing_whitespace': 'true'}
sindresorhus commented 9 years ago

Editorconfig searches for a config file upwards. Make sure you don't have a different one in the test or host_vars folder.

Janfy commented 9 years ago

I have only one file named .editorconfig in my project:

Type to search: .editorconfig

1 match in 437 files for term " .editorconfig" under 

Actually, test is not a directory but a new file i've created. (1st post updated)

d13r commented 9 years ago

I have the same issue in ST2 on Windows - this does not work (when editing docs/sample.md):

[docs/*.md]
indent_size = 4

Nor this:

[docs\*.md]
indent_size = 4

But this does:

[docs*.md]
indent_size = 4

As does this when added to docs/.editorconfig instead:

[*.md]
indent_size = 4
LucidityDesign commented 9 years ago

Any news?

sindresorhus commented 5 years ago

The logic for finding .editorconfig files and resolving the config is done by https://github.com/editorconfig/editorconfig-core-py So if this is still a problem, open an issue there instead.