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

The latest FSAC is currently not working (on *nix systems?) #44

Closed
cannorin opened this issue Nov 16, 2021 · 16 comments
Closed

The latest FSAC is currently not working (on *nix systems?) #44

cannorin opened this issue Nov 16, 2021 · 16 comments
Assignees

Comments

@cannorin
Copy link
Member

cannorin commented Nov 16, 2021

UPDATE: This was fixed in the latest FSAC (0.49.2). Please update your FSAC with :FSharpUpdateFSAC, or if you are using one from .NET tools, dotnet tool update fsautocomplete.

Also, FSAC now encourages installing fsautocomplete as a local tool rather than a global tool.

  • To switch to project-local FSAC, run dotnet tool install fsautocomplete in your project and set the following:
let g:fsharp#fsautocomplete_command =
    \ [ 'dotnet',
    \   'fsautocomplete',
    \   '--background-service-enabled'
    \ ]
  • If you want to continue using global FSAC, you should change your g:fsharp#fsautocomplete_command to the following:
let g:fsharp#fsautocomplete_command =
    \ [ 'fsautocomplete',  '--background-service-enabled'` ]
  • If you are using FSAC bundled with Ionide-vim, there is no need to change any settings. Just run :FSharpUpdateFSAC to update to the latest FSAC.

Ionide-vim is currently affected by an upstream bug ionide/FsAutoComplete#853, which originates from ionide/proj-info#123.

This is causing Ionide-vim not to work. Here are the workarounds you can do to avoid this issue for the time being:

Workaround 1.

As described in ionide/FsAutoComplete#853, put export DOTNET_HOST_PATH="$(which dotnet)" to your rc file.

Workaround 2.

Install an older version of FSAC as a .NET tool:

dotnet tool install --version 0.48.2 fsautocomplete -g

(if you have already installed it before, replace install with update)

Then use the following to force Ionide-vim to use the one from .NET tool:

let g:fsharp#fsautocomplete_command =
    \ [ 'dotnet',
    \   'fsautocomplete',
    \   '--background-service-enabled'
    \ ]
@cannorin cannorin self-assigned this Nov 16, 2021
@cannorin cannorin changed the title The latest FSAC is currently not working on *nix systems The latest FSAC is currently not working (on *nix systems?) Nov 16, 2021
@OmanF
Copy link

OmanF commented Nov 16, 2021

As I noted on #43, for me what worked was workaround 2.
Will keep an eye on the fsautocomplete upstream to see when they fix the root cause.

Thank you for your great work!

@baronfel
Copy link

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

@klcarlton
Copy link

@baronfel confirmed.
After running :FSharpUpdateFSAC I no longer need to set DOTNET_HOST_PATH

@cannorin
Copy link
Member Author

confirmed on my end too. I will update the description, then close this announcement tomorrow.

@OmanF
Copy link

OmanF commented Nov 20, 2021

@baronfel, @cannorin

Meta:
OS: Linux Ubuntu 20.04 (WSL2)
NeoVim: 0.6.0-Dev, nightly
.Net SDK: 6.0.100

On the table below when it says "FSAC version - local", I made sure to uninstall FSAC globally, and vice-versa, so, at all times there was a single FSAC installed on the machine (either globally, or local to the folder).

My .zshrc has no clause regarding DOTNET-anything.

Content:

  0.48.2 local 0.48.2 global 0.49.3 local 0.49.3 global
Nothing in config (presummably bundled FSAC) FSAC starts after ~2 seconds delay; Even then autocomplete only shows LSP suggestion when there are 2 characters No LSP client attaches!!! Ionide attaches - does nothing! (No autocomplete, no error messages, etc.) Ionide attaches - does nothing! (No autocomplete, no error messages, etc.)
dotnet fsautocomplete --backgroud-service-enabled FSAC starts after ~2 seconds delay; Even then autocomplete only shows LSP suggestion when there are 2 characters Error 1 Ionide attaches - does nothing! (No autocomplete, no error messages, etc.) Error 1
fsautocomplete --background-service-enabled cmd ["fsautocomplete"] is not executable. (Logical - there is no global FSAC) cmd ["fsautocomplete"] is not executable. (ILLOGICAL - there IS a global FSAC installed!) cmd ["fsautocomplete"] is not executable. (Logical - there is no global FSAC) cmd ["fsautocomplete"] is not executable. (ILLOGICAL - there IS a global FSAC installed!)

 

Error 1: [ERROR][2021-11-20 14:25:00] .../vim/lsp/rpc.lua:412        "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 intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.\n"

After reading this table, and the preceding thread, it simply acts to verify what you already know, which is that FSAC v0.49.* is at the moment incompatible with Ionide-vim , while v0.48.2 is.

The Error 1 are, when I think about it, very logical: I'm trying to run a local dotnet command, but the FSAC is installed globally, so, of course, it's an error.

@tnishimura
Copy link

Workaround 2 worked for me, using Vim 8.2 on 20.04. Without it, I get the exact symptoms as described by @OmanF, albeit with 0.49.5. Workaround 1 did not work for me.

@tnishimura
Copy link

Note for @OmanF and others running Ubuntu: Apparently fsautocomplete 0.49+ works fine if you only have one dotnet runtime installed -- i.e., uninstall all runtimes besides dotnet-runtime-6.0. I brought this up as a fsautocomplete issue.

@cannorin
Copy link
Member Author

cannorin commented Feb 4, 2022

@tnishimura Thank you for taking time to look into this! I'm glad if you can send a patch (so that you are actually credited as a contributor), but I can do it instead if you don't have time for that.

@tnishimura
Copy link

@cannorin I'll ask you to do it 🙏 -- the only thing I can think of is prepending 'env', 'DOTNET_ROLL_FORWARD=LatestMajor' onto g:fsharp#fsautocomplete_command. Also my vimscript-fu is rather weak.

cannorin added a commit that referenced this issue Feb 6, 2022
@cannorin
Copy link
Member Author

cannorin commented Feb 6, 2022

Added a workaround for this issue. Can you check if it works for you?

@OmanF
Copy link

OmanF commented Feb 6, 2022

I just saw the implementation for #51, I tried it: works!
Great and thank you very much!

Couple of issues I do have to point out:

  1. Due to FSAC requiring a global installation... it's worth making sure in the documentation, in bold, italics, underscore, blinking lights, whatever, that FSAC needs to be installed globally.
  2. I now get LSP auto-complete which is cool, but it triggers only after 2 characters after the ., i.e., List. won't work, List.ma will.
  3. Even when the auto-complete shows, if I type the entire word after the dot, that specific word will not show in the pop-up menu. What I mean is if I do List.map the pop-up will show map2, mapi, mapX... just not map.
  4. Regardless of this ticket, I remind of another ticket about the tooltip not showing any details about the function in the pop-up it stands over. The tooltip bubble is empty, showing, but empty.

All in all, great work, I can now edit F# in NeoVim to a goo degree!
Thank you very much!

@baronfel
Copy link

baronfel commented Feb 6, 2022

A couple quick responses:

  1. worth noting that the FSAC install is not required to be global - dotnet tools can (and should IMO!) be installed locally to a project via dotnet new tool-manifest && dotnet tool install fsautocomplete. Then you can pin/manage the version without impacting your other projects, as you would any other dotnet tool (like fantomas for formatting).
  2. this is IIRC something that can be configured both on the LSP server (FSAC) and LSP client (neovim) sides. it would be worth looking at the raw LSP request/responses (most LSP clients will use the <LANGNAME>.trace.server settings key to control this logging) and see if List.map is being returned from FSAC itself, but swallowed on the neovim side in some way
  3. this bled into the answer for 2
  4. Same response here - if you can provide LSP request/response logs for the erroring tooltip that might help triage if the problem is on the FSAC side or the neovim integration side

@cannorin
Copy link
Member Author

cannorin commented Feb 6, 2022

As @baronfel explained, FSAC need not be global. See the g:fsharp#fsautocomplete_command documentation in README (it actually explains how to use project-local FSAC).

Also I'm pretty sure 2. is my fault and can be fixed easily (I remember setting 2 as something like the minimal characters to trigger completion).

@tnishimura
Copy link

tnishimura commented Feb 7, 2022

@cannorin Yes, the DOTNET_ROLL_FORWARD change is working as expected, at least on Vim. (I didn't know that you could just set a variable $DOTNET_ROLL_FORWARD to set env vars in vimscript...). Thank you!

@cannorin
Copy link
Member Author

cannorin commented Feb 8, 2022

@OmanF

(I've already explained about 1. in the above message, so I'm skipping it)

  1. If you are using the example configuration with nvim-lspconfig and nvim-cmp, remove keyword_length = 2. If you are using deoplete, that seems to be the default behavior of deoplete and you would need to configure deoplete but not this plugin.

  2. I didn't reproduce it both in deoplete and nvim-cmp (with the example configurations). I think the problem comes somewhere from your .vimrc, so we would need to look at it...

  3. If you are using deoplete, deoplete-lsp is lacking the feature (Function selection tooltip doesn't show the heredoc #41), so you would need to switch to nvim-cmp. If you are already using nvim-cmp, we would need to look at your .vimrc to see what is happening, as I can't reproduce it with the example configuration.

@OmanF
Copy link

OmanF commented Feb 15, 2022

Thanks for your reply.
I'm actually using coq_nvim as my completion engine, so I'll just try and see the docs about the 2-letter limit.

Otherwise, I've seen and implemented the local FSAutoComplete as per the readme and it works great.
I can now use F# on NeoVim with the same enjoyment I use it on VSCode.

Thanks for a great job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants