godotengine / emacs-gdscript-mode

An Emacs package to get GDScript support and syntax highlighting.
GNU General Public License v3.0
306 stars 35 forks source link

Which features would you like to see? #47

Closed NathanLovato closed 1 year ago

NathanLovato commented 4 years ago

If you would like to suggest and discuss features to add to the package, this is the place to do so. We now have all the essentials in place, and more features provided by the language server protocol.

NathanLovato commented 4 years ago

My main idea and wish would be to two refactoring commands to turn a value (selected region) into either a local or a file variable.

Source problem

When prototyping, we often write hard-coded values that we might want to turn into parameters later.

Here's an example of an animation with a hard-coded duration:

func some_function():
    get_node("Tween").interpolate_property(self, "position", position, target_position, 1.0)

Often times I see myself needing to turn the code into something like:

export var tween_duration = 0.6

func some_function():
    get_node("Tween").interpolate_property(self, "position", position, target_position, tween_duration)

Solution

A command that turns the region into a variable, either local to the function or block, or as a class property.

otavioschwanck commented 4 years ago

I started a doom emacs integration:

https://github.com/hlissner/doom-emacs/pull/3265/files

My two wishes are:

1 - Goto definition 2 - Integration with lsp (language server protocol). Any chance to integrate with lsp-mode and lsp-ui ?

NathanLovato commented 4 years ago

I started a doom emacs integration:

I opened a PR for that 4 days ago already: https://github.com/hlissner/doom-emacs/pull/3239

2 - Integration with lsp (language server protocol). Any chance to integrate with lsp-mode and lsp-ui ?

It's already supported by lsp-mode. It's not something we could have in this repo, the language server is on Godot itself, and the client is in the lsp-mode package.

Jump to definition should be supported by lsp

rileyrg commented 4 years ago

I would like the ability to suppress the status window that opens whenever I run a gdscript function eg gdscript-godot-run-project gives:. Screenshot from 2020-08-02 13-50-34

rileyrg commented 4 years ago

I started a doom emacs integration:

I opened a PR for that 4 days ago already: hlissner/doom-emacs#3239

2 - Integration with lsp (language server protocol). Any chance to integrate with lsp-mode and lsp-ui ?

It's already supported by lsp-mode. It's not something we could have in this repo, the language server is on Godot itself, and the client is in the lsp-mode package.

Jump to definition should be supported by lsp

I just tried lsp with gdscript mode. Would you mind sharing your config? I keep getting warnings galore in another pop up buffer that wont go away. I've been using lsp with other languages without issue so I dont think its my config per se.

eg

Warning (lsp-mode): Unknown notification: gdscript_client/changeWorkspace Warning (lsp-mode): Unknown notification: gdscript/capabilities Warning (lsp-mode): Unknown notification: nil Warning (lsp-mode): Unknown notification: nil Warning (lsp-mode): Unknown notification: nil Warning (lsp-mode): Unknown notification: nil Warning (lsp-mode): Unknown notification: nil Warning (lsp-mode): Unknown notification: nil Warning (lsp-mode): Unknown notification: nil Warning (lsp-mode): Unknown notification: nil Warning (lsp-mode): Unknown notification: nil Warning (lsp-mode): Unknown notification: nil Warning (lsp-mode): Unknown notification: nil Warning (lsp-mode): Unknown notification: nil Warning (lsp-mode): Unknown notification: nil Warning (lsp-mode): Unknown notification: nil Warning (lsp-mode): Unknown notification: nil

NathanLovato commented 4 years ago

@rileyrg for LSP, the problem has to do with the server in Godot, that uses nonstandard notifications. We discussed sponsoring @ofrank123 to work on fixing these, but I don't know the task's status right now.

If he's unavailable, maybe we could see if someone else is available to work on the Godot language server.

rileyrg commented 4 years ago

@rileyrg for LSP, the problem has to do with the server in Godot, that uses nonstandard notifications. We discussed sponsoring @ofrank123 to work on fixing these, but I don't know the task's status right now.

If he's unavailable, maybe we could see if someone else is available to work on the Godot language server.

