Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: pass in a custom request to use instead of default LSP's #127

Open
zyriab opened this issue May 9, 2024 · 5 comments
Open

feat: pass in a custom request to use instead of default LSP's #127

zyriab opened this issue May 9, 2024 · 5 comments

Comments

@zyriab
Copy link
Contributor

zyriab commented May 9, 2024

Same kind of request as for the fallback, I'd like Otter to use my usual function for type_definition (for example) instead of the default LSP.
Would default to the current behavior (using the LSP's builtin function).

I looked into the code to do it myself but I don't understand where it is done, I'd be happy to open a PR if you can give me some directions. :)

My idea is to add a second parameter callback of type function|nil to all ask_* functions.

@jmbuhr
Copy link
Owner

jmbuhr commented May 9, 2024

Ah, I belive you are talking about the handler?Those are a bit harder to make configurable, because some require speciel treatement (e.g. we use our own hover handler because the default nvim one doesn't like hovers responses that originate from another buffer)

@zyriab
Copy link
Contributor Author

zyriab commented May 9, 2024

I see! Thanks for taking the time to answer at that hour of the night :)

@jmbuhr
Copy link
Owner

jmbuhr commented May 11, 2024

For some requests your custom handlers may work out of the box. You can experiment with using the otter.keeper.send_request function directly (e.g. by copy-pasting one of the ask_... functions for your own needs). Because for some requests all the necessary changes are already done in the filter function, while others required special treatment of the handler itself (like hover).

Maybe we can identify parts of handlers that can safely be exchanged and thus be made configurable more easily.

@jmbuhr
Copy link
Owner

jmbuhr commented Jun 29, 2024

I just merged a big rewrite. Depending on the nature of your usual type_defintion function, it should now just work or be apparent why it doesn't currently (see https://github.com/jmbuhr/otter.nvim?tab=readme-ov-file#current-limitations)

@zyriab
Copy link
Contributor Author

zyriab commented Jul 9, 2024

Hey Jannik, sorry for the late reply, I'm drowning in work.
Thanks a lot for all that you do and for this great tool :)
I'll check it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants