Commit Graph

19 Commits

Author SHA1 Message Date
Xi Ge
6af5d3c0bf libSyntax: rename KeepTokensInSourceFile to KeepSyntaxInfoInSourceFile. 2017-11-03 18:39:01 -07:00
Brian Gesiak
0f6ba7b681 [swift-format] Set exec path in initializer (NFC) (#11973)
Rather than define `SwiftFormatInvocation::setMainExecutablePath()` and use it
in the one spot where a `SwiftFormatInvocation` is initialized, have
`SwiftFormatInvocation` take an executable path in its initializer. No
functional change, but slightly fewer lines of code.
2017-09-17 18:49:29 -04:00
Xi Ge
34e2aec662 Parser: use parser to generate a refined token stream to help syntax coloring. (#11809)
This patch allows Parser to generate a refined token stream to satisfy tooling's need. For syntax coloring, token stream from lexer is insufficient because (1) we have contextual keywords like get and set; (2) we may allow keywords to be used as argument labels and names; and (3) we need to split tokens like "==<". In this patch, these refinements are directly fulfilled through parsing without additional heuristics. The refined token vector is optionally saved in SourceFile instance.
2017-09-08 10:28:19 -07:00
swift-ci
4ebe4afe2a Merge remote-tracking branch 'origin/master' into master-next 2017-05-09 13:28:49 -07:00
Saleem Abdulrasool
60220ad84b swift-format: allow reading from stdin as specified
We would previously fail to read from stdin as we would diagnose an
error if no input files were provided.  This allows us to read from
stdin once more.
2017-05-06 11:12:09 -07:00
Saleem Abdulrasool
cd751c4350 swift-format: use named return codes (NFC)
Use `EXIT_SUCCESS` and `EXIT_FAILURE` rather than the raw values.  NFC.
2017-05-06 11:12:09 -07:00
swift-ci
fe1b506392 Merge remote-tracking branch 'origin/master' into master-next 2017-04-14 17:28:31 -07:00
Maxwell Swadling
93d485e4f7 Changed handleDiagnostic to take a format string and format args instead of the formatted string
This allows diagnostic consumers to modify the way formatting of diagnostics is performed.
rdar://problem/31305854
2017-04-14 11:28:04 -07:00
Bob Wilson
07019d964d Update Swift master-next after LLVM API change in r300135. 2017-04-13 12:30:04 -07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Daniel Duan
d0de084a79 [swift-format] add option to indent switch block
add a boolean option to indent switch's block:

```
// with -indent-switch-case
switch xyz {
  case .x:
    doSomething()
}
```

```
// without -indent-switch-case
switch xyz {
case .x:
  doSomething()
}
```
2016-11-03 19:48:41 -07:00
Daniel Martín
81f87e5e9d Remove dependency on clang::tooling::Replacement
Considering that formatting only affects a single compilation unit, and
that code formatting does not support line ranges yet, remove dependency
on clang::tooling::Replacement.

This fixes SR-2619.
2016-10-02 21:16:31 +02:00
Michael Gottesman
d9882893b9 [swift-format] Check the llvm::Error returned by clang::tooling::Replacements::add to prevent abort.
llvm::Error's destructor has an assert in it that it was checked for success or
failure. This patch puts in a quick check for failure and emits a message to
llvm::errs() and returns failure (which in this case is indicating by returning
true).

A first class diagnostic should be added here, but given that I am preparing for
a stable merge update on a quick time schedule, I did the easy thing (with
respect to the message).
2016-08-31 14:07:18 -07:00
Michael Gottesman
78cb79a34d [upstream-update] clang::tooling::Replacements::insert() => clang::tooling::Replacements::add()
This is just a rename.
2016-08-30 23:14:51 -07:00
Robert Widmann
4ccf6c98dc Merge pull request #4191 from danielmartin/swift-format-documentation
Add swift-format documentation
2016-08-12 07:32:20 -07:00
Daniel Martín
14741c40bc Add swift-format documentation
Also, rename some options to improve consistency across the rest of the
driver options.
2016-08-10 17:43:49 +02:00
Daniel Martín
6902d9220c Use UINT_MAX instead of a "magic" upper bound
If a line range is not set, create a line range over the unsigned type,
instead of setting an arbitrary limit. We're not probably going to ever
deal with such big files, though.
2016-08-10 13:08:18 +02:00
Daniel Martín
df15ec4f3b Swift-format driver tool
This driver tool formats Swift files or file ranges using some
parameters like tabs or spaces, tab width, or amount of spaces.
2016-08-08 11:07:15 +02:00