Skip to content

Swift format #8610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 9, 2017
Merged

Swift format #8610

merged 3 commits into from
May 9, 2017

Conversation

compnerd
Copy link
Member

@compnerd compnerd commented Apr 7, 2017

Perform a couple of small cleanups to the swifft-format tool. The bulk of the changes here are related to the introduction of a small python based wrapper script to aid invoking the swift-format tool from vim. This mirrors the clang-format integration script to integrate swift-format into vim.

@compnerd
Copy link
Member Author

compnerd commented Apr 7, 2017

@swift-ci please test

@compnerd
Copy link
Member Author

compnerd commented Apr 7, 2017

CC: @regnerjr - could you please take a look at the IDE change?

@swift-ci
Copy link
Contributor

swift-ci commented Apr 7, 2017

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 161b1295b09d61b57a808e6aa56b9ef70baeca25
Test requested by - @compnerd

@swift-ci
Copy link
Contributor

swift-ci commented Apr 7, 2017

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 161b1295b09d61b57a808e6aa56b9ef70baeca25
Test requested by - @compnerd

@compnerd
Copy link
Member Author

compnerd commented Apr 7, 2017

@swift-ci please smoke test

@compnerd
Copy link
Member Author

compnerd commented Apr 7, 2017

CC @jrose-apple

unsigned IndentWidth = 4;
unsigned TabWidth = 4;
unsigned IndentWidth = 2;
unsigned TabWidth = 8;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you asked…please leave these alone. I like your settings better, but the current defaults match what Xcode does by default.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure if that would be a problem for Xcode, so I figured better to just discuss it :-). What do you think of changing the defaults in swift-format?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a problem for Xcode. I just think the defaults for the command line tool should match the defaults in Xcode.

@@ -158,11 +158,6 @@ class SwiftFormatInvocation {
InputFilenames.push_back(A->getValue());
}

if (InputFilenames.empty()) {
Diags.diagnose(SourceLoc(), diag::error_mode_requires_an_input_file);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. Most Swift tools use an explicit - for this. Is accepting input on stdin better?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so. It simplifies the integration and matches the behaviour for clang-format.

@@ -0,0 +1,93 @@
# This file is a minimal swift-format vim-integration. To install:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Historically we've avoided including editor support files in the repo for anything besides syntax coloring, and we definitely aren't calling them supported (as your "file bugs at bugs.swift.org" implies). I think you'd have to ask on swift-dev whether that policy has changed.

(And if it has, this belongs in utils/ rather than tools/driver/, and with "vim" in the name.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can drop the file bugs bit, and move it.

@compnerd
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 6e4f88e7f61dce076354fce0083b8371be7be3a9
Test requested by - @compnerd

@compnerd
Copy link
Member Author

@jrose-apple ignoring the indentation issue (Ill fix that later) ... is this okay?

@jrose-apple
Copy link
Contributor

No, please ask Ted on swift-dev if the policy has changed regarding editor support beyond syntax highlighting.

@compnerd
Copy link
Member Author

CC: @tkremenek

@tkremenek
Copy link
Member

@swift-ci test

@swift-ci
Copy link
Contributor

swift-ci commented May 3, 2017

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 6e4f88e7f61dce076354fce0083b8371be7be3a9
Test requested by - @tkremenek

@jrose-apple jrose-apple dismissed their stale review May 5, 2017 16:08

Ted's here.

compnerd added 2 commits May 6, 2017 11:12
Use `EXIT_SUCCESS` and `EXIT_FAILURE` rather than the raw values.  NFC.
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.
@compnerd
Copy link
Member Author

compnerd commented May 6, 2017

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented May 6, 2017

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 6e4f88e7f61dce076354fce0083b8371be7be3a9
Test requested by - @compnerd

@swift-ci
Copy link
Contributor

swift-ci commented May 6, 2017

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 6e4f88e7f61dce076354fce0083b8371be7be3a9
Test requested by - @compnerd

@compnerd
Copy link
Member Author

compnerd commented May 7, 2017

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented May 7, 2017

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 9a0cfc4f54ca3e107e99d5e2e25534a9e70dcf2e
Test requested by - @compnerd

@swift-ci
Copy link
Contributor

swift-ci commented May 7, 2017

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 9a0cfc4f54ca3e107e99d5e2e25534a9e70dcf2e
Test requested by - @compnerd

Add a helper, based on clang-format.py to integrate swift-format into
vim.
@compnerd
Copy link
Member Author

compnerd commented May 7, 2017

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented May 7, 2017

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 60e4652e15d60abcd49faf23b9a55f0b132585a0
Test requested by - @compnerd

@swift-ci
Copy link
Contributor

swift-ci commented May 7, 2017

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 60e4652e15d60abcd49faf23b9a55f0b132585a0
Test requested by - @compnerd

@compnerd
Copy link
Member Author

compnerd commented May 7, 2017

@swift-ci please test macOS platform

@compnerd compnerd merged commit 37ed4e5 into swiftlang:master May 9, 2017
@compnerd compnerd deleted the swift-format branch May 9, 2017 16:37
@compnerd
Copy link
Member Author

compnerd commented May 9, 2017

This was discussed on the mailing list and was okayed. @jrose-apple's comments were addressed.

@moiseev
Copy link
Contributor

moiseev commented May 9, 2017

@compnerd This broke the build slightly. Please don't forget to run pylint next time ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants