nicklockwood / SwiftFormat

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

brew upgrade of app and command line + brew cleanup can cause extension in Xcode to vanish? #1451

Open clickonetwo opened 1 year ago

clickonetwo commented 1 year ago

Running in Ventura 13.3.1 (a), I did a brew upgrade of both an installed SwiftFormat for Xcode and an installed command-line swiftformat (both of which were outdated), then I did a brew cleanup. After this (and relaunching the application), my previously-enabled Xcode extension had vanished (as well as the Xcode Source Editor entry in the Extensions settings).

The fix that worked for me was to manually trash the SwiftFormat for Xcode application (from the Applications folder) and then do a brew reinstall --cask swiftformat-for-xcode.

This has never happened to me before, but then I didn't have the command-line tool installed via homebrew before. Maybe there's an interaction between the two installs?

Using one of the great tips in this article, I used pluginkit and got these results after the brew cleanup:

$ pluginkit -m -p com.apple.dt.Xcode.extension.source-editor -A -D -vvv
  (no matches)

Once I manually trashed the application and reinstalled it, I got these results (even before I ran the application):

$ pluginkit -m -p com.apple.dt.Xcode.extension.source-editor -A -D -vvv
+    com.charcoaldesign.SwiftFormat-for-Xcode.SourceEditorExtension(0.51.9)
                Path = /Applications/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex
                UUID = 5CEC4848-D5E5-4065-93D4-4C6EAA24F552
           Timestamp = 2023-05-13 18:38:03 +0000
                 SDK = com.apple.dt.Xcode.extension.source-editor
       Parent Bundle = /Applications/SwiftFormat for Xcode.app
        Display Name = SwiftFormat
          Short Name = SwiftFormat
         Parent Name = SwiftFormat for Xcode
            Platform = macOS

 (1 plug-in)

I don't know whether this is just a strange one-off weirdness, but I thought others might have seen it so I figured others might want to know about it (and the workaround that worked for me).

nicklockwood commented 1 year ago

Thanks for flagging this. Not sure there's much I can do to fix it, but I'll leave this open as resource for others.