Skip to content

Format accepts input from stdin #1035

@jan-xyz

Description

@jan-xyz

I am working a lot with buf and have it also setup to work from inside Neovim and it would make life a bit more convenient if both buf lint and buf format would accept input from stdin.

It would allow to show diagnostics live and on unsaved buffers and have a better integration with the vim.lsp.buf.formatting() functions as used in null-ls.

Currently, this means that all changes are "undone" when running the formatting command on unsaved buffers as they revert back to what's on disc. Which happens a lot for me since I usually setup formatting like this

vim.cmd([[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync(nil, 500)]])

which runs the formatting on the unsaved buffer before writing the buffer to disc every time I save a file.

Maybe by adding an option --stdin or detecting when something gets piped in would be an option?

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions