nicklockwood / SwiftFormat

A command-line tool and Xcode Extension for formatting Swift code
MIT License
7.62k stars 623 forks source link

SwiftFormat doesn't appear in Extensions or Xcode Editor menu #898

Open JulesMoorhouse opened 3 years ago

JulesMoorhouse commented 3 years ago

I'm not sure when, but certainly recently, SwiftFormat disappeared from my Xcode Editor menu.

It doesn't appear in the System > Extensions app.

I've updated the SwiftFormat app to the latest version.

I've tried building the app myself.

I'm on MacOS Catalina - v 10.15.7, I can't upgrade my MacBook Pro to Big Sur.

Please advise, I'm happy to try / test anything to get it to work.

Thanks in advance.

nicklockwood commented 3 years ago

@JulesMoorhouse do you have multiple copies of Xcode installed? (maybe you kept an old version, or you installed a beta?)

If not, try dragging Xcode out of your Applications folder to the desktop, and then dragging it back to Applications again (there seems to be some kind of extensions cache that is cleared by moving or renaming Xcode).

JulesMoorhouse commented 3 years ago

Awesome thanks...

I have 12.3 as well as 12.4, deleting 12.3 and doing a brew update for SwiftFormat sorted it.

Cheers 😀

VinceBurn commented 3 years ago

The section "Using pluginkit" in this article: https://nshipster.com/xcode-source-extensions/

Has been useful to me in the past for similar problem.

paxos commented 3 years ago

@JulesMoorhouse do you have multiple copies of Xcode installed? (maybe you kept an old version, or you installed a beta?)

If not, try dragging Xcode out of your Applications folder to the desktop, and then dragging it back to Applications again (there seems to be some kind of extensions cache that is cleared by moving or renaming Xcode).

This actually worked! Thanks!

JulesMoorhouse commented 3 years ago

@nicklockwood I had this problem again today, however I only had one copy of Xcode.

Was using SwiftFormat happily yesterday.

A Catalina update was installed.

Then today SwiftFormat disappeared from Xcode and the Extensions app.

Moving the app while pressing command to the desktop then back to applications, then running SwiftFormat, it then appeared in extensions then Xcode.

Weird.

JulesMoorhouse commented 2 years ago

@nicklockwood I've had this problem a few times and have found it slow to copy Xcode to the desktop and back.

So I started using the move command, which is far quicker, which did work. However, I'm not sure why but it doesn't work any more..

I'm just wondering if I need to run the SwiftFormat app or open a different version of Xcode to make this work ??

Here's my terminal commands...

mv /Applications/Xcode125.app ~/Desktop/Xcode125.app
mv ~/Desktop/Xcode125.app /Applications/Xcode125.app

Thanks in advance.

nicklockwood commented 2 years ago

@JulesMoorhouse I'm not aware of anything having changed. It's possible a new build might be needed for the latest Xcode - I'll investigate.

JulesMoorhouse commented 2 years ago

@nicklockwood Oh I see, I guess I could have opened a newer Xcode version.

But as a rule I try and stick with 12.5.

I thought the issue might be caused as I didn’t drag to copy Xcode. I was thinking maybe the cache is only changed then.

nicklockwood commented 2 years ago

I've only ever moved the app not copied it, apologies if the instructions were unclear.

JulesMoorhouse commented 2 years ago

@nicklockwood no you're instructions were / are clear 👍

But it's just so slow to copy Xcode, I was just trying to speed up the process.

nicklockwood commented 2 years ago

But it's just so slow to copy Xcode, I was just trying to speed up the process.

Again, I never intended to suggest that you copy Xcode, only move it.

razor313 commented 2 years ago

Xcode Version : 12.3.1 masOS: Monterey 12.3.1

I had the same problem and I did the following:

  1. Close Xcode as well as Swiftformat
  2. reinstall SwiftFormat -> brew reinstall --cask swiftformat-for-xcode
  3. in system preferences -> extension -> uncheck and check Swiftformat
  4. run Xcode :)