OmniSharp / omnisharp-vim

Vim omnicompletion (intellisense) and more for C#
http://www.omnisharp.net
MIT License
1.72k stars 168 forks source link

mono: command not found #807

Closed MFDeAngelo closed 2 years ago

MFDeAngelo commented 2 years ago

Anytime I open a .cs file I get the following error message:

stderr: ['/home/matthew/.cache/omnisharp-vim/omnisharp-roslyn/run: line 19: mono: command not found', '']

Here is the contents of the above referenced file:

#!/usr/bin/env bash

base_dir="$(cd "$(dirname "$0")" && pwd -P)"
omnisharp_dir=${base_dir}/omnisharp

mono_cmd=mono
omnisharp_cmd=${omnisharp_dir}/OmniSharp.exe

no_omnisharp=false

if [ "$1" = "--no-omnisharp" ]; then
    shift
    no_omnisharp=true
fi

if [ "$no_omnisharp" = true ]; then
    "${mono_cmd}" "$@"
else
    "${mono_cmd}" "${omnisharp_cmd}" "$@"     <<LINE 19>>
fi

This is currently the only plugin that I'm using.

I've already run :OmniSharpInstall but to no avail. I've reinstalled a couple of times too.

What other information do you need to be able to troubleshoot this issue?

nickspoons commented 2 years ago

What other information do you need to be able to troubleshoot this issue?

Your config (.vimrc/init.vim), your OS, and the type of project (.NET Framework, Core etc.)

nickspoons commented 2 years ago

Looks like you're on Linux. If you're actually working on a .NET Framework project (Unity?) then you need mono installed, it's an OmniSharp-roslyn dependency.

If you're using dotnet core (netcore3.1, net5.0, net6.0 etc.) try using the net6 version of the server:

Add this to your .vimrc:

let g:OmniSharp_server_use_net6 = 1

Then re-install the server with :OmniSharpInstall

MFDeAngelo commented 2 years ago

init.vim:

set exrc
set secure
set relativenumber
set nu
set hidden
set tabstop=4 softtabstop=4
set shiftwidth=4
set expandtab
set nowrap
set smartindent
set incsearch
set scrolloff=8
set colorcolumn=80
set signcolumn=yes
set cmdheight=2

.exrc

call plug#begin('~/.config/nvim/plugged')
Plug 'OmniSharp/omnisharp-vim'
call plug#end()

OS: Linux Ubuntu 22.04

Project: .NET 6

nickspoons commented 2 years ago

Ok, try my second suggestion above. I need to find a tidy way to make that the default, now that OmniSharp-roslyn has removed their bundled mono and net core has become dominant. Just tricky to change the default without breaking existing setups...

MFDeAngelo commented 2 years ago

I believe that fixed the issue. At the very least, I'm not seeing that error any more. I still haven't gotten it to work yet, but it looks like the problem now lies with my installation of the dotnet sdk. I'll continue troubleshooting that on my own. In the meantime, I'll close this issue. Thank you for your help!

nickspoons commented 2 years ago

Check the log for help debugging server issues: :OmniSharpOpenLog