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
621 stars 41 forks source link

Split out lsp progress section #58

Closed akinsho closed 3 years ago

akinsho commented 3 years ago

This relates to #30 and exposes the progress section of the lsp status so it can be used separately

Shatur commented 3 years ago

How can I use it to get only LSP progress?

akinsho commented 3 years ago

local status = require('lsp-status').status_progress()

The README needs some love generally I think since none of the component functions are documented this change included πŸ˜…

Shatur commented 3 years ago

@akinsho, thank you! But can I somehow remove this part and leave only progress? ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅

When I typing it just blinks from idle to queued. Super annoying :D

akinsho commented 3 years ago

@Shatur95 this PR was just about separating the messages from the diagnostics and other symbols. There's probably value in maybe just allowing a user to specify a formatter function and then they can construct the string themselves as they like. I'm not familiar with actual message parsing @wbthomason might know more about how feasible this is.

function(progress_int, client_name, status_string)
  return ... -- user does what they like
end

Anyway I don't have time to do this atm so if someone else wants to have ago 🀷🏾

wbthomason commented 3 years ago

@Shatur95 we do not do any parsing of the messages from language servers, so that's just what clangd is sending. You can look at messaging.lua L10:L33 for the logic building a table of messages, and the function @akinsho split out in this PR for how we generate a statusline component from those messages. You could make a PR to add a formatting hook or similar, which would basically just override the body of get_lsp_progress. You can also just make a custom statusline component based on your own function; as in get_lsp_progress you use the messages() function from lsp-status/messages to get the table of message data, then iterate over each and process them as you will (this is the bulk of get_lsp_progress).

Shatur commented 3 years ago

Thanks for the info, now I get it! Will think about the implementation.