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

Fix File breaks DocBlockr comments #168

Closed ierhyna closed 7 years ago

ierhyna commented 7 years ago

Hi!

I have a lot of comments created with docblockr in my project, and .editorconfig set up to use indent_style = tab.

When I apply EditorConfig: Fix File, it brokes the comments formatting, removing the first space, ex.:

/**
 * comment
 */

becomes:

/**
* comment
*/

Is there anything I can do to fix it? Thanks!

Involved .editorconfig-files

root = true

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

Installed packages

├── docblockr@0.9.1
├── editorconfig@2.0.5
└── todo-show@1.8.0
florianb commented 7 years ago

Hi @ierhyna - thank you for reporting this issue. I guess this is caused by a wrong implementation of the fix-algorithm.

🗒 Currently the algorithm tries to figure out which intendation-level might be intended. This includes some kind of normalization, since currently the product of divisioning the number of spaces https://github.com/sindresorhus/atom-editorconfig/blob/master/commands/fix.js#L62 gets floored.

❕ The implementation should recognize additional spaces.

I guess there is nothing you can do besides running a manual Replace (f.e. replacing ^\* with \*) until we fixed that.

I am sorry for the inconveniences! 💝