Skip to content
This repository was archived by the owner on Aug 12, 2023. It is now read-only.
This repository was archived by the owner on Aug 12, 2023. It is now read-only.

Buf: formatting not working anymore #1002

@Ganitzsh

Description

@Ganitzsh

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

v0.7.2

Operating System

macOS 12.4

Minimal config

-- this template is borrowed from nvim-lspconfig
local on_windows = vim.loop.os_uname().version:match("Windows")

local function join_paths(...)
    local path_sep = on_windows and "\\" or "/"
    local result = table.concat({ ... }, path_sep)
    return result
end

vim.cmd([[set runtimepath=$VIMRUNTIME]])

local temp_dir
if on_windows then
    temp_dir = vim.loop.os_getenv("TEMP")
else
    temp_dir = "/tmp"
end

vim.cmd("set packpath=" .. join_paths(temp_dir, "nvim", "site"))

local package_root = join_paths(temp_dir, "nvim", "site", "pack")
local install_path = join_paths(package_root, "packer", "start", "packer.nvim")
local compile_path = join_paths(install_path, "plugin", "packer_compiled.lua")

local null_ls_config = function()
    local null_ls = require("null-ls")
    -- add only what you need to reproduce your issue
    null_ls.setup({
        sources = {
	    require("null-ls").builtins.formatting.buf
        },
        debug = true,
    })
end

local function load_plugins()
    -- only add other plugins if they are necessary to reproduce the issue
    require("packer").startup({
        {
            "wbthomason/packer.nvim",
            {
                "jose-elias-alvarez/null-ls.nvim",
                requires = { "nvim-lua/plenary.nvim" },
                config = null_ls_config,
            },
        },
        config = {
            package_root = package_root,
            compile_path = compile_path,
        },
    })
end

if vim.fn.isdirectory(install_path) == 0 then
    vim.fn.system({ "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path })
    load_plugins()
    require("packer").sync()
else
    load_plugins()
    require("packer").sync()
end

You also need to install https://github.com/bufbuild/buf

Steps to reproduce

Open the following file:

syntax = "proto3";

package straudio.v1;

message AudioChunk {
     string name = 1;

  bytes data = 2;
}

run :lua vim.lsp.buf.formatting()

Expected behavior

The file should get formatted

Actual behavior

Nothing happens

Debug log

[TRACE Thu Aug 11 08:48:16 2022] .../site/pack/packer/start/null-ls.nvim/lua/null-ls/rpc.lua:121: received LSP request for method textDocument/formatting
[TRACE Thu Aug 11 08:48:16 2022] ...ack/packer/start/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_FORMATTING
[DEBUG Thu Aug 11 08:48:16 2022] ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:346: spawning command "buf" at /Users/<me>/Dev/audio-streamer with args { "format", "-w", "/tmp/null-ls_SP9h7H.proto" }
[TRACE Thu Aug 11 08:48:16 2022] ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:217: error output: Failure: failed to enumerate module files: open /private/tmp/.vnc-vncservice: permission denied

[TRACE Thu Aug 11 08:48:16 2022] ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:218: output: nil
[TRACE Thu Aug 11 08:48:16 2022] ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:222: ignoring stderr due to generator options

Not sure why it's trying to access a vnc file which is nowhere near the file I'm editing

Help

No

Implementation help

No response

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions