Closed Sherlouk closed 2 years ago
Same experience through command line. Succeeds quickly but no actual changes.
If I add the --verbose
flag here, it just stalls and doesn't finish.
Worth noting, in case it's relevant, I do have a custom configuration file in the root of the directory (.swiftformat
) but I'm testing rules which are both in the default ruleset as well as my custom one so should spot if it was working either way.
In a simple example of mine the code gets formatted (see line 2 of MyLibrary.swift
in the video below).
https://user-images.githubusercontent.com/4176826/182222904-d70c80f3-dfad-4d02-9216-4350e9a97657.mov
Is your Swift package open-source so that I can try?
Or can you share the info in report navigator for the execution of the plugin?
Example
There's a whole lot of nothing being printed out. Definitely not like yours. I'm using v0.49.12.
Code isn't open source, but if we're unable to figure it out I can try to reproduce in a smaller project. It's a Vapor project though - in case that adds some fun complexities?
Multiple targets, multiple products, including executables. I've tried putting unformatted code in all targets to see if it was running in one but not others.
Tried with arguments and without.
One thing of note, my file path has a space in it? I wonder if that's causing some problems?
That was it. Having a space in the file path causing it to not fail but not to work either.
Removing the space from the path fixes the issue - though of course would be nice if that wasn't necessary!
I'll fix in the next version (that adopts nicklockwood/SwiftFormat@0.49.13)
No worries, thank you for your effort in creating the plugin Marco!
Hi James,
would you mind trying out this fix ?
.package(url: "https://github.com/MarcoEidinger/SwiftFormatPlugin.git, branch: "fix")
Also, do you still get a crash when specifying --verbose
as an argument? I didn't encounter that, so I wonder if that is caused by something else and I did not yet stumble upon.
I can confirm that the fixed branch does address the issue with spaces in the path.
Unfortunately I'm still having problems with the verbose argument crashing Xcode - but a far less important issue for me! (though would be nice to know why...)
Hi James,
I am unable to reproduce the issue. I'll try further, but in the meantime, I'll create a release for the fix as well as uptaking nicklockwood/SwiftFormat@0.49.13)
Let me know if you can share a project in which the issue is reproducible.
Cheers, Marco
Unclear to me currently why, though I'm trying to do a bit more digging but I can run the plugin fine and it says it's passed but it isn't actually formatting the files.
I've run
swiftformat .
from the root of the project and it works as expected and the files are reformatted.I've tried adding the
--verbose
flag, but this is just crashing Xcode for me 😅Haven't yet tried via command line.