[SourceKit/CodeFormat] Improve documentation and fix propagation of ContextLocs.

- Rename several symbols to make it clearer whether the ranges they deal with
  are open or closed.
- Add comments documenting the implementation of OutdentChecker::hasOutdent
- Fix a bug where code after a doc coment block of the '/**' style was being
  indented 1 space.
- Fix IsInStringLiteral not being set if the indent target was in a string
  segment of an interpolated multiline string.
- Update OutdentChecker::hasOutdent to propagate indent contexts from
  parent parens/brackets/braces to child parens/brackets/braces that start
  later in the same line (like FormatWalker already does). This changes the
  braces in the example below to 'inherit' a ContextLoc from their parent
  square brackets, which have a ContextLoc at 'foo'. This makes the whole
  expression be correctly considered 'outdenting':

  foo(a: "hello"
      b: "hello")[x: {
    print("hello")
  }]
This commit is contained in:
Nathan Hawes
2020-03-10 19:57:32 -07:00
parent 1c729ca3e1
commit aedafe980f
8 changed files with 576 additions and 199 deletions

View File

@@ -0,0 +1,6 @@
let foo = Bar.Stuff(
first: path,
description: "No \(thing) was found at path \(path)"
// RUN: %sourcekitd-test -req=format -line=4 -length=1 %s | %FileCheck --strict-whitespace %s
// CHECK: key.sourcetext: ""