Closed elken closed 4 months ago
You can check require('lsp-format').disabled
for if the plugin is disabled globally, and require('lsp-format').disabled_filetypes[vim.bo.filetype]
for the current filetype.
And you can also check require('lsp-format').buffers[vim.api.nvim_get_current_buf()]
if there are any clients attached to a buffer.
Huh, when I inspected the object before and after disabling they were both identical but okay I'll try that :smile:
Yeah after running toggle twice, enable then disable I get the below for require('lsp-format').buffers[vim.api.nvim_get_current_buf()]
If you want to see if the plugin is disabled globally FormatToggle
, you need to check require('lsp-format').disabled
If you want to see if the plugin is disabled globally
FormatToggle
, you need to checkrequire('lsp-format').disabled
Is it not handled per-buffer?
Is it not handled per-buffer?
No, it's not. Only globally, or per filetype.
Ahh my bad then, thanks anyway!
As far as I can tell, there's no exposed API for determining if the current buffer will autosave.
It would be useful for me to have a modeline indicator so I can know before saving. Happy to submit a PR if it's easier for you, I figured you'd probably know the most sensible way to expose this though.
Thanks for a great package!