nobody-famous / alive-lsp

Language Server Protocol implementation for use with the Alive extension
73 stars 8 forks source link

Thoughts On Extending This For Use Outside Of Alive? #31

Open Gavinok opened 2 years ago

Gavinok commented 2 years ago

Not so much an issue but curious what your thoughts are on having the lsp function with other editors? Not really saying you need to support that use case directly but wondering how specific to vsCode the alive LSP is?

I was able to connect it to emacs via eglot. All I did was load the alive-lsp project evaluate and evaluate

(alive/server::start :port 6008)

from the lisp repl and

(push '(lisp-mode . ("localhost" 6008)) eglot-server-programs)

in emacs then type M-x eglot and boom. Not everything is working but at least completion is as seen bellow.

2022-09-29_13-33-18

nobody-famous commented 2 years ago

I think the only thing that might be VSCode specific are the snippets returned with completions. I don't remember if the spec gives instructions on those or not. Other than that, it's not specific. The main issue is that it uses a lot of non-standard messages for the REPL and whatnot, so there would need to be a client side done for the other editors to handle those.

The list of messages is here,

https://github.com/nobody-famous/alive-lsp/blob/a5108669e1150f1874719eeb1e86109285d609d3/src/session.lisp#L835

The parameters they take, and exactly what they return, would be a little more work to figure out and document.

jcs090218 commented 7 months ago

Added the support to lsp-mode, see https://github.com/emacs-lsp/lsp-mode/pull/4385.

jcs090218 commented 6 months ago

It's currently out of box. You only need to download and install the language server.

fkinosh commented 6 months ago

@jcs090218 Awesome! I'm just having a bit of trouble making it start automatically when opening a .lisp file. I've tried adding this like taken from the initial commit 559db8d but didn't seem to help:

  (use-package lsp-mode
    :hook ((c-mode lisp-mode) . lsp-deferred) ;; also not sure which name I should use here
    :commands lsp                             ;;  is "lisp-mode" correct?
    :config
    (add-hook 'lisp-mode-hook #'lsp-lisp-alive-start-ls) ;; this line from initial commit
jcs090218 commented 6 months ago

Make sure your server is up and running, or else it won't work. Try to start the language server manually.

PHRaposo commented 6 months ago

I'm trying to connect alive-lsp to Max with the object jit.net.send.

I know it should be much more complicated than this, but when I start the patch something happened (I don't know what or why).

Screenshot:

UDP-MAX-LISP

When I close Max I got the following error:

debugger invoked on a SB-PCL::NO-APPLICABLE-METHOD-ERROR in thread

<THREAD tid=12264 "Session Message Reader" RUNNING {1002E3DC33}>:

There is no applicable method for the generic function

<STANDARD-GENERIC-FUNCTION ALIVE/SERVER::SESSIONS (1)>

when called with arguments (NIL). See also: The ANSI Standard, Section 7.6.6

The current thread is not at the foreground, SB-THREAD:RELEASE-FOREGROUND has to be called in #<SB-THREAD:THREAD tid=14264 "main thread" RUNNING {10042C01C3}> for this thread to enter the debugger.

Any ideas?

Max support Json scripts as well, so maybe something can be done in that way.