Skip to content
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

Add cli options for passing experimental features to swift-syntax #875

Closed
rauhul opened this issue Nov 7, 2024 · 3 comments · Fixed by #876
Closed

Add cli options for passing experimental features to swift-syntax #875

rauhul opened this issue Nov 7, 2024 · 3 comments · Fixed by #876

Comments

@rauhul
Copy link
Member

rauhul commented Nov 7, 2024

See title, when trying to format code using value generics, I had to patch the formatter to pass .valueGenerics to swift-syntax instead of being able to use a CLI flag.

@ahoppen
Copy link
Member

ahoppen commented Nov 8, 2024

Synced to Apple’s issue tracker as rdar://139474306

@allevato
Copy link
Member

allevato commented Nov 8, 2024

@ahoppen I was planning to take a look at this soon. I could do it entirely inside swift-format, but since ExperimentalFeatures is just a bitmask, we'd have to manually keep the string names consistent.

So I'm thinking of updating swift-syntax codegen to generate an ExperimentalFeature.init?(String) initializer that we could use. The initializer isn't really needed by swift-syntax itself but it would at least ensure that they're always in sync.

Thoughts?

@allevato
Copy link
Member

allevato commented Nov 8, 2024

I've created swiftlang/swift-syntax#2895 for the bits needed to translate the strings to option set values.

allevato added a commit to allevato/swift-format that referenced this issue Nov 8, 2024
…arser.

Also add a couple small tests for value generics to exercise the capability in
tests.

Fixes swiftlang#875.
allevato added a commit to allevato/swift-format that referenced this issue Nov 8, 2024
…arser.

Also add a couple small tests for value generics to exercise the capability in
tests.

Fixes swiftlang#875.
allevato added a commit to allevato/swift-format that referenced this issue Nov 8, 2024
…arser.

Also add a couple small tests for value generics to exercise the capability in
tests.

Fixes swiftlang#875.
allevato added a commit to allevato/swift-format that referenced this issue Nov 11, 2024
…arser.

Also add a couple small tests for value generics to exercise the capability in
tests.

Fixes swiftlang#875.
allevato added a commit to allevato/swift-format that referenced this issue Nov 11, 2024
…arser.

Also add a couple small tests for value generics to exercise the capability in
tests.

Fixes swiftlang#875.
allevato added a commit to allevato/swift-format that referenced this issue Nov 12, 2024
…arser.

Also add a couple small tests for value generics to exercise the capability in
tests.

Fixes swiftlang#875.
allevato added a commit to allevato/swift-format that referenced this issue Nov 12, 2024
…arser.

Also add a couple small tests for value generics to exercise the capability in
tests.

Fixes swiftlang#875.
macshome pushed a commit to macshome/swift-format that referenced this issue Dec 2, 2024
…arser.

Also add a couple small tests for value generics to exercise the capability in
tests.

Fixes swiftlang#875.
macshome pushed a commit to macshome/swift-format that referenced this issue Dec 5, 2024
Squashed commits:
[23709e8] Fix issue in publish_release pipeline testing swift-format in debug configuration
[ce212ca] Use matrix to run debug and release
[39ee6a2] Run Windows tests before tagging a release

The GitHub workflows enabled Windows in the testing matrix. We needed to port the pre-build commands that apply the release commits to Windows to make the Windows checks pass.
[8fec655] Use dockerless Windows jobs

Dockerless Windows is 5-10 minutes faster than Docker on Windows
[2cd032c] PrettyPrinter reports wrong line LineNumbersTests

The reason for the wrong line number were multiline
comments.
In to accomodate for this, we now check the string
while writing for new lines and increment the line
count accordingly.

Issue: swiftlang#882
[8c68ec3] Add indentBlankLines configuration
[fee42c9] Add `--enable-experimental-feature` to enable those features in the parser.

Also add a couple small tests for value generics to exercise the capability in
tests.

Fixes swiftlang#875.
[5e4caa8] feat: add pre-commit hooks
[e6aa9ec] Update UseShorthandTypeNames.swift
[9cbc942] Update UseShorthandTypeNames.swift
[dfb366a] Fix formatting
[c3b0c9f] Prepare for integer generics with new generic argument node
[211884f] Fix tests when building swift-format using Swift 6.0.2

When traversing the file URL with Foundation from Swift 6.0.2, you get the following components
- `["/", "C:", "test.swift"]`
- `["/", "C:"]`
- `[]`

The component count never reaches 1.

Foundation from Swift 6.1 goes
- `["/", "C:", "test.swift"]`
- `["/", "C:"]`
- `["/"]`

Cover both cases by checking for `<= 1` instead of `== 1`

Prepare for integer generics with new generic argument node

Fix formatting

Update UseShorthandTypeNames.swift

Update UseShorthandTypeNames.swift

feat: add pre-commit hooks

Add `--enable-experimental-feature` to enable those features in the parser.

Also add a couple small tests for value generics to exercise the capability in
tests.

Fixes swiftlang#875.

Add indentBlankLines configuration

PrettyPrinter reports wrong line LineNumbersTests

The reason for the wrong line number were multiline
comments.
In to accomodate for this, we now check the string
while writing for new lines and increment the line
count accordingly.

Issue: swiftlang#882

Use dockerless Windows jobs

Dockerless Windows is 5-10 minutes faster than Docker on Windows

Run Windows tests before tagging a release

The GitHub workflows enabled Windows in the testing matrix. We needed to port the pre-build commands that apply the release commits to Windows to make the Windows checks pass.

Use matrix to run debug and release

Fix issue in publish_release pipeline testing swift-format in debug configuration

Run Windows tests dockerless
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 a pull request may close this issue.

3 participants