Godot: Autocompletion Service Support for external text editors

21

Allow for external editor to connect to a specific port for GDScript code completion.
for instance, when the editor is on an editor plugin could send a request in the form of:
http://localhost:9999/auto_complete?postions=position with the buffer as the post buffer.
In return get a json list of available completions from the internal analyzer.
This will allow the use of external editors without having to explicitly support them.

It could even be implemented in a simpler manner with sockets and a bi-directional json steam

ficoos picture ficoos  ·  9 Jul 2015

Most helpful comment

27

Just wanted to give a signal boost and to say that since this was submitted Microsoft came out with the Language Server Protocol to solve this exact problem.

ficoos picture ficoos  ·  13 Mar 2017

All comments

0

is there any kind of standard on this?

On Thu, Jul 9, 2015 at 9:32 AM, Saggi Mizrahi [email protected]
wrote:

Allow for external editor to connect to a specific port for GDScript code
completion.
for instance, when the editor is on an editor plugin could send a request
in the form of:
auto_complete(file_buffer, position) and get a list of available
completions from the internal analyzer.
This will allow the use of external editors without having to explicitly
support them.


Reply to this email directly or view it on GitHub
https://github.com/okamstudio/godot/issues/2245.

reduz picture reduz  ·  9 Jul 2015
0

Not that I am aware of.
Most text editors allow you to write your own code completion plugins but they are always mutually incompatible.

That is why I suggested implementing the server side only and letting the community contribute the plugins.

They all generally look like:
get_completions_at(string buffer, int position)
Where the result is something like

{
   display_text: string
   completion_value: string
   type: enum(function, variable, etc....)
}

sublime api
YCM api (for vim)
clang_completer
intellij CompletionContributor

ficoos picture ficoos  ·  9 Jul 2015
0

:+1:

bojidar-bg picture bojidar-bg  ·  17 Jul 2015
1

Yeah i guess this would probably be not that difficult to implement
On Jul 9, 2015 5:00 PM, "Saggi Mizrahi" [email protected] wrote:

Not that I am aware of.
Most text editors allow you to write your own code completion plugins but
they are always mutually incompatible.

That is why I suggested implementing the server side only and letting the
community contribute the plugins.

They all generally look like:
get_completions_at(string buffer, int position)
Where the result is something like

{
display_text: string
completion_value: string
type: (function, variable, etc....)
}

sublime api
http://sublime-text-unofficial-documentation.readthedocs.org/en/latest/reference/api.html#sublime_plugin.EventListener.on_query_completions
YCM api (for vim)
https://github.com/Valloric/ycmd/blob/master/ycmd/completers/completer.py
clang_completer
http://clang.llvm.org/doxygen/group__CINDEX__CODE__COMPLET.html#ga50fedfa85d8d1517363952f2e10aa3bf
intellij CompletionContributor
https://github.com/JetBrains/intellij-community/blob/master/platform/lang-api/src/com/intellij/codeInsight/completion/CompletionContributor.java


Reply to this email directly or view it on GitHub
https://github.com/okamstudio/godot/issues/2245#issuecomment-120016909.

reduz picture reduz  ·  17 Jul 2015
0

+1

fazjaxton picture fazjaxton  ·  21 Jul 2015
0

I'd like to see this. Would be up for helping to create it. Is there somewhere we can keep track of this besides here? The issues on this repo are getting out of hand as there is so many open.

crr0004 picture crr0004  ·  4 Sep 2015
0

I would be glad to help too, but would like some direction about how the Godot developers think it should be implemented. I would love to have this for my editor.

fazjaxton picture fazjaxton  ·  4 Sep 2015
0

Sounds like a useful feature. It should probably be tracked in a task on OpenProject @reduz.

akien-mga picture akien-mga  ·  11 Nov 2015
1

I made a module for this. You can find it here: https://github.com/neikeq/gd-autocomplete-service

neikeq picture neikeq  ·  12 Dec 2015
2

If we intend to add something like this to this repository, the main problem I faced was extracting parts of the code that was required for code completion from TextEditor, ScriptTextEditor and other places (can't remember), to put them in a single class that would provide these suggestions. This was the result: https://github.com/neikeq/gd-autocomplete-service/blob/master/autocomplete_service/code_completion_service.cpp

neikeq picture neikeq  ·  5 Mar 2016
0

I would actually make it part of the engine... the script API already contains abstract functions for this, but you likely need to add this code in the script text editorfor better context.

reduz picture reduz  ·  5 Mar 2016
0

What's the status on this? Isn't this something that was already implemented, or do I misunderstand it?

akien-mga picture akien-mga  ·  21 Jul 2016
0

This is already done as a module, but @reduz mentioned above that he would prefer it to be part of the engine. If that's going to happen, it would need some refactoring (I could try doing it) since as shown in this source file I had to duplicate code from different parts that were not exposed for this kind of usage or that were hard coded in classes like TextEdit.

neikeq picture neikeq  ·  21 Jul 2016
0

Alright @neikeq I'm very interested in this, how can I help? I would like this to be included in godot so people that want completion don't have to recompile the thing. I am looking into ways to add autocompletion to vim/neovim with YCMD and your module. So what exactly needs refactoring?

razcore-art picture razcore-art  ·  29 Oct 2016
1

+1

PLyczkowski picture PLyczkowski  ·  19 Dec 2016
0

:+1: This would be a huge advancement for workflows using neovim or vim. Or Atom, even, if you're into that.

rosshadden picture rosshadden  ·  30 Jan 2017
27

Just wanted to give a signal boost and to say that since this was submitted Microsoft came out with the Language Server Protocol to solve this exact problem.

ficoos picture ficoos  ·  13 Mar 2017
0

A completer for ycm would be really great. Currently there are clients for the following editors:

  • Vim
  • Emacs
  • Atom
  • Sublime
  • Kakoune
  • Visual Studio
  • Geany
  • GNU Nano

With neikeq module already existing, this looks like a low hanging fruit.

BonaBeavis picture BonaBeavis  ·  25 Apr 2017
0

It sounds like integrating this into the engine might give anyone that adds their own language through GDNative the ability to additionally add their own completion support, instead of it just being for GDScript. Which would be a huge win!

rosshadden picture rosshadden  ·  21 Jul 2017
10

Just wanting to add that LSP (Language Server Protocol) is become a more widely adopted standard now and that it is probably the best way forward for this. Atom recently announced Atom IDE which is built around LSP and GNOME Builder have had integrations built around it for a year or so.

nsrosenqvist picture nsrosenqvist  ·  9 Oct 2017
0

Great! We've been talking about YCM a lot but that's just an implementation detail. Supporting any thing like LSP or YCM will be a very big milestone for external editor workflows.

rosshadden picture rosshadden  ·  10 Oct 2017
5

Microsoft also have the debugger adapter protocol for VSCode (also what Atom plans to use) which is the debugger equivalent of LSP. Link to repo: https://github.com/Microsoft/vscode-debugadapter-node

nsrosenqvist picture nsrosenqvist  ·  12 Oct 2017
-18

Dead? :confused:

emersonmx picture emersonmx  ·  24 Jan 2018
11

Bump. I don't mind using the built in editor but a LSP server would be a game changer.

Anudin picture Anudin  ·  2 Apr 2019
10

This would be a huge win for Godot, IMO. I appreciate the effort put into the built-in editor but I'd rather use the editors I work with on a daily basis. An LSP would help in enabling that type of workflow.

I'd be happy to help contribute to this effort!

obsoke picture obsoke  ·  2 Apr 2019
8

Seems that there is a GSOC project that will bring LSP support to Godot.

https://summerofcode.withgoogle.com/organizations/6553848640962560/#6258227275104256

Some very preliminary extension for VSCode it is online:

https://marketplace.visualstudio.com/items?itemName=AnkitPriyarup.gdscript-lsp-extension#overview

zohozer picture zohozer  ·  13 Jun 2019
0

I can try implementing this, sounds relatively simple

creikey picture creikey  ·  16 Jul 2019
5

@creikey This is already being worked on in https://github.com/godotengine/godot/pull/29780.

Calinou picture Calinou  ·  16 Jul 2019
0

Are there any developments? I've tried to add @neikeq module's to godot 3.1.2 but i've run into an unrecognised type while building

Lorespo picture Lorespo  ·  13 Dec 2019
1

Fixed by #29780.

akien-mga picture akien-mga  ·  13 Dec 2019