Reputation: 35
I'm new into vim and I'm trying to configure null-ls to format files, I think I'm missing something, since whenever I try to run the command :NullLsInfo to see if I've got a formatter configured, it says that I don't have a buffer source attached.
Here's the NullLsInfos' result for a .vue file, which should support prettier builtin source:
And here's my null-ls.lua file content, which is correctly sourced in init.vim
null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.formatting.shfmt,
null_ls.builtins.formatting.phpcbf,
null_ls.builtins.formatting.prettier.with({
filetypes = { "html", "json", "yaml", "markdown", "vue" },
}),
},
})
Obviously, when I try to format the document using :lua vim.lsp.buf.formatting_sync(nil, 2000)
, nothing happens.
I tried running the command echo executable("prettier")
returns true.
What am I missing?
I just discovered this, when I try to open a file, I get this error
don't ask me how I discovered this just now
Upvotes: 0
Views: 3533
Reputation: 1
i have the same problem and i fixed it by re-configuring my neovim from the start , if you had no other choice that what i did
Upvotes: 0
Reputation: 75
What I imagine is happening is that you tried to configure setup twice, first on installation and another on said file, the setup from installation has priority. Just erase or configure correct there. Can't confirm, since you didn't post your installation code.
Also, for good practice, add a 'local' before null_ls
local null_ls = require("null-ls")
Upvotes: 0