clemos / haxe-sublime-bundle

Sublime Text bundle for Haxe programming language
Apache License 2.0
237 stars 85 forks source link

Autocomplete not working for current class without 'this' #215

Closed dana22cc closed 9 years ago

dana22cc commented 9 years ago

For example if I create a class extending Sprite and start writing addChild it doesn't autocomplete. But if I write this.addChild it does.

mlopes commented 9 years ago

I have the same issue:

image

This happens with all inherited methods.

ghost commented 9 years ago

This feature will be available in Haxe 3.2. Now you can use a snippet. t - tab for example:

<snippet>
    <content><![CDATA[this.]]></content>
    <tabTrigger>this</tabTrigger>
    <scope>source.haxe.2</scope>
    <description>this</description>
</snippet>
clemos commented 9 years ago

It should actually be implemented currently (if you have Haxe 3.2+) But it doesn't seem to work, no completion is returned by the compiler, and the plugin falls back to "our" toplevel completion (local syntax based + classpaths) https://github.com/clemos/haxe-sublime-bundle/blob/master/HaxeComplete.py#L1997-L1998 I guess in order for toplevel completion to work, we should set offset (or byte_offset) to the beginning of the current word, rather than to the current caret position, somewhere around here: https://github.com/clemos/haxe-sublime-bundle/blob/master/HaxeComplete.py#L1985-L1986

ghost commented 9 years ago

Yes, it seems this should help. I planned to fix it after release. I'm still on Haxe 3.1.3. Can you try it?

clemos commented 9 years ago

It should work now, please confirm.