omnisharp-vim
omnisharp-vim copied to clipboard
Can't run omnisharp-roslyn (macOS)
MacVim on Ventura 13.1.
DEBUG: 'Using vim job_start to start the following command:'
DEBUG: ['/Users/frarees/.cache/omnisharp-vim/omnisharp-roslyn/run', '-s', '/Users/frarees/Developer/Unity/sandbox/sandbox.sln', '-l', 'debug', '-e', 'utf-8']
Could not run command: /Users/frarees/.cache/omnisharp-vim/omnisharp-roslyn/run -s /Users/frarees/Developer/Unity/sandbox/sandbox.sln -l debug -e utf-8
Invoking
/Users/frarees/.cache/omnisharp-vim/omnisharp-roslyn/run -s /Users/frarees/Developer/Unity/sandbox/sandbox.sln -l debug -e utf-8
On terminal works fine. Any ideas?
No, not really. Can you run that command from inside macvim with :!...
? Or, the same way omnisharp-vim runs it:
:call job_start(['/Users/frarees/.cache/omnisharp-vim/omnisharp-roslyn/run', '-s', '/Users/frarees/Developer/Unity/sandbox/sandbox.sln'', '-e', 'utf-8'], #{out_cb: {_,m->execute('unsilent echom ' . string(m))}})
Copy-pasted your command. It returns:
E121: Undefined variable: e
E116: Invalid arguments for function job_start
Invoking through :!...
gave me this tho:
/Users/frarees/.cache/omnisharp-vim/omnisharp-roslyn/run: line 19: mono: command not found
shell returned 127
mono is in my path (installed via brew --cask
):
frarees@MBP18 ~ % which mono
/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono
Well if you can run /Users/frarees/.cache/omnisharp-vim/omnisharp-roslyn/run
from the command line but not from vim, then it looks like the way your path is set up.
Can you run :!which mono
from inside vim?
Copy-pasted your command.
Oops, I had an extra ' in there, the actual command is:
:call job_start(['/Users/frarees/.cache/omnisharp-vim/omnisharp-roslyn/run', '-s', '/Users/frarees/Developer/Unity/sandbox/sandbox.sln', '-e', 'utf-8'], #{out_cb: {_,m->execute('unsilent echom ' . string(m))}})
Tried your command, gives me no output this time.
!which mono
says mono not found tho. Huh
Oh yeah since it is erroring, we should include the error output in the command:
:call job_start(['/Users/frarees/.cache/omnisharp-vim/omnisharp-roslyn/run', '-s', '/Users/frarees/Developer/Unity/sandbox/sandbox.sln', '-e', 'utf-8'], #{out_cb: {_,m->execute('unsilent echom ' . string(m))}, err_cb: {_,m->execute('unsilent echom ' . string(m))}})
That will probably output the "mono not found" message again
So how are you adding mono to your path? Does brew do it itself? Or do you do it in e.g. a .bashrc or something? Because a .bashrc won't be being sourced from within vim, it'd need to be in something like .profile or .bash_profile. I use zsh and set environment variables like path in .zshenv, not .zshrc
You've been using omnisharp-vim from macvim for a long time though - have you changed something in your config? It used to work for you (according to our previous discussions).
I've been using VimR for years now, trying MacVim again since I've formatted my laptop. So it's likely that my setup has changed.
I see that it's defined in /etc/paths.d/mono-commands.
I've noticed it could be a problem of macOS' open behaviour:
- When I open MacVim using
open
(or just, double-click the app),which mono
returns fine - When I open MacVim via Unity, seems it's not inheriting env vars properly?
I open the app using https://docs.unity3d.com/ScriptReference/Unity.CodeEditor.CodeEditor.OSOpenFile.html, which is not the usual Process.Start(). This is how I had it coded back in the day when I used MacVim.
For what it's worth, this seems not to be a omnisharp-vim issue (although it could do a better job at informing this? I didn't get any output until I enabled debug mode), so I'll keep digging see why MacVim is not getting env vars inherited.
Do you want to try to comment out these lines, and see if you get good warnings when you load macvim?
https://github.com/OmniSharp/omnisharp-vim/blob/master/autoload/OmniSharp/proc.vim#L109-L111
Those lines were added to prevent warnings after a job was stopped, but they are possibly also the issue here.
Oh funny, I added the error suppression for closed channels as a result of another of your issues, #629
Is it possible to specify the mono path at vimrc level?
No. We specify run the path to the run
script, which sets mono to mono
from your path, we can't do more from this side.
https://github.com/OmniSharp/omnisharp-roslyn/blob/master/mono-packaging/run