Git Product home page Git Product logo

Comments (6)

nonk123 avatar nonk123 commented on June 16, 2024 1

Calling the following (as expected) just shows the signature tooltip inside kakoune:

This behavior appears to be hardcoded; see here.

I don't think you can do much without e.g. changing the output command from lsp-show-signature-help to your own in the Rust code.

You might be able to do it conditionally by adding a parameter here and hooking even deeper into the server's code.

from kakoune-lsp.

krobelus avatar krobelus commented on June 16, 2024 1

simply returns the JSON output of the LSP server unprocessed.

yeah lsp-connect does exactly that. Would be interesting to see if it's useful. I did build an echo-current-toplevel-symbol command which has only recently been obsoleted by modeline breadcrumbs. I don't remember if it had problems.
You'd need to revert c08c194 (Remove lsp-connect, 2024-03-11).
A usage example is documented in the original commit message 04b27ea (Introduce lsp-connect to allow users to handle raw LSP responses, 2022-02-13)

from kakoune-lsp.

krobelus avatar krobelus commented on June 16, 2024

I want to get the response of the signature help, process it, then insert the result out to the buffer again.

Interesting idea; not sure if signature help is the right request to do this, I use the snippets provided by the language server. When I accept the completion of a function name, it will also insert placeholders into the buffer that have the same text as in the signature help.
Normally I use <tab> (per recommended mappings) to replace all the placeholders, but I sometimes also use <esc> to keep them. Other editors use a similar behavior.
Which language server are you using? Is there a scenario where completion snippets don't work?

from kakoune-lsp.

mlhhqh avatar mlhhqh commented on June 16, 2024

The signature help was just an example since it's the easiest example to visualize I would assume. Changing some key bindings I cannot process the response (for example the signature of the function) externally and then write it into the buffer.

I guess the only way is to fork kak-lsp and dive into the Rust side.

from kakoune-lsp.

krobelus avatar krobelus commented on June 16, 2024

Anything is possible, the hard part is defining an output format that is usable. I have no idea which one you want.
It's not as simple as giving a list of parameter names because not every language uses , as separators.
Each parameter includes a label, which includes the type, so that's not really suitable for insertion

The point of kak-lsp is to be a CLI wrapper around LSP. But we can't easily provide what's not in LSP.
Of course if there is a reasonable use case we can add some hacks to make it work, and eventually standardize it.
But the hard part is designing it. What would the user interface be? A lsp-insert-default-arguments command?

Note that we had lsp-connect (it was recently removed but should be easy to git revert) which should fit the bill.
However don't believe it's very useful. I don't think anyone used it. You can use it to do your thing; but it's also easy to do it on the Rust side, once you got the hang of it.

from kakoune-lsp.

mlhhqh avatar mlhhqh commented on June 16, 2024

Anything is possible, the hard part is defining an output format that is usable. I have no idea which one you want.
It's not as simple as giving a list of parameter names because not every language uses , as separators.
Each parameter includes a label, which includes the type, so that's not really suitable for insertion

Maybe I am misunderstanding you or not thinking far enough. I think the details of "which language" and "how to parse the response" (LSP servers JSON response) should be the issue of the consumer (i.e. what I would write as a plugin), not yours (i.e. kak-lsp). Obviously I am talking exclusively about plugin writers who want to hook into the LSP responses, not the editing experience itself with an LSP client (which is flawless, kudos!).

But the hard part is designing it. What would the user interface be? A lsp-insert-default-arguments command?

I agree that designing such an interface is non-trivial (which is also why I closed this issue). Very naively I would say a command like lsp-exec-raw-json that takes a string of which LSP method to call ("signatureHelp") and optional arguments that are required for that specific call (no clue how/if that works in Rust) and simply returns the JSON output of the LSP server unprocessed.

I will have to try out lsp-connect when I get the time to.

from kakoune-lsp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.