You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For showing diagnostics and applying formatting kak-lsp needs to convert column coordinate in ranges sent by language servers from character offset to a byte offset. I see a few options to do that, please help me to figure out the best one.
Keep buffer copy in kak-lsp and analyze it to convert character offset to a byte offset.
Pros:
Content of the buffer is anyway sent through the kak-lsp on every change, it's easy to keep the most recent version.
Translate all coordinates on lsp.kak side by doing the following in the loop: position cursor using a character-based column with <line>g<column>l and extract byte offset with %val{cursor_column}
Pros:
"Glue"-level change, keeps kak-lsp server and Kakoune from bloat, no duplication of functionality.
Cons:
Extra shell<->Kakoune ping-pong for each coordinate, might introduce noticeable lag and need to be careful not to bump buffer timestamp while doing this.
Probably not very maintainable shell code.
Add support for character-based range-specs to Kakoune
Pros:
Might be easy to add to Kakoune as most likely all the necessary utilities are there already.
Option 2. and 3. both have an additional con, which is that they only really work on current timestamp (Option 3 could handle other timestamps at the price of some implementation complexity), Option 1. does not have this problem as the lsp server and kak-lsp are already in sync regarding buffer state.
Option 2 might be implementable more efficiently now that we have echo -to-file ... to return the data back without forking a shell. (As an aside, a good part of kak-lsp scripting might be able to take advantage of that to reduce the amount of forking).
Thanks for the suggestion! I decided to give the first option a go for now as it doesn't seem so bad in terms of resource consumption increase, but gives me opportunity to solve the problem (and its performance aspects) in the comfort of Rust, because I don't feel my skill of Kakoune+shell scripting being good enough to accomplish non-trivial task with confidence.
For showing diagnostics and applying formatting kak-lsp needs to convert column coordinate in ranges sent by language servers from character offset to a byte offset. I see a few options to do that, please help me to figure out the best one.
Pros:
lsp.kak side
of applying formatting more straightforward.Cons:
lsp.kak
side by doing the following in the loop: position cursor using a character-based column with<line>g<column>l
and extract byte offset with%val{cursor_column}
Pros:
Cons:
Pros:
Cons:
The text was updated successfully, but these errors were encountered: