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

Support formatters in the form of an async function #276

Open
perrin4869 opened this issue Aug 27, 2023 · 0 comments
Open

Support formatters in the form of an async function #276

perrin4869 opened this issue Aug 27, 2023 · 0 comments

Comments

@perrin4869
Copy link

perrin4869 commented Aug 27, 2023

There are some issues requesting integration with lsp formatting. The problem with supporting this kind of integration is that lsp formatting comes in the form of an async function, and formatter.nvim doesn't have a mechanism for defining a formatter in the form of an async function (only sync functions seem to be supported).
I think that one way this could be implemented, is by checking the number of arguments on the formatter function being passed, and when there is 1 argument, assume it is a callback, and treat it as an async function. In that manner, we could define a formatter in terms of lsp-format.nvim, or something like neovim/neovim#24725 when it gets implemented.
Or maybe try out some other async mechanism, like plenary.async?

Edit: https://stackoverflow.com/questions/56883060/how-to-get-the-number-of-arguments-a-function-in-a-table-expect

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

1 participant