Code Monkey home page Code Monkey logo

Comments (14)

jcs090218 avatar jcs090218 commented on June 3, 2024

It looks strange. I'm going to ping who originally implemented this feature.

cc @RuijieYu @xiliuya

from emacs-gdscript-mode.

RuijieYu avatar RuijieYu commented on June 3, 2024

Since Emacs has figured out the 6008 port, it seems that the function I added has finished successfully. Can you use something like netstat (not sure if Mac has this program or any alternatives to it) to verify that Emacs indeed makes a connection to port 6008?

Other than that, I have no clue -- I only based my work on mailing list discussions and my reading of some Emacs documentation, and don't have much experience in the internals of eglot.

from emacs-gdscript-mode.

xiliuya avatar xiliuya commented on June 3, 2024

Hello, @bbbscarter
The automatic eglot configuration in the current version has not been tested on Macos,
You can check ~/.config/godot/editor_settings-4.tres exists.
If not exists , to find editor_settings-4.tres in what directories, and then we can fix this program.

from emacs-gdscript-mode.

xiliuya avatar xiliuya commented on June 3, 2024

Using emacs 29.1 and Godot 4.1 on MacOS, configured to use port 6008.

eglot connects to the Godot instance, but doesn't do anything - and then times-out after 30 seconds.
By contrast, lsp-mode connects and continues working, albeit with a warning: "Unknown notification: gdscript/capabilities"

eglot-stderr-buffer shows nothing, with "No current JSON-RPC connection".

@bbbscarter
Can you disable lsp-mode and shutdown lsp-mode's connection.
Then test eglot ?
Or you can just use eglot.

from emacs-gdscript-mode.

bbbscarter avatar bbbscarter commented on June 3, 2024

Yup, to confirm on both these points:

  • The gdscript-eglot-contact method is failing on Mac. (On MacOS, Godot's config isn't in
    ~/.config referenced in that function, it's in ~/Library/Application Support/Godot/). I manually hacked eglot-server-programs to point to localhost:6008.

  • I can confirm this was failing without LSP - I only installed LSP when I couldn't get eglot to work.

  • Also, it definitely makes the initial connection - the client connection is logged in the Godot console, and the capabilities are sent back Emacs, as shown in the log above. However it times out 30 seconds later for some reason.

I'm not particularly familiar with debugging lsp servers in general, or eglot specifically - but if someone can tell me where to start I'm happy to give it a go!

from emacs-gdscript-mode.

xiliuya avatar xiliuya commented on June 3, 2024

@bbbscarter
You can debug LSP relevant .

  • You can use wireshark to capture Lookback: lo packets and check if there are corresponding messages in godot lsp.
  • Modify X11-> Json by selecting "Decode as" in the right-click menu.
  • Check Tcp package has "Transmission Contorl Protocol, Src Port: 6008 Dist:xxx" After eglot's request.
  • Compare the differences between the corresponding messages of lsp-mode and eglot

from emacs-gdscript-mode.

bbbscarter avatar bbbscarter commented on June 3, 2024

Okay - done that, and attached the results. The main obvious difference is that the initialisation payload is very different between LSP and eglot, but not sure if that's relevant.

I've pulled out the relevant JSON sections below.

eglot.txt
lsp.txt

wireshark.zip

from emacs-gdscript-mode.

xiliuya avatar xiliuya commented on June 3, 2024

@bbbscarter
I think this is because the last request package did not send content in json-rpc format.
Please confirm if the eglot version is too low, and then you can send an error report to report-emacs-bug
On my machine, the following compiled versions are available.

In GNU Emacs 29.1.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.17.8) of 2023-07-31 built on xiliuya-pc
Repository revision: 525d05c1b8ac54a4f7ad166b97f2fa913f80e73c
Repository branch: makepkg
System Description: Arch Linux

from emacs-gdscript-mode.

xiliuya avatar xiliuya commented on June 3, 2024

@bbbscarter
To debug eglot , you can edebug-defun eglot--connect, in the following areas:

                    :success-fn
                      (eglot--lambda ((InitializeResult) capabilities serverInfo)
                        (unless canceled
                          (push server
                                (gethash project eglot--servers-by-project))
                          (setf (eglot--capabilities server) capabilities)
                          (setf (eglot--server-info server) serverInfo)
                          (jsonrpc-notify server :initialized eglot--{})

from emacs-gdscript-mode.

bbbscarter avatar bbbscarter commented on June 3, 2024

I was running the version that comes with emacs 29.1 - 1.12.29.

I've just upgraded eglot to 1.15 and I'm getting the same behaviour.

I will see if I get anywhere with edebug.

from emacs-gdscript-mode.

bbbscarter avatar bbbscarter commented on June 3, 2024

Tried both edebug, and adding logging messages to eglot--connect - neither the succed-fn nor the error-fn callbacks are being called, only the timeout-fn.

(I also checked that they are being called in other eglot connections, such as csharp, and they are).

from emacs-gdscript-mode.

xiliuya avatar xiliuya commented on June 3, 2024

@bbbscarter
You can tracking stack information timeout-fn(edebug-mode key 'd').
And based on your packet capture information, for some reason, the 'initialized' packet that eglot should have sent was not generated correctly on your machine.

(:jsonrpc "2.0" :method "initialized"

This may be the problem, I think you should provide bug reports to emacs maill list.

from emacs-gdscript-mode.

xiliuya avatar xiliuya commented on June 3, 2024

I think maybe this code has problem:

(with-eval-after-load 'eglot
  (defvar eglot-server-programs)
  (push (cons 'gdscript-mode #'gdscript-eglot-contact)
        eglot-server-programs))

Can you test to eval:


(setq eglot-server-programs (list (cons 'gdscript-mode  #'gdscript-eglot-contact)))

Then try again.

from emacs-gdscript-mode.

bbbscarter avatar bbbscarter commented on June 3, 2024

Since gdscript-eglot-contact doesn't work for me, in order to connect I'm already setting that list directly (in my case to ("localhost" 6008). As it is, I think the existing line should work - push will put it at the front of the list, which in an alist will override later entries.

In any case, I think you're correct - this looks like it's either an eglot problem, or a Godot problem. I'll fire something over to the emacs lists.

Thanks!

Simon

from emacs-gdscript-mode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.