justinmahar / SublimeCSAutocompletePlus

CoffeeScript autocompletions and more!
172 stars 12 forks source link

Dropdown blinks by and almost never stays open #9

Closed alexgorbatchev closed 11 years ago

alexgorbatchev commented 11 years ago

Hey, love the idea of this plugin but have trouble using it. When I press Ctrl+Space i see the scanning happening and dropdown blinks by but almost never stays open. Here's my env info:

Sublime 2.0.1 OSX

packages

    "Alignment",
    "BracketHighlighter",
    "CoffeeComplete Plus (Autocompletion)",
    "CTags",
    "Git",
    "Jade",
    "LESS",
    "LESS-build",
    "Open-Include",
    "Origami",
    "Package Control",
    "Pretty JSON",
    "SideBarEnhancements",
    "Stylus",
    "sublime-better-coffeescript",
    "SublimeLinter",
    "Theme - Soda",
    "VintageEx"

No errors or log in the Sublime console either... anything else I could do to provide you with more info?

justinmahar commented 11 years ago

Where are you trying to autocomplete? In a coffee file, type "Math." and hit ctrl+space. Does that work, at least?

alexgorbatchev commented 11 years ago

I'm trying inside a .coffee file. With Math. I get the dropdown, but it's blinks by at least once or twice before finally showing. I find that I get good suggestions when the dropdown comes on it's own with regular autocomplete but Ctrl+Space almost never works.

justinmahar commented 11 years ago

Do you have a ton of files in the project? Maybe this is the issue. If so, you can exclude directories, or restrict to certain paths, using the configuration settings coffee_autocomplete_plus_excluded_dirs and coffee_autocomplete_plus_restricted_to_paths.

Is it an older machine? The plugin hides the default autocomplete list, then scans asynchronously and then forces the autocomplete list to pop up when it's done. This would explain the "blinking" you're seeing. It's usually barely noticeable.

alexgorbatchev commented 11 years ago

I'm working on a faily large-ish project, maybe a thousand or so files on the latests MacBook Air. I suppose you have looked into the blinking and there's probably no way around that... Is there any debugging info I could get you to look into why it's not staying open on Ctrl+Space?

justinmahar commented 11 years ago

I want to make sure I understand the issue. What ST2 does is, when you hit ctrl+space, it suggests autocompletions for any words you have in the document. The plugin hides this list, then tries to suggest the methods and properties that you actually care about.

So, in your case, the list pops open for a second, then disappears? With the Math autocompletion, you actually see Math autocompletions, but then it goes away? I had my buddy test this on his mac and it didn't have this issue... so, maybe a conflict with another plugin? If there are no errors in the console, that means it's not actually breaking per say... this makes it tough to debug what's going on without actually getting in there myself.

justinmahar commented 11 years ago

For now, I'd suggest restricting the plugin to the directory with your coffeescript files using the coffee_autocomplete_plus_restricted_to_paths config setting. Then see if that does the trick. It might be hanging on scanning the large amount of files for .coffee files, although that seems unlikely... it's worth a shot.

alexgorbatchev commented 11 years ago

Thanks for your suggestions, I'll try to figure out if there's a conflict. In the mean time I made a screencast http://screencast.com/t/ppirEPqdGopo

You can one see it blink on the first email.. Then it shows up for Math. and then I try email. again and screencast doesn't show the blinking because of dropped frames... so it's blinking "that" fast :) Hope that helps.

justinmahar commented 11 years ago

Ahh, so Math. seems to be working, then, but your variable, email, is not. It's not suggesting anything because it doesn't know what an "email" is. Where is email defined?

alexgorbatchev commented 11 years ago

email is defined a few lines above as email = sentEmailMessages()[0]. It seems that if the there are no "better" suggestions, it should show the original Sublime suggestions at least. Also, in CoffeScript there should always be at least a few suggestions for Object which could be used as a fallback... plus all other email.[whatever] that are in the same files (of which I have plenty). Am I making any sense here?

justinmahar commented 11 years ago

You are making sense. Thanks for the suggestions, I really appreciate it.

The plugin is not savvy enough to detect the type of your email variable, since you are accessing an index of an array. This is one step beyond the plugin's capabilities.

Since I figured this might happen, I built a feature into the plugin called type hinting which allows you to tell it what type you are dealing with. After your email assignment, add a comment like this: # [String]. The plugin will detect this and provide suggestions for a String instance.

alexgorbatchev commented 11 years ago

Thanks for taking time to address this!

justinmahar commented 11 years ago

You're welcome. Enjoy the plugin. New features coming soon. I will also add your suggestions to the list.