snowkit / sublime_flow

Sublime Text support for Haxe flow build tool
5 stars 1 forks source link

Autocomplete doesn't detect libraries in dependency chain #7

Closed hamaluik closed 8 years ago

hamaluik commented 8 years ago

Not sure if this is sublime_flow or sublime_haxe, but autocomplete doesn't seem to pick up a library unless its explicitly set in a project .flow file, rather than the .flow file of the project's dependencies.

Example: in tusk.flow, I include promhx as a dependency. In the sample project.flow file, I depend on tusk, which should mean I depend on snow and promhx and be picked up by autocompletion. Instead, autocompletion doesn't detect promhx until I include it as a dependency in project.flow.

ruby0x1 commented 8 years ago

Remember that the code completion is powered by haxe, using simple -cp commands in the build.hxml file - open up bin/.build/build.hxml and see what is listed - It wouldn't build if the library wasn't referenced correctly, and the dependencies don't have a problem elsewhere (i.e snow completes fine, when it's a dependency of luxe, which is a dependency of a project). In a local project, I have dependencies even further down, and no problems - so we need to narrow down what you're seeing and why.

You can kill the haxe server (task manager, or killall haxe), and then run the haxe -v --wait 6111 command in a terminal. That will print everything the code completion receives and returns.

hamaluik commented 8 years ago

Hmm.. I think the issue was that after adding the library to the flow file, I didn't rebuild the sample project, which in turn didn't create the build.hxml, which in turn meant the completions didn't work. I can somewhat confirm this by building the project, then removing the library from the sample project.

Which all makes sense now, and is a trivial step to overcome. Would it be reasonable to have the flow plugin update the buiild.hxml file whenever changes are saved in the flow file?

ruby0x1 commented 8 years ago

It does when you save the flow file that is assigned as the active project. sublime text has no real way to know if the .flow file extension you are saving has any relation to the active project, except by actual path atm. Deep coupling like that into the sublime workflow is not ideal, especially during active dev in alpha.

Secondly, The completion hxml comes from flow info and stored in the sublime flow plugin. It is not the build.hxml on disk. The flow info comes from the flow file, and is updated from 1) when set project as active is called or 2) the active flow file is modified/saved.

In other words, whenever you change something and things are possibly being weird related to completion specifically, refresh the info by set/save. I use set, as it is more explicit, unless it's the active flow file directly I'm modifying.