nvim-lua / lsp-status.nvim

Utility functions for getting diagnostic status and progress messages from LSP servers, for use in the Neovim statusline
MIT License
625 stars 41 forks source link

How to use #13

Closed amikai closed 4 years ago

amikai commented 4 years ago

The example only clangd and pyls_ms. How to setup in gopls?

wbthomason commented 4 years ago

Most language servers will just work out of the box. clangd and pyls_ms are special cases because they use non-standard protocol extensions for messaging. If gopls also does this, please feel free to open a new issue (or ideally a PR) to add support for the necessary extensions.

Most setup is like the example shown in https://github.com/nvim-lua/lsp-status.nvim#all-together-now, which you can also piece together by following the steps in https://github.com/nvim-lua/lsp-status.nvim#example-use. Look at the setup for ghcide and rust-analyzer:

nvim_lsp.ghcide.setup({
  on_attach = lsp_status.on_attach,
  capabilities = lsp_status.capabilities
})
nvim_lsp.rust_analyzer.setup({
  on_attach = lsp_status.on_attach,
  capabilities = lsp_status.capabilities
})

The important parts for standard LSP servers are (1) calling lsp_status.on_attach in the server's on_attach function, and (2) including lsp_status.capabilities in the server's capabilities table.

I hope this helps; feel free to re-open the issue if you're still confused.

jackpeters667 commented 2 years ago

@wbthomason hi there, total lua noob here but if I'm already using capabilities from elsewhere (a completion engine) am I able to use both in this case? Sorry to revisit an old issue