Using VIM and Language Server

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By julkip

I was wondering, if anyone got the Language Server working with VIM and could provide step by step instructions on how to get it up and running.
So far I have not found any good instructions for this topic.

:bust_in_silhouette: Reply From: Calinou

Try using Godot 3.2.2 and vim-godot.

(Godot 3.2.2 switched its LSP implementation from WebSockets to LSP, which is compatible with more editors out there.)

I have already found those links, but unfortunately there is no mention at all on how to configure it all.

julkip | 2020-07-02 22:28

I created an issue to ask for installation instructions, but in the meantime, I guess you should try cloning the repository into your Vim plugins folder. You could also use a plugin manager such as vim-plug to make this more convenient.

Calinou | 2020-07-03 14:08

@Calinou, I have updated docs there + added coc.nvim setup example

habamax | 2020-07-06 07:45

LSP implementation was switched from WebSockets to TCP. Switched the language server from websockets to TCP by ofrank123 · Pull Request #35864 · godotengine/godot · GitHub

habamax | 2020-07-06 07:54

The documentation in the coc wiki was was missing the “gdscript” filetype in it’s documentation. I have added it there in hopes that that mitigates some confusion.

hungLink | 2022-11-17 20:43

:bust_in_silhouette: Reply From: idbrii

I use vim-lsp with vim-lsp-settings. vim-lsp-settings has configuration for godot so you don’t need to configure it.

vim-lsp recommends asyncomplete.vim+asyncomplete-lsp.vim for autocompletion but also supports omnifunc.

Installing those four plugins should be all you need to get it working. With vim-plug:

Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-lsp.vim'

You can check that it’s working with :LspStatus (it should say “godot: running”).

For Godot 4, you’ll also need this setting in your vimrc until this PR is merged:

let g:lsp_settings = {}
let g:lsp_settings.godot = { 'tcp': '127.0.0.1:6005'}