halfbrained / cuda_lsp

LSP Client plugin for CudaText
6 stars 4 forks source link

Problem with redlangserver #106

Open loziniak opened 2 years ago

loziniak commented 2 years ago

When trying to run Red language server on Windows 10, there are error messages:

BodyReadError: LSP: Red - decode error int() argument must be a string, a bytes-like object or a number, not 'NoneType'
ReadLoopError: LSP: Red - local variable 'body' referenced before assignment

More info: a discussion on Red's gitter channel

Alexey-T commented 2 years ago

I installed Red stuff (lang + LSP). confirmed the errors. made this fix: in ~/.config/cudatext/py/cuda_lsp/language.py line 307 changed to

                try:
                    body = self._reader.read(int(headers.get("Content-Length", 4096)))
                    self._read_q.put(header_bytes + body)

But I don't have example Red project to see some info from LSP, on some random Red file I don't see any info. @loziniak Do you see any mouse-hover tooltips? some auto completion? maybe redlangserver needs some config?

Alexey-T commented 2 years ago

On running 'redlangserver.sh' (it's now in /bin here) I got errors from server

user@PC:~$ redlangserver.sh 
*** Script Error: path json-body/id: is not valid for none! type
*** Where: set-path
*** Stack: 
loziniak commented 2 years ago

@loziniak What is the full error log in the console (for 2 errors)?

@hiiamboris ? (nevermind)

Alexey-T commented 2 years ago

As i wrote, I now installed last Red from 30-september and now server don't do this error. but now I get no reply from server! after it runs it dont give reply to Cud.

Alexey-T commented 2 years ago

Now I changed settings/lsp_red.json to

{
  "lexers": {
    "Red": "red"
  },
  "cmd_unix": ["redlangserver.sh"]
}

and LSP works! mouse hover with Ctrl: red1

Alexey-T commented 2 years ago

'Go to definition' works on ast-lines.red ! I click on 'output' in line 10, it jumps to line 8.

loziniak commented 2 years ago

Have you tried it on Windows? If you did something, that I missed in https://github.com/loziniak/cudatext-red , write here or do a PR, thanks.

Alexey-T commented 2 years ago

Not yet, will try it soon on Win10. I wrote info for linux https://wiki.freepascal.org/CudaText_plugins#LSP_server_for_Red

Alexey-T commented 2 years ago

Pls re-install the LSP CLient in CudaText. this is fixed (bug from post 1).

Alexey-T commented 2 years ago

@loziniak Now I use this .cmd file to start Redlangserver:

c:\red\red.exe --cli c:\red\redlangserver\server.red

But then server don't give any replies! LSP plugin don't get any infos. Ball is on your side.

loziniak commented 2 years ago

I'm afraid I can't help much, because I don't use Windows. Maybe @hiiamboris can help?

hiiamboris commented 2 years ago

I have Windows but have no idea how to debug the server or how it works ;)

hiiamboris commented 2 years ago

I've fixed the "errno 10" error. In lsp_red.json: "cmd_windows": ["..full..path..to\\red.exe", "--cli", "..full..path..to\\server.red"] (batch file for some reason doesn't work for LSP) 'hover' command now works for me from the Cuda->Plugins->LSP menu. Not sure what else is supported or how to make it less awkward to use ;)

Go to definition works, even across files sometimes, but haven't figured out yet the logic, when it works and when fails.

Alexey-T commented 2 years ago

(Ctrl + mouse hover over an Id, calls that 'hover' window)

Alexey-T commented 2 years ago

Added the wiki info for Windows, https://wiki.freepascal.org/CudaText_plugins#LSP_server_for_Red

hiiamboris commented 2 years ago

pls mention there that .bat files are not working for LSP, or someone will trip over it ;)

Alexey-T commented 2 years ago

Added to the wiki at the end

Note: don't create .bat or .cmd file with the "red.exe" calling, because it does not work in LSP Client for some reason.