cxxxr / cl-lsp

An implementation of the Language Server Protocol for Common Lisp
MIT License
216 stars 26 forks source link

Formatting doesn't do anything #26

Closed LordMZTE closed 1 year ago

LordMZTE commented 1 year ago

I'm using the server in neovim; when I format, nothing happens.

This is printed to the log file:

<INFO> [16:06:19] lem-language-server method.lisp (log-request) -
 textDocument/formatting: {"options":{"insertSpaces":true,"tabSize":4},"textDocument":{"uri":"file:///home/lordmzte/dev/clisp/coin_toss.lisp"}}
<INFO> [16:06:19] lem-language-server method.lisp (log-response) -
 textDocument/formatting: []

The code will remain unchanged even tho it has some very obvious improper formatting.

cxxxr commented 1 year ago

Thank you for reporting this. Would it be possible for you to post the contents of the code here?

LordMZTE commented 1 year ago

Sure, here's some very badly formatted lisp code which doesn't change when formatting.

(defpackage coin-toss
  (:use :cl)
  (:export toss-coin))
(in-package :coin-toss)

(defun toss-coin ()

  0)

Here's also how I configured nvim-lspconfig to use cl-lsp (in fennel). Might be useful.

(tset lsp-configs :cl-lsp {:default_config {:cmd [:cl-lsp]
                                            :filetypes [:lisp]
                                            :root_dir lspc.util.find_git_ancestor
                                            :single_file_support true}
                           :settings {}})
(lspconfig.cl-lsp.setup {})
cxxxr commented 1 year ago

Thank you very much. Is the expected behavior to remove whitespace? The current behavior only does line indentation.

LordMZTE commented 1 year ago

Oh I see, I was expecting removal of many consecutive lines and also split up long lines.

Indentation appears to work.

cxxxr commented 1 year ago

Ideally, it would be better to remove the blanks as well. Thanks for the feedback.