Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visual Studio Integration #48

Open
zackman0010 opened this issue Oct 5, 2016 · 9 comments
Open

Visual Studio Integration #48

zackman0010 opened this issue Oct 5, 2016 · 9 comments

Comments

@zackman0010
Copy link

image
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.

@zackman0010
Copy link
Author

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.

@Tim-Pohlmann
Copy link

I can confirm this issue. It's weird because Game.spawns is clearly labeled as @type {Array<string, Spawn>}

@Tim-Pohlmann
Copy link

Stuff like room.storage is not recognized as StructureStorage either =/

@Tim-Pohlmann
Copy link

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.

@Tim-Pohlmann
Copy link

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.

@IotaBlack
Copy link

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

@Tim-Pohlmann
Copy link

@kriso02 Well...all the files. For all properties the @type comments have to be replaced by @Property comments as demonstrated in my last comment.

@IotaBlack
Copy link

so all "@type"?

@IotaBlack
Copy link

what is the difference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants