-
Notifications
You must be signed in to change notification settings - Fork 243
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Neovim version (nvim -v)
v0.11.0
Describe the bug
- Version 1.x.x of
csharpier
has updated it's api so no longer works when updated.
args = { "csharpier", "--write-stdout" }, <-- not in v1.x.x
- The current default config for csharpier conform is using the version installed into the
dotnet
cli, which is different from the version that mason installs.
command = "dotnet", <-- mason dose not install this as part of dotnet
❯ dotnet csharpier
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET program, but dotnet-csharpier does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
Instead mason put it in the path for nvim, so it can be invoed with :! csharpier
. I assume both option need to be supported. Or could just add something to the readme and have users overwrite.
This config fixes the problem;
formatters = {
csharpier = function()
local useDotnet = not vim.fn.executable("csharpier")
local command = useDotnet and "dotnet csharpier" or "csharpier"
local version_out = vim.fn.system(command .. " --version")
vim.notify(version_out)
--NOTE: system command returns the command as the first line of the result, need to get the version number on the final line
local version_result = version_out[#version_out]
local major_version = tonumber((version_out or ""):match("^(%d+)")) or 0
local is_new = major_version >= 1
vim.notify(tostring(is_new))
local args = is_new and { "format", "$FILENAME" } or { "--write-stdout" }
return {
command = command,
args = args,
stdin = not is_new,
require_cwd = false,
}
end,
}
I will get a PR up making the changes to csharpier config.
I am wondering if/how you want to handle the version issue?
I can clean up what I currently have but it's going to be a little hacky.
What is the severity of this bug?
breaking (some functionality is broken)
Steps To Reproduce
Update to v 1.x.x of csharpier, will need to do this using the dotnet cli not mason.
pixlmint, ahsanu123, szyszak, UserIsntAvailable, benjiwolff and 7 more
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working