patriotbas.blogg.se

Visual studio code format remove empty lines
Visual studio code format remove empty lines










visual studio code format remove empty lines

Most plugin adopt the second option for indent_style (only convert tab/spaces in modified lines, do not touch non-modified lines) But we really have other options.Īctually this is also a more general problem of editorconfig, and it's the root of some issues in the repo. It seems you against max_empty_lines because you only consider the third option. Silently trim extra empty lines on save.Do not allow enter extra empty lines, and/or when a line is modified, collapse the adjacent empty lines, but do not touch non-modified lines.

visual studio code format remove empty lines

  • Show some warning but not trim it automatically (more like a linter).
  • The real problem is what should editor/IDE/tool do when meet extra empty lines. We should think max_empty_lines (let's temporarily use this name) in a consistent way. This also apply to end_of_line, trim_trailing_whitespace. So in my opinion, ESLint no-multiple-empty-lines rule should have a extra option to also apply to template string, I'll raise an issue in ESLint repo later.įour, if some do not want to apply the restriction to "empty lines in multiline string", they always can disable the property in editorconfig, and use language-specific linters like ESLint.Įspecially, we should notice that "empty lines in multiline string" problem is a more general problem, that is: Does the coding style apply to the content of multiline strings?įor example, "tabs/spaces in multiline string", how indent_style, indent_size could/should work? FYI, ESLint indent rule won't complain for inconsistency in template string - aka, language-specific! In fact, it's really rare to need many multiple empty lines in string content, most time they are typos.

    visual studio code format remove empty lines visual studio code format remove empty lines

    Three, for those allow "empty lines in multiline string", some team adopt the coding style that also restrict it and force the programmers use escape (like \n), placeholder (like $NEWLINE) or other form (string concat, etc.) instead of rely on error-prone multiple empty lines. For example many C-family languages require \ at the end of each line of multiline strings. Two, many languages do not have "empty lines in multiline string" problem because they do not have multiline strings, or they do not allow empty lines in multiline strings. For example, ESLint no-multiple-empty-lines rule you mentioned also apply to multiline comments. So let me try again.įirst, "empty lines in multiline comments" is not a problem.












    Visual studio code format remove empty lines