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

Not seeing SwiftFormat in Xcode 12.1/Big Sur #808

Open
ahwulf opened this issue Nov 22, 2020 · 19 comments
Open

Not seeing SwiftFormat in Xcode 12.1/Big Sur #808

ahwulf opened this issue Nov 22, 2020 · 19 comments

Comments

@ahwulf
Copy link

ahwulf commented Nov 22, 2020

I installed SwiftFormat and SwiftFormat For Xcode and followed the instructions. But no matter what I do Xcode never shows it in the Edit menu. The extension is clearly checked in Preferences. I even ran the whole thing multiple times, but Xcode never changes. Is this some limitation in 12.X or Big Sur?

@ahwulf
Copy link
Author

ahwulf commented Nov 22, 2020

Appears to require this: https://developer.apple.com/forums/thread/666434

@ahwulf
Copy link
Author

ahwulf commented Nov 22, 2020

Comment in Xcode 12 release notes: "A new Xcode Source Editor Extension target doesn’t automatically set up embedding XcodeKit.framework in the extension. (59274389)
Workaround: Embed XcodeKit.framework in the extension manually." No mention of fixing this in 12.1 or 12.2

@nicklockwood
Copy link
Owner

@ahwulf I don't have Bug Sur to test with yet - would you mind trying to fix this and open a PR if you get it working?

@ahwulf
Copy link
Author

ahwulf commented Nov 22, 2020

Never dealt with an extension before. Does it work for you in Xcode 12.X on Catalina? The release notes for Xcode were not very clear as to whether it was a 12 bug or an OS bug (maybe some kind of security thing).

@nicklockwood
Copy link
Owner

@ahwulf it works on Catalina.

@ahwulf
Copy link
Author

ahwulf commented Nov 22, 2020

OK I see XCodekit is Embed & Sign in your extension, which seems to be what is required, yet it does not work. Not a clue what else to try. Maybe someone else out there has some idea? The only thing I see in console at the end of the process is swift format reporting
Invalidating assertion 215-35016-20762 (target:[xpcservice<com.charcoaldesign.SwiftFormat-for-Xcode.SourceEditorExtension([app<application.com.apple.dt.Xcode.8655004951.8655170801(501)>:35016])(501)>:35026]) from originator [app<application.com.apple.dt.Xcode.8655004951.8655170801(501)>:35016]

@Cyberbeni
Copy link
Contributor

I downloaded it from the release assets and it works for me for both macOS 10.15 and 11.0 with Xcode 12.2

@imWildCat
Copy link

imWildCat commented Nov 29, 2020

Interesting, I am not seeing any Xcode extensions anymore, even for those downloaded from the App Store.

Looks like a system bug. I build this project again and signed it. However, it does not show.

@nicklockwood
Copy link
Owner

@imWildCat do you have multiple copies of Xcode installed? That might explain it. Also, try moving Xcode out of the applications folder and then moving it back again.

@imWildCat
Copy link

@nicklockwood I have Xcode 12.0 in the Downloads folder. After removing it completely, Xcode extensions are still now shown in the Preferences window. I am rebooting my laptop now.

@imWildCat
Copy link

No luck.

Found a potential issue:

default	--:--:--.796921+0800	Xcode	[MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-17535/IDEKit/NavigableItems/IDENavigableItem.m:1248
Details:  No match from <IDEKeyDrivenNavigableItem 0x7f962fdc3d50: (supports Any NSObject, represents: <Xcode3EditingGroup: 0x7f964870d3a0>)> to <Xcode3Target:0x7f969ffe1420:SwiftFormat for Xcode>. Iterating the whole tree might have taken a significant amount of time.
Object:   <IDEKeyDrivenNavigableItem_Xcode3EditingGroup_Any: 0x7f962fdc3d50>
Method:   -_descendantItemForRepresentedObject:stopAtClass:
Thread:   <NSThread: 0x7f96efc19e70>{number = 1, name = main}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.

@nicklockwood
Copy link
Owner

@imWildCat did you try this?

try moving Xcode out of the applications folder and then moving it back again.

@imWildCat
Copy link

@imWildCat did you try this?

try moving Xcode out of the applications folder and then moving it back again.

Sorry, I missed this one. It works, thank you!

@ahwulf
Copy link
Author

ahwulf commented Dec 1, 2020 via email

@puls
Copy link
Contributor

puls commented Dec 9, 2020

I also had this issue today, and I also solved it by moving Xcode out of /Applications and then moving it back.

@vvit
Copy link

vvit commented Dec 10, 2020

@imWildCat do you have multiple copies of Xcode installed? That might explain it. Also, try moving Xcode out of the applications folder and then moving it back again.

Helped me too! I haven't seen the plugin in the System Preferences > Extensions at all until I did this.

@VinceBurn
Copy link
Contributor

VinceBurn commented Dec 10, 2020

Have you check this: https://nshipster.com/xcode-source-extensions/

Section Using pluginkit start with this:

During development, Xcode can become confused as to which extensions it sees. It can be useful to get an overview of installed extensions using the pluginkit tool. This allows us to query the private PluginKit framework that manages all system extensions.

I have used the instruction in that section in the past when I was not able to see the extension from Xcode after an upgrade.

@stidch
Copy link

stidch commented Feb 1, 2021

Hi @VinceBurn

Thanks for the link above. Looked promising, but unfortunately it has not changed anything.
I've run

PATH=/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support:"$PATH"
lsregister -f /Applications/Xcode-12.3.app

I've restarted both Xcode and the Extensions dialog, but still Xcode is not showing up in the list :(

When I again run

pluginkit -m -p com.apple.dt.Xcode.extension.source-editor

it still does not print anything.

I guess this is not what should happen, right?

By the way, I'm using xcode-install, resp. xcversion for managing my Xcode installations (https://github.com/xcpretty/xcode-install).

@imWildCat
Copy link

Linking #804 for cross referencing...

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

No branches or pull requests

8 participants