ScreepsAutocomplete
ScreepsAutocomplete copied to clipboard
Using with neovim
Any pointers on how to use this with neovim? I am currently using deoplete as an auto-complete plugin, and I have LanguageClient that uses language server protocol (this is where I get javascript support from right now).
I am a little new with the above tools, and could use a little guidance. Also (neo)vim seems to be missing from your set of supported editors.
I just got deoplete auto-completion working with neovim using TernJS. First I roughly followed this guide to setup neovim as a javascript IDE. The lines I added to ~/.config/nvim/init.vim
were these in particular.
"Javascript Plugins
Plug 'carlitux/deoplete-ternjs'
Plug 'ternjs/tern_for_vim', { 'do': 'npm install && npm install -g tern' }
let g:tern_request_timeout = 1
let g:tern_request_timeout = 6000
let g:tern#command = ["tern"]
let g:tern#arguments = ["--persistent"]
It's worth noting I had to run sudo npm install -g tern
manually to get this to work. Setting up tern globally is optional but as simple as creating a global config in ~/.tern-config
that contains
{
"plugins": {
"node": {}
}
}
at this point TernJS started giving me JavaScript auto-completion. To get auto-completion for Screeps I cloned this repo to create path/to/scripts/ScreepsAutocomplete/
and created a local tern config in path/to/scripts/.tern-project
that contains
{
"ecmaVersion": 6,
"libs": [],
"loadEagerly": [
"ScreepsAutocomplete/**/*.js"
]
}
see the TurnJS Manual for more information. After that Auto-completion worked. I know I'm a little over 2 years late. Hopefully I have at least pointed anyone reading this in the right direction. I'm currently using Debian testing so if your on Windows or MacOS, I have zero idea if any of this even remotely helpful. But, I wish you luck.
Edit: I didn't realize before, but the Atom editor also uses TurnJS so this is more supported than I thought. Adding these instructions to the README and making sure they work on other OS's would be helpful for neovim support.
I'll also chime in with a solution that worked for me (in coc.nvim). I installed type definitions for Screeps using npm (npm install --save @types/screeps
), and the language server picked up on it immediately. Now I get Screeps-related auto-completion and documentation in vim. 🎉
npm install --save @types/screeps
This installs screeps/screeps and not Garethp/ScreepsAutocomplete. It worked for me but it's an entirely different project. Two questions come to mind:
- Isn't screeps/screeps outdated? Garethp/ScreepsAutocomplete has newer commits.
- If screeps/screeps isn't outdated and works fine then what's the point of Garethp/ScreepsAutocomplete?
I know nothing about npm
and JS frameworks. My JS experience is with vanilla only. I use typescript-language-server because it came with my NeoVim install. I have no idea how it works and how to make this project work with it.
Isn't screeps/screeps outdated? Garethp/ScreepsAutocomplete has newer commits.
I have no idea, but I haven't done active development on this project in a long long time. The newer commits that you see are contributions from other people, which I welcome and do merge in. I can't say if my project is out of date or not because it's been a long time since I've played screeps
If screeps/screeps isn't outdated and works fine then what's the point of Garethp/ScreepsAutocomplete?
This project predates screeps/screeps
by about two years. In fact, I basically stopped playing before that one even came out. If it were out at the time that I was playing, I probably would have just contributed to them instead
OK, thank you for clarifying that. Upon further investigation it seems both projects are up to date, they just install differently.