Open angelozerr opened 9 years ago
yes, there is also atlas, tilemap, etc... take a look to the Phaser.Loader methods. In phaser you load images but also audio, json files, xml files, font files, etc... but I guess it is out of the scope of tern.
but I guess it is out of the scope of tern.
Why?
You could have completion for those kind files too, no?
Well, I said it because I thought that compute the set of paths is a concern of the client implementation. For example, the file path can be relative to the index.html of the project (but only the client -editor- knows how the project structure is). But well, the reality is that I know very little about tern :)
I had done that for Angular templateUrl https://github.com/angelozerr/angularjs-eclipse/wiki/New-and-Noteworthy-1.0.0#templateurl and it works too for any edito (except Web Browser)r:)
The basic idea is to configure a base url. The tern plugin uses this base url and use node.js to loop for files.
Perfect!
Just to understand it better, I guess that in the tern spec there is a way to say that a var is a string with a filename of extension .png, .jpg... Is it?
I guess that in the tern spec there is a way to say that a var is a string with a filename of extension .png, .jpg... Is it?
It's a little complex than that. tern gives you the capability to override "standard" completion, find type at. The basic idea is to override tern completion, check if completion is thrown inside game.load.image("", " completion is executed here) and after you compute the result of completion (in this case you use node.js to loop for a lis of files and you filter it with JS)
Tern gives you too the capability in the JSON Type Definition to call a custom tern function which is usefull to create custom type. For instance for node require function must returns a custom type according the given string:
var f = require("fs")
// here f has JavaScript file system type.
See https://github.com/marijnh/tern/blob/master/plugin/commonjs.js#L84
In other words, you can manage anything with tern. I have for instance managed completion for HTML elements ids for query selector (document.querySelector). See https://github.com/angelozerr/tern-browser-extension
Very good.
In the sample http://phaser.io/examples/v2/animation/animation-events:
It should be cool to have completion for image like:
@boniatillo-com is there other methods which uses images?