sindresorhus / atom-editorconfig

Helps developers maintain consistent coding styles between different editors
https://atom.io/packages/editorconfig
MIT License
812 stars 80 forks source link

The editor doesn't follow the .editorconfig options #242

Closed tjapro closed 4 years ago

tjapro commented 4 years ago

Please see https://github.com/prettier/prettier-atom/issues/715

Involved .editorconfig-files

# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
indent_size = 4
indent_style = space

Directory structure

My working directory is very huge.

Installed packages

Built-in Atom Packages (93)
├── atom-dark-syntax@0.29.1
├── atom-dark-ui@0.53.3
├── atom-light-syntax@0.29.1
├── atom-light-ui@0.46.3
├── base16-tomorrow-dark-theme@1.6.0
├── base16-tomorrow-light-theme@1.6.0
├── one-dark-ui@1.12.5
├── one-light-ui@1.12.5
├── one-dark-syntax@1.8.4
├── one-light-syntax@1.8.4
├── solarized-dark-syntax@1.3.0
├── solarized-light-syntax@1.3.0
├── about@1.9.1
├── archive-view@0.65.1
├── autocomplete-atom-api@0.10.7
├── autocomplete-css@0.17.5
├── autocomplete-html@0.8.8
├── autocomplete-plus@2.42.3
├── autocomplete-snippets@1.12.1
├── autoflow@0.29.4
├── autosave@0.24.6
├── background-tips@0.28.0
├── bookmarks@0.46.0
├── bracket-matcher@0.91.2
├── command-palette@0.43.5
├── dalek@0.2.2
├── deprecation-cop@0.56.9
├── dev-live-reload@0.48.1
├── encoding-selector@0.23.9
├── exception-reporting@0.43.1
├── find-and-replace@0.219.1
├── fuzzy-finder@1.14.1
├── github@0.34.0
├── git-diff@1.3.9
├── go-to-line@0.33.0
├── grammar-selector@0.50.1
├── image-view@0.64.0
├── incompatible-packages@0.27.3
├── keybinding-resolver@0.39.0
├── line-ending-selector@0.7.7
├── link@0.31.6
├── markdown-preview@0.160.2
├── metrics@1.8.1
├── notifications@0.71.0
├── open-on-github@1.3.2
├── package-generator@1.3.0
├── settings-view@0.261.3
├── snippets@1.5.0
├── spell-check@0.75.0
├── status-bar@1.8.17
├── styleguide@0.49.12
├── symbols-view@0.118.2
├── tabs@0.110.0
├── timecop@0.36.2
├── tree-view@0.228.0
├── update-package-dependencies@0.13.1
├── welcome@0.36.9
├── whitespace@0.37.7 (disabled)
├── wrap-guide@0.41.0
├── language-c@0.60.18
├── language-clojure@0.22.8
├── language-coffee-script@0.50.0
├── language-csharp@1.1.0
├── language-css@0.44.2
├── language-gfm@0.90.7
├── language-git@0.19.1
├── language-go@0.47.1
├── language-html@0.53.0
├── language-hyperlink@0.17.1
├── language-java@0.31.4
├── language-javascript@0.134.0
├── language-json@1.0.4
├── language-less@0.34.3
├── language-make@0.23.0
├── language-mustache@0.14.5
├── language-objective-c@0.16.0
├── language-perl@0.38.1
├── language-php@0.44.4
├── language-property-list@0.9.1
├── language-python@0.53.3
├── language-ruby@0.72.22
├── language-ruby-on-rails@0.25.3
├── language-rust-bundled@0.1.0
├── language-sass@0.62.1
├── language-shellscript@0.28.0
├── language-source@0.9.0
├── language-sql@0.25.10
├── language-text@0.7.4
├── language-todo@0.29.4
├── language-toml@0.20.0
├── language-typescript@0.6.0
├── language-xml@0.35.3
└── language-yaml@0.32.0

Community Packages (44) /home/tiagoalmeida/.atom/packages
├── advanced-open-file@0.16.8
├── atom-beautify@0.33.4
├── atom-clock@0.1.17
├── atom-ide-ui@0.13.0
├── autoupdate-packages@1.3.1
├── battery-status@0.11.11
├── busy-signal@2.0.1
├── color-picker@2.3.0
├── dark-mode@4.0.2
├── editorconfig@2.6.0
├── emmet@2.4.3
├── file-icons@2.1.40
├── flex-tool-bar@2.2.0 (disabled)
├── fonts@3.10.0
├── grammar-tab-colors@0.2.8 (disabled)
├── hey-pane@1.2.0
├── highlight-selected@0.17.0
├── ide-typescript@0.9.1
├── intentions@1.1.5
├── language-bats@0.1.0
├── linter@2.3.1 (disabled)
├── markdown-writer@2.11.10
├── minimap@4.29.9
├── minimap-autohider@1.6.0
├── minimap-bookmarks@0.4.2
├── minimap-codeglance@0.4.7
├── minimap-cursorline@0.2.0
├── minimap-find-and-replace@4.5.2
├── minimap-git-diff@4.3.1
├── minimap-highlight-selected@4.6.1
├── minimap-linter@2.2.1
├── minimap-pigments@0.2.2
├── minimap-selection@4.5.0
├── open-recent@5.0.0
├── permanent-delete@0.1.7
├── pigments@0.40.2
├── prettier-atom@0.58.2 (disabled)
├── project-manager@3.3.8
├── sync-settings@4.3.2
├── terminus@4.0.4
├── todo-show@2.3.2
├── tool-bar@1.2.2
├── tool-bar-markdown-writer@0.5.1
└── trailing-spaces@0.4.0
florianb commented 4 years ago

Hi @TJProgrammer - what exactly is your issue?

tjapro commented 4 years ago

Hi @florianb. When I try to fix my .md files, editorconfig doesn't repair a 2 spaces indent to 4 spaces.

florianb commented 4 years ago

@TJProgrammer how do you invoke the fix?

tjapro commented 4 years ago

From command pallette.

florianb commented 4 years ago

Okay - and you have the file you're trying to fix open?

tjapro commented 4 years ago

Yup 👍

florianb commented 4 years ago

@TJProgrammer i just got it, you're trying to fix from spaces to spaces, this is not implemented because it is impossible to fix.

Since we don't know with how many spaces the indentation in the current file is laid out, we can't safely change the indentation.

tjapro commented 4 years ago

But if I want to fix it, the script just has to do the indentation according .editorconfig file, no?

And, when I indent pressing twice the tab key (2 spaces * 2), the files seems to translate it to a hard tab instead of a soft tab.

And I opened this issue because the .md files need the 4 spaces of indentation to make a sublist working.

florianb commented 4 years ago

When editing the file, the current rules should be applied to your textbuffer. You might check the applied rules using EditorConfig: Check State.

The Fix-command works only for transformations between tabs and spaces.

If you press the tab key twice and the check state command shows you spaces are applied it is very likely another plugin is interfering the settings.

tjapro commented 4 years ago

Ok, thank you. I'll see another plugins in my atom editor.

PS: I checked the same file with nano and all indentatio is in spaces (as you said, some configuration or the edito itself behaves like that).

florianb commented 4 years ago

You're welcome @TJProgrammer!