Open simonexmachina opened 11 years ago
Is this still an issue for you?
Yes I'm afraid it is.
If you have installed the Package "CoffeeScript" remove this package and everything is working again ;-). I have the autocomplete and the installed the Package and have the same problem like you. After removing the package everything works great again.
Interesting. I have CoffeeScript installed, yet autocomplete is working fine. A short while ago, I merged in a pull request that broke autocomplete. This has since been resolved. Autocomplete works best when using CoffeeScript class syntax. I suggest trying to create a simple class called HelloCoffee. In the constructor, define a new string, and try accessing that string's properties. When not using CS classes, autocomplete is "lost" in that it doesn't quite know what the context is. It uses the class syntax as its point of reference, and any "this" will be considered from the class in which it's being used. Hope this helps. Please let me know if it's working for you.
If you want to give this a shot, just copypasta the following. Then, hit ctrl+space after woot.
class HelloCoffee
constructor: ->
woot = "Woot!"
# After the dot, you should get an autocomplete popup with String's properties (length, charAt, ..., etc).
woot.
Let me know what happens (i.e., magical autocomplete popup with the answers to the universe, vs nothing).
Yes, that does work. I'm using Ember and the way to construct an instance is:
Class = Em.Object.extend foo: -> 'bar'
object = Class.create()
When I type object.
the autocomplete window shows and then immediately disappears.
Does something like the following work for you? If so, then autocomplete will work. Otherwise, it's not going to work as the plugin is limited to CS classes. Backbone classes that are extended this way work fine, so it's worth a shot.
class FooClass extends Em.Object
foo: ->
'bar'
baz: ->
# Autocomplete should show foo, baz, and methods inherited from Object.
this.
Yes it will work, but the code won't because Ember's got it's own object model :(
Ok, here is a reproducible text case.
class HelloCoffee
constructor: ->
woot = "Woot!"
# After the dot, you should get an autocomplete popup with String's properties (length, charAt, ..., etc).
woot.
class exports.HelloCoffee
constructor: ->
woot = "Woot!"
# After the dot, you should get an autocomplete popup with String's properties (length, charAt, ..., etc).
woot.
While the above works for me, I have a similar problem when trying to access class properties. If I use
root = global ? window
class root.MyClass
Then I cannot get an auto-completion for @
or this.
. If I remove the root.
everything works fine.
It seems I could fix it by changing (in coffee_utils.py
):
CLASS_REGEX_ANY = r"class\s+([a-zA-Z0-9_$]+)((\s*$)|[^a-zA-Z0-9_$])"
=> CLASS_REGEX_ANY = r"class\s+([.a-zA-Z0-9_$]+)((\s*$)|[^a-zA-Z0-9_$])"
But I'm not sure whether that breaks anything else, so I'm shy with a pull request. ;)
Don't know what other info to provide, but I'm using an up to date Sublime Text 2 on Mac OS 10.8. Let me know what else I can provide to help.