MunifTanjim / prettier.nvim

Prettier plugin for Neovim's built-in LSP client.
MIT License
289 stars 9 forks source link

:Prettier doesn't do anything without null-ls integrated #29

Open ayroblu opened 1 year ago

ayroblu commented 1 year ago

Hi, as per the title running :Prettier doesn't seem to do anything without null-ls integration I don't want prettier integrated in to lsp, I just want it separately. Is it possible to make it work without lsp integration?

MunifTanjim commented 1 year ago

Can you share a minimal reproducible example?

ayroblu commented 1 year ago

temp.vim

set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath=&runtimepath

call plug#begin()
Plug 'nvim-lua/plenary.nvim' "null-ls depends on this
Plug 'neovim/nvim-lspconfig' "prettier depends on this
Plug 'jose-elias-alvarez/null-ls.nvim' "comment out this one and it doesn't work
Plug 'MunifTanjim/prettier.nvim'
call plug#end()

lua <<EOF
local prettier = require("prettier")

prettier.setup({
  bin = 'prettier', -- or `'prettierd'` (v0.23.3+)
  filetypes = {
    "css",
    "graphql",
    "javascript",
    "javascriptreact",
    "json",
    "less",
    "scss",
    "typescript",
    "typescriptreact",
  },
})
EOF

And then I run:

nvim -u temp.vim index.js
MunifTanjim commented 1 year ago

jose-elias-alvarez/null-ls.nvim is a dependency for this plugin. Even if you're not using LSP stuffs, you need to have jose-elias-alvarez/null-ls.nvim installed. Because prettier.nvim uses some functions from jose-elias-alvarez/null-ls.nvim when you run :Prettier.

ayroblu commented 1 year ago

I see. Do you want to keep it that way? null-ls is gonna be archived soon too. If you do, feel free to close this

MunifTanjim commented 1 year ago

We would eventually move away from null-ls. But I haven't got the time to do that yet.

Cheezmeister commented 11 months ago

In the meantime, I suggest that :Prettier ought to vocally fail if (a) null-ls is not detected, and/or (b) the necessary functions cannot be called. By "vocally", I mean simply print out something like null-ls is required, see https://github.com/MunifTanjim/prettier.nvim/issues/29.

For me, right now, it fails silently, and that's one of the worst ways to fail 😄

formbook commented 7 months ago

doesnt do anything for me with null-ls