joeferraro / MavensMate-SublimeText

Sublime Text plugin for Salesforce developers. Aims to replace the Eclipse-based Force.com IDE.
http://mavensmate.com
GNU General Public License v3.0
290 stars 119 forks source link

Autocomplete causes Sublime Text to freeze #203

Closed thysmichels closed 8 years ago

thysmichels commented 11 years ago

Sublime V3047 MM V0.35.1

When I open my project and start type auto completion tries to give me suggestions and it then hangs sublime and the wheel of death appears. I have to force quite sublime. Add some documentation to disable autocompletion if this happens.

joeferraro commented 11 years ago

mm_autocomplete : false

http://mavensmate.com/Plugins/Sublime_Text/Code_Completion

joeferraro commented 11 years ago

Please be more descriptive with your issue titles

I've seen this issue reported a few times.

What type of file? Are you opening the autocomplete explicitly with control + space or using "dot completion"? What is the syntax highlighting setting for the file (Java, Javascript, HTML, etc.)? What happens if you remove the auto_complete_triggers array from your project's .sublime-project JSON file?

thysmichels commented 11 years ago

Type of file: class files No not opening autcomplete explicitly, dot completion. Syntax highlight is set to Java.

mm_autocomplete : false did not work. auto_complete_triggers array from your project's .sublime-project JSON file did work and I have no auto-completion.

capeterson commented 11 years ago

