swift icon indicating copy to clipboard operation
swift copied to clipboard

[SR-146] Move the swift indentation mechanism from SourceKit to libIDE and utilize it for a 'swift-format' tool

Open akyrtzi opened this issue 10 years ago • 4 comments

Previous ID SR-146
Radar None
Original Reporter @akyrtzi
Type New Feature
Status Resolved
Resolution Done

Additional Detail from JIRA
Votes 3
Component/s Source Tooling
Labels New Feature, StarterBug
Assignee None
Priority Medium

md5: 9dbc0cc9b44435dff437b44922a6c8dd

is blocked by:

  • SR-2188 Xcode closure auto-indentation is hard to read with some styles

Issue Description:

SourceKit contains indentation logic that is not exposed in the libIDE library; this is not desirable because SourceKit is not cross-platform. Here are some steps to improve on this:

  • Move the indentation logic from SourceKit to libIDE. Have SourceKit just expose the functionality contained in libIDE.

  • Start a 'swift-format' tool that uses the indentation mechanism from libIDE; given a file and source range it auto-indents it.

  • See prior work for 'clang-format' (http://clang.llvm.org/docs/ClangFormat.html) for investigation on how to specify and provide formatting options.

akyrtzi avatar Dec 08 '15 21:12 akyrtzi

Comment by John Regner (JIRA)

Submitted PR-1686 https://github.com/apple/swift/pull/1686 . Which makes progress on this. The PR proposes to move the indentation logic from SourceKit -> libIDE.
(it does not include the creation of the `swift-format` tool)

swift-ci avatar Mar 15 '16 15:03 swift-ci

Comment by Mohammed M. Ennabah (JIRA)

@akyrtzi I think this is merged and should be marked as resolved.

swift-ci avatar Sep 16 '17 01:09 swift-ci

Comment by Eddy Gammon (JIRA)

Done in https://github.com/apple/swift/pull/1686

swift-ci avatar Oct 31 '21 08:10 swift-ci

For posterity: https://github.com/apple/swift-format

AnthonyLatsis avatar Nov 11 '22 05:11 AnthonyLatsis