The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

Do You have any advices how to configure lsp server for gdscript in emacs? On module site (https://github.com/godotengine/emacs-gdscript-mode) is only enigmatic:"To use it, you need to install lsp-mode on top of gdscript-mode and configure it. To install and configure lsp-mode, see the lsp-mode documentation."
What does it mean "install lsp-mode on top of gdscript-mode"? Are there any special commands or techniques to do it in emasc? Lsp instalation page says gdscript lsp server must be installed manually and redirects user to main page of godot's github.

If I try 'M-x lsp' in gdscript-mode i receive an error:
LSP :: Failed to connect to localhost:6005 with error message make client process failed: Connection refused, :name, gdscript::tcp, :buffer, nil, :host, localhost, :service, 6005, :nowait, nil, :tls-parameters, nil, :coding, no-conversion

Godot version 3.5.1
in Engine by (94 points)

2 Answers

+1 vote

Changing this to an answer as it evolved

On my install of gdscript, the lsp server had been set to port 6008. This can be changed to 6005 in the editor settings. Once I did this and restarted Godot, gdscript-mode managed to connect to the server. Unfortunately, I cannot claim it is actually working well so far.

Overall, I've given up on connecting the gdscript-mode to the Godot lsp service. Even in the first few minutes of use, it was just too unstable. For clarity, I believe the problems are in gdscript-mode or lsp-mode, not Godot.

by (21 points)

Big Thanks for Your answer.

It confirms what I deduced from lsp-server error I found in emacs day after I asked a question. I've changed the port as You suggested. (I have no idea how to change the port on the emacs-lsp-server).

Part of the problem was that, I supposed, there is no need to start up the engine to use the lsp-server. Im to nooby as a programmer to understand why is that. I suppose lsp-server is some kind of an object, not a library as I thougt, and must be somehow initialized to the memory.

However Godot must be started directly from emasc. If I start the engine from command prompt as usual, it shoots lots of errors, telling me the resource is not initilized and creates empty copy of edited script but with strange name: ".#NameOfTheSript.gd".

Anyway it started to work just fine for Me, even if Emacs with lsp-mode enabled seems to be a little bit slower. Now i think the meaning of "install lsp-mode on top of gdscript-mode" is: 1. Install gdscript-mode. 2. Install lsp-mode. 3. Open script You want to edit in Emacs. 4. Turn on gdscript-mode 5. Start Godot from Emacs. 6. Enable lsp-mode.

Thats it for now. I'm willing to dive the subject deeper beacuse Emacs and Lisp had thrown a charm on me.

+1 vote

There's two solution for this problem:

  1. [Emacs] Change the value of lsp-gdscript-port to 6008 by:

    • Add (setq lsp-gdscript-port 6008) to your config file
    • Change the value using C-h v lsp-gdscript-port
  2. [Godot] Change godot language server port to 6005
    (Editor - Editor settings - General - Language Server - Remote Port)

by (16 points)
edited by

Thank You for the answer.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.