OK, so the bottom line is it's not really usable atm. Without lsp working properly I am guessing we have no real company completion on objects/classes which is a bit of a "no go" for me since I am new to Godot (I'm rather impressed at how easily I complied to from source I must say). I'll have a play around as I certainly would like to use emacs with godot and if I can contribute anything I surely will.

ofrank123 commented 4 years ago

Hey @rileyrg I'm familiar with the gdscript/* notification errors, but I haven't seen the Unknown notification: nil and cannot reproduce with my current version. If I could get a little more info about your current development environment/steps to reproduce that'd be really helpful. Cheers!

rileyrg commented 4 years ago

I'm running latest (release level) everything via straight.el. My config here :

https://github.com/rileyrg/Emacs-Customisations

But in fairness I just ran lsp with a dot projectile file in the root. It seemed to know what it was doing (found godot) . I can't check now but if there's anything specific I can do let me know.

Unfortunately (!) the vscode integration with godot is so good I don't think we (emacs) can compete. The gdscript debugger in godot is rudimentary to say the least while the vscode debugger is much better. Using godot for x, emacs for y and vscode for z is a tad complex. But then I'm a debugger advocate.. No better way to delve into code than stepping through and seeing things change.

On Mon, 3 Aug 2020, 18:39 Oliver Frank notifications@github.com wrote:

Hey @rileyrg https://github.com/rileyrg I'm familiar with the gdscript/* notification errors, but I haven't seen the Unknown notification: nil and cannot reproduce with my current version. If I could get a little more info about your current development environment/steps to reproduce that'd be really helpful. Cheers!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GDQuest/emacs-gdscript-mode/issues/47#issuecomment-668122305, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACYTC6JK33C7LNX5XFGKLTR63R27ANCNFSM4L4XPP5Q .

ofrank123 commented 4 years ago

I understand what you mean about the debugger, I've used the lsp-java debugger (dap) and it works quite well. I will look into adding integration with dap-mode as I don't believe it is java specific or anything. As far as the errors I'm trying to sort them out now, there's some on the godot end and some on the lsp-mode end so it can be tricky.

NathanLovato commented 4 years ago

It's my teammate, @Razoric480, who wrote the Godot debugger integration for VSCode. If needed he could probably share some info on how it works.

And yes it's also possible with Emacs. We already have comint support for errors, you can jump to errors and to the corresponding files. Just not debugger integration.

Razoric480 commented 4 years ago

The Godot transmits through TCP/IP, with a server (the debugger) and a client (the client to be debugged.) The server transmits breakpoints to the client via a message stream that goes "breakpoint file line", and when the client hits one of them, it tells the server "debug_enter" and the reason (whether that's 'exception' or 'breakpoint).

Then the server responds with "get_stack_dump" and the client responds with "stack_dump", the server says "inspect_object" so the client says "message:inspect_object" with the information for said object, so on and so forth.

Visual Studio Code includes an interaction layer with the debugger that extensions can use, dunno how emacs does it but that's how things communicate.

ofrank123 commented 4 years ago

Hey @Razoric480, do you know if Godot follows the DAP? It would be pretty easy if so, as there is already a DAP client written for emacs (dap-mode).

Razoric480 commented 4 years ago

@ofrank123 It does not. Some of the messages look similar, but overrall, no, Godot uses its own messages and data and it doesn't directly translate into the DAP's messages.

NathanLovato commented 4 years ago

It'd be nice if Godot could follow standards closely. When you follow the LSP and DAP specs closely, you can get clients in many editors effortlessly.

The LSP client for gdscript is what, a few dozen lines of code at most?

Razoric480 commented 4 years ago

Most of it is HTML rendering, yeah.

ofrank123 commented 4 years ago

I agree completely, 90% of the problems I've encountered with the LSP have been due to Godot not faithfully implementing the spec. A rewrite of the debugger would not just be quite a bit of work, but the Godot maintainers would almost certainly want backwards compat with the old debugger protocol which just bloats the software more. That being said I'm going to open an issue and discuss switching to DAP.

NathanLovato commented 4 years ago

If there's a time to break compatibility though, Godot 4 is the one.

ofrank123 commented 4 years ago

Best to continue this discussion here