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

Unable to parse sdk version #853

Closed
doubleswirve opened this issue Nov 15, 2021 · 12 comments · Fixed by #854
Closed

Unable to parse sdk version #853

doubleswirve opened this issue Nov 15, 2021 · 12 comments · Fixed by #854

Comments

@doubleswirve
Copy link

Howdy,

Ran into an issue after upgrading .NET SDK to version 6.0.100 on macOS (Mach-O 64-bit executable arm64). Here's output I'm seeing when running dotnet fsautocomplete --background-service-enabled:

Server crashing error - Unable to parse sdk version from the string 'FsAutoComplete 0.49.1 (git sha 794593d2a0ba6989298b3a8aff72f08c7439a901)'. This value came from running `/Users/doubleswirve/.dotnet/tools/dotnet-fsautocomplete [--version]` at path /Users/doubleswirve/_/play/fs 
    at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1439.Invoke(String message) in D:\a\_work\1\s\src\fsharp\FSharp.Core\printf.fs:line 1439
   at Microsoft.FSharp.Core.PrintfModule.gprintf[a,TState,TResidue,TResult,TPrinter](FSharpFunc`2 envf, PrintfFormat`4 format) in D:\a\_work\1\s\src\fsharp\FSharp.Core\printf.fs:line 1391
   at FsAutoComplete.Program.entry(String[] args) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete/Program.fs:line 64

I installed via dotnet tool install --global fsautocomplete and am trying to run in Neovim (NVIM v0.5.1) using the built-in LSP client. I'm using the example config from neovim/nvim-lspconfig; here's the relevant portion:

local servers = {
  'fsautocomplete',
}
for _, lsp in ipairs(servers) do
  nvim_lsp[lsp].setup {
    on_attach = on_attach,
    flags = {
      debounce_text_changes = 150,
    },
  }
end

The project was setup using the directions at https://fsharp.org/use/mac/. Let me know if there's any other info I can provide or if I missed anything. Thanks!

@baronfel
Copy link
Contributor

I think this is the same issue raised at the proj-info repo here. if you set the environment variable "DOTNET_HOST_PATH" to the full path to the dotnet binary, does the problem go away?

@doubleswirve
Copy link
Author

That worked, thanks! I just added a export DOTNET_HOST_PATH="$(which dotnet)" to my rc file and Neovim's working great. Thanks again!

@baronfel
Copy link
Contributor

glad to hear it. we'll be tackling the underlying bug hopefully for the next set of releases, since that bug is also hitting FSharp.Formatting and others.

@baronfel
Copy link
Contributor

A fix for this should have been pushed in 0.49.2, please let me know if it works out for you!

@doubleswirve
Copy link
Author

Howdy again. I upgraded fsautocomplete but it looks like I'm getting a different error this time. Here are current versions:

>>> dotnet --version
6.0.100
>>> dotnet tool list -g
Package Id          Version      Commands
-----------------------------------------------
fsautocomplete      0.49.2       fsautocomplete

With or without the DOTNET_HOST_PATH variable set and exported, I'm receiving the same error in ~/.cache/nvim/lsp.log:

[ERROR][2021-11-17 20:12:39] .../vim/lsp/rpc.lua:462	"rpc"	"dotnet"	"stderr"	"Could not execute because the specified command or file was not found.\r\nPossible reasons for this include:\r\n  * You misspelled a built-in dotnet command.\r\n  * You intended to execute a .NET program, but dotnet-fsautocomplete does not exist.\r\n  * You intend"
[ERROR][2021-11-17 20:12:39] .../vim/lsp/rpc.lua:462	"rpc"	"dotnet"	"stderr"	"ed to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH."
[ERROR][2021-11-17 20:12:39] .../vim/lsp/rpc.lua:462	"rpc"	"dotnet"	"stderr"	"\n"

I haven't tweaked my init.vim or anything. There's an additional debug entry in the lsp.log as well just prior to this, but it's pretty noisy. Let me know if there's anything else I can provide. Thx!

@baronfel
Copy link
Contributor

baronfel commented Nov 18, 2021

Is there any way of getting the exact command line that's being invoked here? It seems like that dotnet invocation didn't work due to a mismatched name, and I did change the name (slightly) in this PR, but my local testing worked so I'm concerned about environmental differences here.

@doubleswirve
Copy link
Author

I think it's just the default one from https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#fsautocomplete (I haven't overridden that configuration anywhere). I get the same when I run that directly:

>>> dotnet fsautocomplete --background-service-enabled
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-fsautocomplete 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.

@baronfel
Copy link
Contributor

oh you've got the package installed globally - can you try a local install? global installs can be invoked via fsautocomplete directly, but local ones must be invoked by dotnet fsautocomplete.

@doubleswirve
Copy link
Author

Nice, that worked! Maybe I'll submit a PR to update https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#fsautocomplete, since I believe it suggests global installation as preferred. Thanks again!

@baronfel
Copy link
Contributor

baronfel commented Nov 18, 2021

I think there's a way for us to support global and local installs if I revert the name change, but TBH I kinda want to discourage global installs (since they can negatively impact projects).

@baronfel
Copy link
Contributor

baronfel commented Nov 18, 2021

I've pulled 0.55.2 of proj info and 0.49.2 of FSAC because of crippling bugs in project cracking due to the change in 0.55.2. without DOTNET_HOST_PATH set the compiler doesn't return the correct set of references for a project for reasons that are unknown to me, and so systems would now require this setting. In the interim please stay on 0.49.1 of FSAC and set your DOTNET_HOST_PATH explicitly. I know this is a pain, but this change would break the broader Ionide ecosystem if it got pushed out so out of an abundance of caution this is the route we've chosen. An example of the malformed results can be seen here

@baronfel baronfel reopened this Nov 18, 2021
@baronfel
Copy link
Contributor

This should be fixed in FSAC 0.49.3 again.

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

Successfully merging a pull request may close this issue.

2 participants