Skip to content

Commit 7dece6e

Browse files
committed
Improve and refactor developer documentation.
1 parent 7805f2a commit 7dece6e

File tree

3 files changed

+44
-18
lines changed

3 files changed

+44
-18
lines changed

Documentation/Debugging.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

Documentation/Development.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Developing `swift-format`
2+
3+
## Check Out the Submodules
4+
5+
The `CCommonMark` target is a Git submodule that pulls the C code in
6+
[apple/swift-cmark](https://github.com/apple/swift-cmark) into this
7+
project.
8+
9+
After you clone this repository, remember to run the following commands
10+
to make sure those sources are available to the compiler:
11+
12+
```shell
13+
git submodule init
14+
git submodule update
15+
```
16+
17+
## Command Line Options for Debugging
18+
19+
`swift-format` provides some hidden command line options to facilitate
20+
debugging the tool during development:
21+
22+
* `--debug-disable-pretty-print`: Disables the pretty-printing pass of the
23+
formatter, causing only the syntax tree transformations in the first phase
24+
pipeline to run.
25+
26+
* `--debug-dump-token-stream`: Dumps a human-readable indented structure
27+
representing the pseudotoken stream constructed by the pretty printing
28+
phase.
29+
30+
## Support Scripts
31+
32+
The [Scripts](../Scripts) directory contains a `format-diff.sh` script
33+
that some developers may find useful. When invoked, it rebuilds
34+
`swift-format` (if necessary to pick up any recent changes) and lets
35+
you view a side-by-side `diff` with the original file on the left side
36+
and the formatted output on the right side.
37+
38+
This script will use `colordiff` if it is installed on your `PATH`;
39+
otherwise, it will fall back to `diff`.

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ as well as the following command line options:
3636
* `-i/--in-place`: Overwrites the input files when formatting instead of
3737
printing the results to standard output.
3838

39-
The command line tool also provides some
40-
[hidden debugging options](Documentation/Debugging.md) for use when developing
41-
`swift-format`.
42-
4339
### Configuration
4440

4541
For any source file being checked or formatted, `swift-format` looks for a
@@ -81,3 +77,8 @@ Please see the documentation in the
8177
[`SwiftFormatter`](Sources/SwiftFormat/SwiftFormatter.swift) and
8278
[`SwiftLinter`](Sources/SwiftFormat/SwiftLinter.swift) classes for more
8379
information about their usage.
80+
81+
## Development
82+
83+
If you are interested in developing `swift-format`, there is additional
84+
documentation about that [here](Documentation/Development.md).

0 commit comments

Comments
 (0)