I hit this two in a pretty complex (and proprietary, otherwise I'd share to help repro) apex class file the other day, but only within that class. If it happens again is there anything I can do (get logs?) to help?

DougGrimwade commented 11 years ago

Sublime 3.0.4 Mavensmate 0.35.1

I have had the same issue a couple of times now. Its always whilst editing a class file, syntax java, whilst trying to do a dot completion. It only happens on one file, others still do completion ok. I've tried refreshing the class from the server but this made no difference. I've tried creating a new project and still no joy - the same file fails.

I tried taking 'source' out of the auto_complete_triggers in the project's sublime-project file. This did not help - the problem still occurred. I tried switching mm_autocomplete to false - this also didn't help (I restarted after each change). So at the moment I cannot find a workaround.

I cannot recall how I fixed the problem the first time round but cannot seem to resolve it this time - back to the Force .com IDE :(

DougGrimwade commented 11 years ago

A further update

I tried creating a new class and copying the source from the problem class in - the source still hangs on autocomplete.

I tried making the edit through force.com IDE and then refreshing the class in MM - the source still hangs on autocomplete.

joeferraro commented 11 years ago

hey guys, can you check on this and let me know if you're still experiencing the issue. the patch we just pushed handles instances where square brackets were hanging ST, but there may be other issues of which we're unaware.

DougGrimwade commented 11 years ago

Hi Joe

Sorry to be a newbie - I have no idea how I get a patch to mm installed. All I've ever done is use the download 0.35.1. Is there a new version of the download available? OR do I need to set up a development environment, pull the sources and build from scratch? Any pointers would be appreciated.

Cheers

Doug

On 13 September 2013 09:04, Joe Ferraro notifications@github.com wrote:

hey guys, can you check on this and let me know if you're still experiencing the issue. the patch we just pushed handles instances where square brackets were hanging ST, but there may be other issues of which we're unaware.

— Reply to this email directly or view it on GitHubhttps://github.com/joeferraro/MavensMate-SublimeText/issues/203#issuecomment-24379208 .

Doug Grimwade Consultant 07777 5556535


http://www.brightgen.com

Tel: +44 (0)1376 520578 / +44 (0)1376 519888

Registered Office: BrightGen Ltd, Ginetta House, 155-157 Newland Street, Witham, CM8 1BE

A company registered in England and Wales under Registration No. 5994605

joeferraro commented 11 years ago

Reload the plugin from your MavensMate.app plugins panel.

DougGrimwade commented 11 years ago

Thanks Joe.

A quick test suggest autocompletion is working again for me - great work - much appreciated. I'll switch back to MM today and let you know if I have any more autocomplete issues with it.

On an unrelated note - if I do a 'Compile Project' and it fails how do I see where it failed?

Cheers

Doug

On 13 September 2013 11:00, Joe Ferraro notifications@github.com wrote:

Reload the plugin from your MavensMate.app plugins panel.

— Reply to this email directly or view it on GitHubhttps://github.com/joeferraro/MavensMate-SublimeText/issues/203#issuecomment-24384537 .

Doug Grimwade Consultant 07777 5556535


http://www.brightgen.com

Tel: +44 (0)1376 520578 / +44 (0)1376 519888

Registered Office: BrightGen Ltd, Ginetta House, 155-157 Newland Street, Witham, CM8 1BE

A company registered in England and Wales under Registration No. 5994605

mfpaulallen commented 11 years ago

Hi Joe,

Sublime Text build 3047 Mavensmate for Sublime Text V3.0.6

I'm running into the same issues as well with code completion causing a crash on apex classes. I've observed it for autocompleting external class methods, and after square brackets. The only fix was to turn off Sublime Text code completion all together.

Just now I re-installed the plugin through MavenMate.app, restarted sublime text 3, re-enabled code completion for both ST3 and Mavensmate, and I'm still crashing.

I'm also working on a proprietary code-base but I've copied the latest stack trace if you would like a copy.

Is there any other info I can share?

Thanks for everything, I love the plug in.

joeferraro commented 11 years ago

Hi @mfpaulallen it'd be extremely helpful if you could reproduce the issue in a small, genericized Apex Class and copy the contents in this issue.

mfpaulallen commented 11 years ago

With generic--also uncompilable-- apex class, I'm still crashing any time I enter a '.' after an object, class, or method.

I created entirely new GenericUtil and GenericService class from scratch but it wasn't till i began to copy-paste from the troubled apex class that the software began to crash. I Genericized as much info as I could and removed quite a bit of the code in the new classes and the problems continued. Obviously the code won't compile and is incomplete, but I hoepfully this is enough to help you pinpoint the problems.

Let me know if this causes problems for you, too, or if you can see a solution that I should perform locally.

global with sharing class GenericService {

    /*******
    *
    *   Services 
    *
    ********/

    global static GenericUtil.GenericInfo getGenericInfoByReferenceId(Id referenceId) {

        if(GenericUtil.isContactReferenceActive(referenceId) == false) {
            throw new GenericUtil.APIException('contact is not a resource or is inactive. Id: ' + referenceId);
        }

        Contact contactInfo = [SELECT namespace__Is_Reference__c,
                                               namespace__Is_Reference_Active__c,
                                               Id,
                                               namespace__Salesforce_User__c,
                                               namespace__Generic__r.Id,
                                               namespace__Generic__r.namespace__Super_Important_Info__c
                                        FROM Contact  WHERE Id = :referenceId];

        GenericUtil.GenericInfo resourceGeneric =  new GenericUtil.GenericInfo(  
            contactInfo.namespace__Salesforce_User__c,
            contactInfo.Id,
            contactInfo.namespace__Is_Reference__c,
            contactInfo.namespace__Is_Reference_Active__c,
            contactInfo.namespace__Generic__c,
            contactInfo.namespace__Generic__r.namespace__Super_Important_Info__c
        );
        return resourceGeneric;
    }

    global static list<namespace__Object_Header__c> getObjectList (Id referenceId) {
         String qry = 'Select Id, namespace__Reference__c, namespace__Start_Magic__c, namespace__End_Magic__c, namespace__Object_Notes__c, namespace__Status__c, namespace__Total_Info__c, namespace__Estimated__c, namespace__Random__c, namespace__OtherObject__c, namespace__OtherObject__r.Name, namespace__OtherObject__r.namespace__Nick_Name__c, namespace__OtherObject__r.namespace__Is_Awesome__c, namespace__TertiaryObject__c, namespace__TertiaryObject__r.Name, namespace__TertiaryObject__r.namespace__Is_Awesome__c, namespace__TertiaryObject_Phase__c, namespace__TertiaryObject_Methodology__c, namespace__TertiaryObject_Magic_Days__c, namespace__TertiaryObject_Magic_Days__r.Name, namespace__TertiaryObject_Magic_Always__c, namespace__TertiaryObject_Magic_Always__r.Name, namespace__TertiaryObject_Magic_WhyNot__c, namespace__TertiaryObject_Magic_WhyNot__r.Name, namespace__TertiaryObject_Magic_Super__c, namespace__TertiaryObject_Magic_Super__r.Name, namespace__TertiaryObject_Magic_Fri__c, namespace__TertiaryObject_Magic_Fri__r.Name, namespace__TertiaryObject_Magic_Stuff__c, namespace__TertiaryObject_Magic_Stuff__r.Name, namespace__TertiaryObject_Magic_Cruft__c, namespace__TertiaryObject_Magic_Cruft__r.Name,                       namespace__TertiaryObject_Phase_Object__c, namespace__TertiaryObject_Phase_Object__r.Name, namespace__TertiaryObject_Methodology_Object__c, namespace__TertiaryObject_Methodology_Object__r.Name,namespeace__Other_Notes__c, namespeace__Other_Info__c, namespace__Funtimes_Days__c, namespace__Magic_Days__c, namespeace__Other_Notes__c, namespeace__Other_Info__c, namespace__Funtimes_Always__c, namespace__Magic_Always__c, namespeace__Other_Notes__c, namespeace__Other_Info__c, namespace__Funtimes_WhyNot__c, namespace__Magic_Super__c, namespeace__Other_Info__c, namespeace__Other_Notes__c, namespace__Funtimes_Fri__c, namespace__Magic_Fri__c, namespeace__Other_Notes__c, namespeace__Other_Info__c, namespace__Funtimes_Stuff__c, namespace__Magic_Stuff__c, namespeace__Other_Notes__c, namespeace__Other_Info__c, namespace__Funtimes_Cruft__c, namespace__Magic_Cruft__c';

        //@todo add additional fields here

        qry += ' FROM namespace__Object_Header__c';

        //see if user passed an Id.
        if (referenceId !=null)
        {
            qry += ' WHERE namespace__Reference__c = :referenceId';
        }

        //@debug
        System.debug('@@@@@@@@ query value: ' + qry);

        //get list from database
        List<namespace__Object_Header__c> objectHeaderList = Database.query(qry);

        List<GenericUtil.ObjectInfo
        Map<String, Object> relatedObjects = new Map<String, Objects>()

        for(namespace__Object_Header__c object : objectHeaderList)
        {
            if(object.namespace__OtherObject__c == null && object.namespace__TertiaryObject__r.Name != null)
            {
                object.namespace__OtherObject__r = new namespace__OtherObject__c(Name = object.namespace__TertiaryObject__r.Name);
            }
        }
        return objectHeaderList;
    }
 }

}
mfpaulallen commented 11 years ago

Autocomplete works fine for first level classes and objects, but "dot-completion" seems to crash, regardless of what class or object or string came before the '.'

The crashing continues even after I comment out the contents of the "auto_complete_triggers" array in myProject.sublime-project. The only way to work is to turn both MM and Sublime autocomplete features of in their respective user-settings.

mfpaulallen commented 11 years ago

It does

joeferraro commented 11 years ago

@mfpaulallen thanks very much for this, it helped us track down the issue. Please update to 3.0.7 and let us know if you continue to experience issues. cheers.

mfpaulallen commented 11 years ago

@joeferraro - after a quick glance everything looks great. Many thanks.

mfpaulallen commented 11 years ago

@joeferraro - I'm still occasionally hanging in the same Apex class I was working with before. Any attempts to genericize the code so that I can reproduce it and share publicly temporarily aleviate the issue. I believe this may have something to do with issue #215 . Autocomplete starts to 'slow' on dot completion for a few methods and then BOOM, hang.

ghost commented 10 years ago

I still get this issue. Happens with dot completion on bit SOQL statements. Very frustrating

joeferraro commented 10 years ago

@illbilly can you post an example SOQL statement giving you problems. thanks

dcrockwell commented 9 years ago

This is happening here with autocompleting anything in a for() loop in javascript.

I didn't notice it until I installed a plugin for jshint linting, but it looks like others have the same issue without this plugin.

Some more info:

dcrockwell commented 9 years ago

I've narrowed down the problem in my case to a bug in the jshint binary causing any linter that uses it to freeze sublime with the beach ball of doom.

This isn't really a problem with Sublime, aside from a need for a "cancel" feature on such operations.

ruwanthalk commented 9 years ago

This issue is still exist.

I was really frustrated of this when I use mavensmate. The issue I faced is I just wanted to type the getBody() of response object. When I type res.b it get stuck several time. This is a great tool. But need to get rid of this kind of annoying issues. Making mm_autocomplete false is not a solution. Please escalate this issue to make this product really standout.