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

g:fsharp#languageserver_command is not defined after installing Ionide-vim #8

Closed
panesofglass opened this issue Sep 19, 2019 · 24 comments · Fixed by #12
Closed

g:fsharp#languageserver_command is not defined after installing Ionide-vim #8

panesofglass opened this issue Sep 19, 2019 · 24 comments · Fixed by #12
Assignees
Labels
bug Something isn't working

Comments

@panesofglass
Copy link
Contributor

Describe the bug
g:fsharp#languageserver_command is not defined after installing Ionide-vim.

To Reproduce
Steps to reproduce the behaviour:

  1. Follow instructions to install Ionide-vim
  2. Edit any file with nvim .
  3. See error while nvim opens

Expected behaviour
Correctly load a pre-configured variable named g:fsharp#languageserver_command to issue commands to FSAC.

Screenshots

Error detected while processing /home/ryan/.vim/init.vim:
line   42:
E121: Undefined variable: g:fsharp#languageserver_command
E15: Invalid expression: { 'fsharp': g:fsharp#languageserver_command }

Environment (please complete the following information):

  • OS: Ubuntu 18.04
  • Ionide version: master
  • VSCode version: N/A
  • dotnet SDK version: 2.2.402
  • mono / .Net Framework version:
@panesofglass
Copy link
Contributor Author

Looks like the issue could be related to my switch to Vim8's built-in package manager pack/*/start path, the install.fsx places the built package in the wrong place. By changing the path to pack/bundle/start/* in install.fsx, it seems like it should work, but I see the same result.

@cannorin
Copy link
Member

I haven't really tested install.fsx so much so it may be not working correctly. I'll investigate it.

@cannorin
Copy link
Member

As a workaround for now, you can use Plug or dein.vim and it should work as expected.

@cannorin
Copy link
Member

Did you use install.sh for installing?

@panesofglass
Copy link
Contributor Author

Yes, I used install.sh. I’m not interested in using plug or dein.vim, so I’ll pass for now. Thanks.

@cannorin
Copy link
Member

If you've installed to .vim/pack/*/start, it won't work in neovim: try .local/share/nvim/site/pack/*/start instead.

@cannorin
Copy link
Member

If not, let me know and I'll set up a new Ubuntu environment and try to figure out why it isn't working.

@giulioungaretti
Copy link

@cannorin I have the same issue actually, installing with Plug :D running vim on mac osx!
LMK if you'd rather have another issue opened, or just continue here and more importantly if any more details could help you! I'd love to get this working :D

@cannorin
Copy link
Member

cannorin commented Oct 3, 2019

@giulioungaretti It could be because you added

let g:LanguageClient_serverCommands = {
  \ 'fsharp': g:fsharp#languageserver_command
  \ }

before you installed the plugin by executing :PlugInstall. Adding it after installing should not trigger the error. If it wasn't the case, let me know more details.

@giulioungaretti
Copy link

:PlugInstall ✔️

Open vim in ~ get:

Error detected while processing /Users/unga/.vimPlug:
line   23:
E121: Undefined variable: g:fsharp#languageserver_command
Press ENTER or type command to continue

Open a .fs file:

Error detected while processing /Users/unga/.vim/plugged/Ionide-vim/ftplugin/fsharp.vim:
line   12:
FSAC not found. :FSharpUpdateFSAC to download.

Run said command:

E492: Not an editor command: FSharpUpdateFSAC 

Which makes me think it could be related to some PATH issues ?

@cannorin
Copy link
Member

cannorin commented Oct 3, 2019

Ah, my bad. That's because I placed the existence-checking code before defining commands: https://github.com/ionide/Ionide-vim/blob/master/ftplugin/fsharp.vim#L11

As a workaround, could you try doing :call fsharp#updateFSAC() and see what happens?

@panesofglass
Copy link
Contributor Author

It's still not working for me. :( I'll continue to try again every so often.

@cannorin
Copy link
Member

cannorin commented Oct 3, 2019

@panesofglass I'll reproduce your environment and try to find out why it isn't working. Could you provide me the location of Ionide-vim and your .vimrc?

@cannorin
Copy link
Member

cannorin commented Oct 4, 2019

@giulioungaretti 5f4f194 addressed the problem :FSharpUpdateFSAC is not available. If you have not tried the workaround above, you can instead upgrade Ionide-vim to the latest.
I suspect that autoload/fsharp.vim is not correctly loaded, so if my guess is correct it will give you a different error message.

@cannorin cannorin added the bug Something isn't working label Oct 4, 2019
@cannorin cannorin self-assigned this Oct 4, 2019
@panesofglass
Copy link
Contributor Author

@cannorin thank you! On Windows, I'm using ~\AppData\Local\nvim with an init.vim in that folder. On Linux, I'm using ~/.config/nvim with init.vim in that folder. I'm storing my plugins using ~/*/nvim/pack/bundle/start. You can access my vimfiles where I'm trying to use Ionide-vim here. (I should have shared that sooner, come to think of it.)

@cannorin
Copy link
Member

cannorin commented Oct 7, 2019

@panesofglass

  1. You are using the master branch of LanguageClient-neovim which is very outdated and cannot be used. Switch to the next branch and run install.sh.
  2. I didn't know that plugins are loaded after vimrc/init.vim unless manually sourced (which most plugin managers do), which is the source of this problem. I should restructure the settings flow in order to fix this.

@cannorin
Copy link
Member

cannorin commented Oct 7, 2019

@giulioungaretti @panesofglass I just created issue-8_languageserver-command-not-defined branch and applied the fix (hopefully) to it. Can you switch to that branch and try it out?

The languageserver configuration is now done automatically and

let g:LanguageClient_serverCommands = {
  \ 'fsharp': g:fsharp#languageserver_command
  \ }

in vimrc/init.vim is not needed anymore.

@giulioungaretti
Copy link

@cannorin it works wonderfully with that branch!
Tested on wsl2 + mac osx!

@cannorin
Copy link
Member

cannorin commented Oct 7, 2019

@giulioungaretti Great to hear that!

@panesofglass
Copy link
Contributor Author

I've updated everything, but I still see the error on both wsl2 and windows. Maybe I missed something?

@cannorin
Copy link
Member

cannorin commented Oct 7, 2019

@panesofglass Make sure you removed the let g:LanguageClient_serverCommands = ... line from your init.vim as it would be the only source of the "not defined" error.

@panesofglass
Copy link
Contributor Author

panesofglass commented Oct 8, 2019

Ah, thanks! I missed that bit. It works great now! By the way, if I wanted to add additional language server commands, would I just not add anything about fsharp?

@cannorin
Copy link
Member

cannorin commented Oct 8, 2019

Thanks! I'll merge the fix now.

The current implementation of Ionide-vim only adds the F# language server command when editing F# files, so you can just add language server of another languages.

@cannorin
Copy link
Member

cannorin commented Oct 8, 2019

@panesofglass @giulioungaretti Don't forget to switch back to the master branch (I'll delete the issue branch in few days). Thanks a lot for reporting a bug 😂

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

Successfully merging a pull request may close this issue.

3 participants