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

Feature request: freestanding prisma-fmt binary #13

Open
benediktms opened this issue Jun 1, 2023 · 1 comment
Open

Feature request: freestanding prisma-fmt binary #13

benediktms opened this issue Jun 1, 2023 · 1 comment

Comments

@benediktms
Copy link

Follow up from prisma/prisma#19360 (reply in thread)

Many Neovim users now rely on the builtin LSP rather than '3rd party' providers like CoC. Currently there is no way (that I know of) to integrate the format functionality into the Neovim LSP.

I think it would be beneficial to many Neovim users to get a separate binary for prisma-fmt that could hook into the prisma language server. Currently the only solution to get nicely formatted schema files is to open VSCode and format there, which is not ideal.

@anhari
Copy link

anhari commented Aug 26, 2024

@benediktms, I've been using the mhartington/formatter.nvim plugin for formatting in neovim, and wanted to share that I was able to setup formatting prisma schemas with the following config:

return {
  "mhartington/formatter.nvim",
  config = function()
    require("formatter").setup({
      filetype = {
        prisma = {
          function()
            vim.lsp.buf.format()
          end
        },
        -- setup other languages here
      },
    })

    vim.cmd([[
        augroup FormatAutogroup
        autocmd!
        autocmd BufWritePost * FormatWrite
        augroup END
      ]])
  end,
}

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

No branches or pull requests

2 participants