mhartington/formatter.nvim

help me to setup prisma

Opened this issue · 2 comments

I tried this

prisma = {
       function()
        return {
         exe = "prisma",
          args = { "format", vim.api.nvim_buf_get_name(0) },
          stdin = true,
       }
       end,
 },

but it doesn't work. when i save i get the prompt if i want to write changes? but i don't want that behavior.

You can use prettier with prettier-prisma-plugin.

        prisma = {
            function()
                return {
                    exe = "prettier",
                    args = {
                        "--stdin-filepath",
                        vim.fn.fnameescape(vim.api.nvim_buf_get_name(0)),
                        "--use-tabs",
                        "--tab-width",
                        "4",
                        "--plugin=prettier-plugin-prisma",
                    },
                    stdin = true,
                }
            end,
        },

I achieved this by using the prisma-language-server with something like this

prisma = {
  function()
    vim.lsp.buf.format()
  end
}