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

fix: make_formatting_params assumes the current buffer #93

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

lukas-reineke
Copy link
Owner

vim.lsp.util.make_formatting_params assumes the buffer the formatting params are generated for is the current buffer. in LSP-format this is not always the case.

fix #92
fix #58

`vim.lsp.util.make_formatting_params` assumes the buffer the formatting
params are generated for is the current buffer. in LSP-format this is
not always the case.

fix #92
fix #58
@lukas-reineke lukas-reineke merged commit 47de35b into master Aug 29, 2024
8 checks passed
@lukas-reineke lukas-reineke deleted the fix-make-formatting-params branch August 29, 2024 04:57
Comment on lines +87 to +91
local tabSize = vim.api.nvim_get_option_value("shiftwidth", { buf = bufnr })
local expandtab = vim.api.nvim_get_option_value("expandtab", { buf = bufnr })
if expandtab or tabSize == 0 then
tabSize = vim.api.nvim_get_option_value("tabstop", { buf = bufnr })
end
Copy link
Contributor

@liskin liskin Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this logic different from the one used earlier (https://github.com/neovim/neovim/blob/e268fcbdaa1e0e0cee3b513e62581d35bb937d40/runtime/lua/vim/lsp/util.lua#L2078-L2083)? Can't we just use get_effective_tabstop directly? Like liskin@3757ac4

Specifically, vim.lsp.util.make_formatting_params will use sw even if expandtab, but your implementation will use tabstop instead in such case.

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