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

null-ls trying to use user folder as command name on windows #1598

Open
5 tasks done
Raj3019 opened this issue Jun 19, 2023 · 1 comment
Open
5 tasks done

null-ls trying to use user folder as command name on windows #1598

Raj3019 opened this issue Jun 19, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@Raj3019
Copy link

Raj3019 commented Jun 19, 2023

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.9.1

Dev Version?

  • I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.

Operating System

Windows 11

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.g.loaded_remote_plugins = ""
vim.cmd([[set runtimepath=$VIMRUNTIME]])

local temp_dir = vim.loop.os_getenv("TEMP") or "/tmp"

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 = {},
        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
local null_ls = require("null-ls")

null_ls.setup({
  debug = true,
    sources = {
        null_ls.builtins.formatting.prettier
    },
})

Steps to Reproduce

Have a Node Js installed

created a file sample.js

Ran the file and it worked and gave output as expected.

Execute the formatter:
:lua vim.lsp.buf.format()

Reproducibility Check

  • I confirm that my minimal config is based on the minimal_init.lua template and that my issue is reproducible by running nvim --clean -u minimal_init.lua and following the steps above.

Expected Behavior

The miss-formatted text should get formatted

Actual Behavior

Null-ls trying to use user folder as command name on windows 11. The file is not getting formatted

Debug Log

[TRACE 19-06-2023 03:33:03 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/client.lua:97: starting null-ls client
[TRACE 19-06-2023 03:33:03 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/rpc.lua:102: received LSP request for method initialize
[TRACE 19-06-2023 03:33:03 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/rpc.lua:127: received LSP notification for method initialized
[TRACE 19-06-2023 03:33:03 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/rpc.lua:127: received LSP notification for method textDocument/didOpen
[TRACE 19-06-2023 03:33:03 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS_ON_OPEN
[DEBUG 19-06-2023 03:33:03 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[TRACE 19-06-2023 03:33:47 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/rpc.lua:102: received LSP request for method textDocument/formatting
[TRACE 19-06-2023 03:33:47 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_FORMATTING
[DEBUG 19-06-2023 03:33:47 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:321: spawning command "prettier" at D:\Code Files\Javascript with args { "--stdin-filepath", "D:\Code Files\Javascript\loops.js" }
[TRACE 19-06-2023 03:33:47 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:205: error output: 'C:\Users\Argon' is not recognized as an internal or external command,
operable program or batch file.

[TRACE 19-06-2023 03:33:47 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:206: output: nil
[TRACE 19-06-2023 03:33:47 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:210: ignoring stderr due to generator options
[TRACE 19-06-2023 03:33:56 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/rpc.lua:127: received LSP notification for method textDocument/didOpen
[TRACE 19-06-2023 03:33:56 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS_ON_OPEN
[DEBUG 19-06-2023 03:33:56 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[TRACE 19-06-2023 03:34:19 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/rpc.lua:127: received LSP notification for method textDocument/didChange
[TRACE 19-06-2023 03:34:19 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS
[DEBUG 19-06-2023 03:34:19 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[TRACE 19-06-2023 03:34:21 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/rpc.lua:127: received LSP notification for method textDocument/didSave
[TRACE 19-06-2023 03:34:21 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS_ON_SAVE
[DEBUG 19-06-2023 03:34:21 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[TRACE 19-06-2023 03:34:27 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/rpc.lua:102: received LSP request for method textDocument/formatting
[TRACE 19-06-2023 03:34:27 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_FORMATTING
[DEBUG 19-06-2023 03:34:27 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:321: spawning command "prettier" at D:\Code Files\Javascript with args { "--stdin-filepath", "D:\Code Files\Javascript\rst.js" }
[TRACE 19-06-2023 03:34:27 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:205: error output: 'C:\Users\Argon' is not recognized as an internal or external command,
operable program or batch file.

[TRACE 19-06-2023 03:34:27 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:206: output: nil
[TRACE 19-06-2023 03:34:27 PM] C:/Users/Argon/AppData/Local/nvim-data/lazy/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:210: ignoring stderr due to generator options

Help

Yes, but I don't know how to start. I would need guidance

Implementation Help

If there is a mistake from my side or the error is causing due to my config file then I would need help to fix it.

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.
@Raj3019 Raj3019 added the bug Something isn't working label Jun 19, 2023
@jose-elias-alvarez
Copy link
Owner

No idea on this one, and I don't have a Windows PC to investigate. It may be related to #1341.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants