godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.1k stars 20.2k forks source link

Autocompletion Service Support for external text editors #2245

Closed ficoos closed 4 years ago

ficoos commented 9 years ago

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

reduz commented 9 years ago

is there any kind of standard on this?

On Thu, Jul 9, 2015 at 9:32 AM, Saggi Mizrahi notifications@github.com 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.

ficoos commented 9 years ago

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

bojidar-bg commented 9 years ago

:+1:

reduz commented 9 years ago

Yeah i guess this would probably be not that difficult to implement On Jul 9, 2015 5:00 PM, "Saggi Mizrahi" notifications@github.com 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.

fazjaxton commented 9 years ago

+1

crr0004 commented 9 years ago

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.

fazjaxton commented 9 years ago

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.

akien-mga commented 8 years ago

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

neikeq commented 8 years ago

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

neikeq commented 8 years ago

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

reduz commented 8 years ago

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.

akien-mga commented 8 years ago

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

neikeq commented 8 years ago

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.

razcore-rad commented 7 years ago

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?

PLyczkowski commented 7 years ago

+1

rosshadden commented 7 years ago

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

ficoos commented 7 years ago

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.

GordianDziwis commented 7 years ago

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

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

rosshadden commented 7 years ago

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!

nsrosenqvist commented 6 years ago

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.

rosshadden commented 6 years ago

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.

nsrosenqvist commented 6 years ago

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

emersonmx commented 6 years ago

Dead? :confused:

Anudin commented 5 years ago

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

obsoke commented 5 years ago

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!

zohozer commented 5 years ago

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

creikey commented 5 years ago

I can try implementing this, sounds relatively simple

Calinou commented 5 years ago

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

Lorespo commented 4 years ago

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

akien-mga commented 4 years ago

Fixed by #29780.