diff options
| author | Marcus Caisey <marcus@teckna.com> | 2026-08-18 10:16:16 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-18 05:16:16 -0400 |
| commit | d9b4fb1273fd4649593926451121d416154738b1 (patch) | |
| tree | b4e708d86e136cfade4d47e458e3b998ddf10ea0 /runtime/lua/vim/range.lua | |
| parent | 27d40762bceba45e0ccfd07a742f8696bff18d0a (diff) | |
| download | rneovim-d9b4fb1273fd4649593926451121d416154738b1.tar.gz rneovim-d9b4fb1273fd4649593926451121d416154738b1.tar.bz2 rneovim-d9b4fb1273fd4649593926451121d416154738b1.zip | |
feat(lsp): fallback to textDocument/formatting from vim.lsp.formatexpr #40079
Problem:
With the addition of the `:help al` text object, you can now easily
format the whole buffer with `gqal`. However, `vim.lsp.formatexpr` only
uses `textDocument/rangeFormatting` which some language servers (like
gopls) don't support.
Solution:
- Fall back to `textDocument/formatting` if the whole buffer is being formatted
and the server doesn't support `textDocument/rangeFormatting`.
- In theory, these two methods should return the same response if the whole
buffer is being formatted, but I preserved the existing behaviour of
prioritising `textDocument/rangeFormatting` in case that does not hold (i.e.
LS bug).
- Also: `vim.lsp.formatexpr` had no tests at all, so actually add tests for it.
Diffstat (limited to 'runtime/lua/vim/range.lua')
0 files changed, 0 insertions, 0 deletions