nwolverson / purescript-language-server

MIT License
184 stars 41 forks source link

type information and code formatting with coc and neovim #117

Closed MMesch closed 2 years ago

MMesch commented 3 years ago

I am happily using purescript language server with neovim CoC. It works well but I can't find out how to use some features.

Here are the bindings that I use for these commands:

              " Use K to show documentation in preview window
              nnoremap <silent> K :call Show_documentation()<CR>

              function! Show_documentation()
                if (index(['vim','help'], &filetype) >= 0)
                  execute 'h '.expand('<cword>')
                elseif (coc#rpc#ready())
                  call CocActionAsync('doHover')
                else
                  execute '!' . &keywordprg . " " . expand('<cword>')
                endif
              endfunction

              " Add `:Format` command to format current buffer.
              command! -nargs=0 Format :call CocAction('format')

Any idea? Also, let me know if there is a better place to ask this question.

nwolverson commented 3 years ago

I can't get type information of the symbol under the cursor

To be clear, only top level symbols are supported - but that's the same for autocomplete. In general, if completion works for a given identifier, hover should work, from the POV of the language server.

I'd suggest looking at whatever logging you have of the language server interaction to determine "how far" things get.

triallax commented 3 years ago

I can't get purty to work with the standard bindings. The :Format or CocAction('format') command simply doesn't do anything, although it works when I do %!purty format %` manually.

That's odd; it works just fine for me. I'll investigate later.

nwolverson commented 2 years ago

Any update on this issue? I don't think there's a language server issue here, as such I will close if there is no update

triallax commented 2 years ago

As for me, since then I've moved to Neovim's built-in LSP client, so I can't really check anything.

@MMesch did you check out https://github.com/leighman/coc-purty?

nwolverson commented 2 years ago

purty (or the 2 other formatters) should be supported via the language server with standard formatting request - and are known to work if they are available in your path - so any issues are likely to be in LSP client configuration - and if there is an issue in the language server, I would need a communication log to investigate that.

I know formatting is working with neovim builtin lsp client & this server, at the least, not sure if someone is using it with coc.nvim and can suggest config.

triallax commented 2 years ago

purty (or the 2 other formatters) should be supported via the language server with standard formatting request

Yeah, I figured that out just before you sent your message. :)

nwolverson commented 2 years ago

Closing for lack of follow up & reported working by another user; @MMesch if you still have an issue please feel free to re-open, prefererably with a LSP communication log showing the issue.

MMesch commented 2 years ago

Hey, just checked and it works now after some updates. Sorry for not following up directly.