krzysztofzablocki / SourceryPro-Feedback

Repository for discussing https://merowing.info/sourcery-pro/
12 stars 0 forks source link

[BUG] Xcode stops responding on startup for some time when extension is enabled #25

Open vdeep opened 1 year ago

vdeep commented 1 year ago

I recently upgraded to Monterey and Xcode 13.4.1. After the upgrade, when I start Xcode, it stops responding for 30-40 seconds and starts working after that. This only happens when the extension is enabled. When the extension is disabled, it works fine.

I have tried resetting Xcode (removing all cache and even re-installing), I also re-installed Sourcery Pro, but it didn't help.

krzysztofzablocki commented 1 year ago

Can you try going through https://nshipster.com/xcode-source-extensions/#using-pluginkit ? The Xcode plugin system is buggy sometimes

vdeep commented 1 year ago

I went through the steps, but it didn't help.

Here is the output of the commands I tried

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

    +    com.merowing.SourceryPro.SourceryProExtension(1.3.4)
  2. $ pluginkit -m -p com.apple.dt.Xcode.extension.source-editor -A -D -vvv

    +    com.merowing.SourceryPro.SourceryProExtension(1.3.4)
                Path = /Applications/SourceryPro.app/Contents/PlugIns/SourceryProExtension.appex
                UUID = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (redacted)
           Timestamp = 2022-09-26 19:01:20 +0000
                 SDK = com.apple.dt.Xcode.extension.source-editor
       Parent Bundle = /Applications/SourceryPro.app
        Display Name = Sourcery Pro
          Short Name = Sourcery Pro
         Parent Name = SourceryPro
    
    (1 plug-in)
  3. $ PATH=/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support:"$PATH" and $ lsregister -f /Applications/Xcode.app

    Executed without any output

krzysztofzablocki commented 1 year ago

@vdeep do you have any custom templates? if not, would you mind removing the default ones (you can always restore them through file -> restore defaults) and see if that changes anything?

The plugin system is buggy and only thing I do in the Extension on startup is read the list of templates you have from UserDefaults so wanted to see if the size of it affects that experience, I could potentially migrate data model to be even lighter if that's the case

vdeep commented 1 year ago

@krzysztofzablocki, this worked! Once I removed all the templates on Sourcery Pro, Xcode started instantly. But once I restored the templates, Xcode again stopped responding for some time on launch.

And no, I don't have any custom templates yet.

krzysztofzablocki commented 1 year ago

If you just keep one template does the issue persist?

vdeep commented 1 year ago

No, fewer templates reduce the time Xcode stops responding for. With one template, it starts instantly.

krzysztofzablocki commented 1 year ago

Ok, thanks for investigating,it's weird it happens for very few people but I'll play with a different data model for initial load, are you using mac appstore or direct buy version ?

vdeep commented 1 year ago

I’m using the App Store version. Also, I’m able to reproduce this on two different systems. Both the systems have Monterey and XCode 13.4.1.