Screeps Autocomplete
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
How to Install
Webstorm (Or Other Jetbrains IDE's)
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
Adding it as a library
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 type
to custom, if it is not already so.Version
can be left blank. - Change
Visibility
toGlobal
. - 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
OK
at the bottom of the "Edit Library" dialog. - Click the
Enabled
checkbox on the library you just created, make sure it's checked before continuing. - Click
OK
at the bottom of the "Settings" dialog.
Webstorm should automatically detect the library and add it to the autocompletion.
Visual Studio
- 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
ScreepsAutocomplete
folder 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 References
which will populate the file and make autocomplete avaliable.
Sublime Text
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
- InstallTernJS
throughPackage 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
- InstallSublimeCodeIntel
throughPackage Control
. Go toPreferences > Package Settings > SublimeCodeIntel > Settings -- User
and copy the contents ofScreepsAutocomplete/config/SublimeCodeIntel.json
in to the file that opens. Save and restart Sublime Text. After waiting for CodeIntel to process JavaScript, Autocomplete should be working
Atom
Integration with Atom is done through use of the atom-ternjs
package. Here's the steps
- Copy
ScreepsAutocomplete
in to your project folder - Install the
atom-ternjs
package - Put the following in your
.tern-project
file
{
"ecmaVersion": 6,
"libs": [],
"loadEagerly": [
"ScreepsAutocomplete/**/*.js"
]
}
- Restart and Enjoy