lite-xl / lite-xl-lsp

LSP Plugin for Lite XL editor
MIT License
159 stars 21 forks source link

Error? trying to run gopls.exe #134

Open dineth-lochana opened 3 months ago

dineth-lochana commented 3 months ago

Hello, I've built gopls from scratch and installed lite-xl-lsp as described in the repo. It doesn't seem to be working for me. Running 'gopls' from my cmd starts it up. So that seems to be it.

image

I have this in my init.lua " local lspconfig = require "plugins.lsp.config" lspconfig.gopls.setup() "

I have not added anything to my config.lua in lsp

OS := Windows 10 LTSB 64 Bit Lite-Xl Version:= 2.1.1

dineth-lochana commented 3 months ago

lspconfig.gopls = add_lsp { name = "gopls", language = "go", file_patterns = { "%.go$" }, command = { "gopls", "serve" }, verbose = true, quit_timeout = 180 }

I've change my config to this, and now I get this image

It seems to be stuck reloading still.. Sigh...

dineth-lochana commented 3 months ago

I though that recent gopls versions might have done something to break compatability, so I tried to build and use gopls 0.14, 12, and 10 but no cigar, they all keep restarting everytime I do something.

dineth-lochana commented 3 months ago

Honestly pretty stumped by now.

dineth-lochana commented 3 months ago

https://github.com/lite-xl/lite-xl-lsp/issues/43 The same issue seems to be visible here as well. Seems that seems to be unsolved. Welp...

dineth-lochana commented 3 months ago

https://github.com/lite-xl/lite-xl-lsp/issues/31 Then again this shows gopls from working, so my idea is to use gopls and lite-xl-lsp from around 2022 to see if that's the case.

dineth-lochana commented 3 months ago

gopls/v0.9.5 Gopls 9.5 works! but only it seems to work! Gopls 10.x and onwards don't seem to work at all for me, can anybody else confirm this

Guldoman commented 3 months ago

My first guess: you're on windows, what happens if you use .exe after the name? Is the gopls executable an actual executable? Is it a batch script?

dineth-lochana commented 3 months ago

When I use both gopls and gopls.exe it starts and waits for input. I even moved the exe around a few directories in my PATH to make sure it wasn't a problem. I built all the versions from source manually to an exe, and kept them all in my local Go -> bin directory.

image

I checked what the gopls command is calling

image

This is the exe it calls.

image

Guldoman commented 3 months ago

If you set config.plugins.lsp.log_server_stderr = true, do you get more output?

dineth-lochana commented 3 months ago

image I set it like this

image Ooh! It looks like it works now!

What I changed was, I switched back from go 1.22.5 to go 1.20.14. gopls warns me about it as well. I'm not sure if that was what made it all work, but it seems to work ok now...

dineth-lochana commented 3 months ago

I'll test again with Go 1.22.5 when I get the chance.