The purpose of this is to add screeps autocomplete to IDEs by creating a definition from the documents. People can then add this project as a library in their IDE, and their IDE should be able to start autocompleting their code. Tested somewhat in JetBrain's WebStorm
This can be done by quite simply copying the ScreepsAutocomplete folder in their project, and Webstorm should automatically
detect it and add it to the autocompletion
Instead of copying the ScreepsAutocomplete folder to each and every project folder, you can add it as a global library.
- Create a new project in Webstorm if you don't already have one and open it.
- In the menu bar at the top of the screen, navigate to
File->Settings->Languages & Frameworks->JavaScript->Libraries - Click
Add. - Name the Library whatever you want.
- Set
Framework typeto custom, if it is not already so.Versioncan be left blank. - Change
VisibilitytoGlobal. - Click the green plus sign to the right of the listbox below
Visibility, then choose "Attach Directories...". - Navigate to the ScreepsAutocomplete folder, select the folder itself and click
OK. - Click
OKat the bottom of the "Edit Library" dialog. - Click the
Enabledcheckbox on the library you just created, make sure it's checked before continuing. - Click
OKat the bottom of the "Settings" dialog.
Webstorm should automatically detect the library and add it to the autocompletion.
- Create a new empty web site (File -> New -> Web Site -> ASP.NET Empty Web Site) and set the location to the location of your program.
- Copy the
ScreepsAutocompletefolder into your project and create a new file called_references.js(right click in solution explorer -> Add New Item ->_references.js). - Right click within the empty file and select
Update JavaScript Referenceswhich will populate the file and make autocomplete avaliable.
There are two ways to enable Autocomplete in Sublime Text, both of them require installing a plugin through
Package Control, and copying ScreepsAutocomplete in to your project.
-
TernJS- InstallTernJSthroughPackage Control, restart Sublime Text and tryvar room = new Room(); room.lookAt(x, y)to see if Autocomplete is working. If not, try the next options -
SublimeCodeIntel- InstallSublimeCodeIntelthroughPackage Control. Go toPreferences > Package Settings > SublimeCodeIntel > Settings -- Userand copy the contents ofScreepsAutocomplete/config/SublimeCodeIntel.jsonin to the file that opens. Save and restart Sublime Text. After waiting for CodeIntel to process JavaScript, Autocomplete should be working
Integration with Atom is done through use of the atom-ternjs package. Here's the steps
- Copy
ScreepsAutocompletein to your project folder - Install the
atom-ternjspackage - Put the following in your
.tern-projectfile
{
"ecmaVersion": 6,
"libs": [],
"loadEagerly": [
"ScreepsAutocomplete/**/*.js"
]
}- Restart and Enjoy