stuartherbert / sublime-phpunit

PHPUnit Support for Sublime Text 2
https://github.com/stuartherbert/sublime-phpunit
Other
103 stars 20 forks source link

context menu slowdown in php files #20

Closed enricoreich closed 9 years ago

enricoreich commented 11 years ago

Hello,

this plugin slows down the context menü when i right click into an php file. The contextmenu hangs for about 2-3 seconds and than it appears.

It onlyhappens by right clicking into the code-view-part of an php file.

Can you please take a look into this ? Thanks!

best regards....

leoshmu commented 11 years ago

I see a similar issue, after doing a fresh install of ST2. I get a debug message saying that there was a timeout whilst searching for phpunit.xml, though I can run the test, and the plugin shows me the results of the test beautifully. My file structure is: Top Folder->tests->Some Tests Here I get the debug message whether I put the phpunit.xml file in the Top Folder, or if I put it directly in the tests folder. I've tried adjusting the "phpunit_xml_location_hints" and top folder hints settings but to no luck. Could you provide additional documentation of how to use those settings to help the plugin find the xml file? Perhaps you could support a user setting a specific hardcoded location for the file on a per project basis, thereby removing the need to search for the file? Thanks for all your great work on this plugin, despite the 2 second delay each time, I really like using it!

salimane commented 11 years ago

I second this, it happens on any file and slow down the context menu

stuartherbert commented 11 years ago

Unfortunately, the plugin doesn't have access to ST2's cached list of folders and contents (ST2 doesn't share this list with plugins), which means we're forced to search ourselves for any files the plugin needs to find (such as phpunit.xml).

I've gone through every line of code in the plugin, and done my best to speed up all of the file searching operations, and to cut down the number of file searches. Please let me know if this performs better or worse for you.

gaisho commented 11 years ago

This has not improved for me; perhaps you can add an option in the settings to disable phpunit from context menu. I never really use it; I always use the HUD.

Thanks for the awesome work.

dfanica commented 9 years ago

hey @stuartherbert, is there any way I can make it not show in the right click menu... I don't really use it like that and it's a pain every time I right click it hangs for 3-5 seconds. just an option to turn it on/off would do fine! Thanks for the awesome work. I use it combination with Chain of Command to run on save (Ctrl+S) ... works wonders!

dfanica commented 9 years ago

By commenting out the phpunit_flush_cache from the context menu everything is running smooth. Can I ask, what is phpunit_flush_cache doing as I never saw it in the actual drop down menu.

file: \Sublime Text 3\Packages\PHPUnit\Context.sublime-menu

[
    { "caption": "-" },
    {
        "caption": "PHPUnit",
        "children":
        [
            // { "command": "phpunit_flush_cache" },
            { "command": "phpunit_run_tests" },
            { "command": "phpunit_open_test_class" },
            { "command": "phpunit_open_class_being_tested" },
            { "command": "phpunit_open_phpunit_xml" },
            { "command": "phpunit_run_this_phpunit_xml" },
            { "command": "phpunit_run_all_tests" },
            { "command": "phpunit_not_available" }
         ]
    }
]

P.S. I used PackageResourceViewer if anyone can't find the file mentioned above!

stuartherbert commented 9 years ago

I've just pushed some changes which should speed things up a lot for most people.

I've also added a new 'context_menu' setting in the preferences file. Set this to 'false', and it will disable all of the context menus.

Let me know if further changes are required.