intel/dml-language-server

Implement indentation tracking rules for style checking warnings

jvsqzj opened this issue · 1 comments

Extend lint module to include highlighted warnings regarding non compliance with indentation rules configuration.
Indentation rules detailed in the DML style guide are:

  • IN1 Lines are indented four spaces for each indentation level
  • IN2 Tab characters (ASCII 9) should never be used to indent lines
  • IN3 If the previous line contains an opening brace without corresponding closing brace, the current line should be indented one level more than the previous line
  • IN4 An closing brace at the beginning of a line is indented one level less than the previous line. A closing brace should only ever appear on the same line as the opening brace or first on a line
  • IN5 A continuation line that is broken inside a parenthesized expression is indented to line up inside the corresponding parenthesis on the previous line
  • IN6 A continuation line not broken inside a parenthesized expression is indented one level
  • IN7 Any line not indented according to the rules above is indented to same level as the preceding non-empty line
  • IN9 Case labels are indented one level less than surrounding lines, so that they are on the same level as the switch statement. The same applies to goto labels, but keep an indentation of at least one space, to avoid mistaking them for top-level definitions
  • IN10 When the body of a while or for loop is left empty, indent the semicolon to the appropriate statement level

Currently working on PR #56 for implementing this feature.