ScreepsAutocomplete
ScreepsAutocomplete copied to clipboard
Visual Studio Integration
I'm getting the above error when attempting to integrate the ScreepsAutocomplete into Visual Studio 2015. The only thing that is successfully being autocompleted is Game. I followed the instructions and added the _references.js file correctly. I also followed instructions from another site that makes Intellisense recognize the _references.js as a proper reference file.
On further testing in VS, I found that it's simply not treating the result of Game.spawns['Spawn1'] as a Spawn object. Using the code 'var testspawn = new Spawn(); testspawn.' will show the autocomplete functions correctly.
I can confirm this issue. It's weird because Game.spawns is clearly labeled as @type {Array<string, Spawn>}
Stuff like room.storage is not recognized as StructureStorage either =/
I found the issue. For VS IntelliSense to work you need to use comments of this stlye: https://msdn.microsoft.com/en-us/library/bb514138.aspx
If I replace the comment for Room.storage like this, it works:
/// <field name='storage' type='StructureStorage'>The engine's hefwforsepower.</field>
storage: null,
using 'undefined|StructureStorage'
doesn't seem to work, however.
Ok there is a better way:
The issue seems to be that for class properties the @type
comment is used instead of @property
.
So if you replace this:
/**
* The Controller structure of this room, if present, otherwise undefined.
*
* @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#controller}
*
* @type {undefined|StructureController}
*/
with this:
/**
* @see {@link http://support.screeps.com/hc/en-us/articles/203079011-Room#controller}
*
* @property {StructureController|undefined} controller The Controller structure of this room, if present, otherwise undefined.
*/
It works. I replaced @type
with @prototype
, swapped undefined
and StructureController
, added the property name controller
and move the comment in the same line.
had some problems finding out what to change. give me a list of files to update, and some info on what parts and i will fix
@kriso02 Well...all the files. For all properties the @type comments have to be replaced by @property comments as demonstrated in my last comment.
so all "@type"?
what is the difference