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

Limited OmniSharp Commands (failing to properly call/start rosylin server?) #846

Closed
vulbyte opened this issue Jul 15, 2023 · 64 comments
Closed

Comments

@vulbyte
Copy link

vulbyte commented Jul 15, 2023

hello, just wanted to first off by saying sorry if i'm doing something stupid, but for some reason i'm limited to the nvim commands:

:OmniSharpInstall
:OmniSharpOpenLog 
:OmniSharpStatus

i am running nvim v0.9.1 via 🍺,
within wezterm 20230712-072601-f4abf8fd via 🍺,
dotnet 7.0.306 via direct download,
and mono 6.12.0.182 via 🍺.

after installing omnisharp-vim with packer via use('OmniSharp/omnisharp-vim') in a .lua file.

after running :PackerSync i only have access to the commands listed above, after i run :OmniSharpInstall i have returned to me:

Installing OmniSharp Roslyn, please wait...
OmniSharp-Roslyn v1.39.7 installed to '/Users/insert/.cache/omnisharp-vim/omnisharp-roslyn'
Press ENTER or type command to continue

i also checked for related issues and the only thing i can see that is similar is this

but it seems to be a completely unrelated issue.

the logs are empty and attempting to start it anyways by entering :OmniSharpStartServer returns:
E492: Not an editor command: OmniSharpStartServer
and running :OmniSharpStatus simply returns:
No servers started

thanks for any and all help, sorry if this is a small brain issue

edit 1: changed install via from words to mug to represent brew cause i'm extra like that

edit 2: reattempted thorwing something against the wall and i now got this error:

Error detected while processing function OmniSharp#log#Open:
line   17:
E325: ATTENTION
Found a swap file by the name "~/.local/state/nvim/swap//%Users%insert%.local%share%nvim%site%pack%packer%start%omnisharp-vim%log%stdio.log.swp"
          owned by: insert   dated: Fri Jul 14 22:14:41 2023
         file name: ~insert/.local/share/nvim/site/pack/packer/start/omnisharp-vim/log/stdio.log
          modified: YES
         user name: insert   host name: inserts-MacBook-Pro.local
        process ID: 69112 (STILL RUNNING)
While opening file "/Users/insert/.local/share/nvim/site/pack/packer/start/omnisharp-vim/log/stdio.log"
      CANNOT BE FOUND
(1) Another program may be editing the same file.  If this is the case,
    be careful not to end up with two different instances of the same
    file when making changes.  Quit, or continue with caution.
(2) An edit session for this file crashed.
    If this is the case, use ":recover" or "vim -r /Users/insert/.local/share/nvim/site/pack/packer/start/omnisharp-vim/log/stdio.log"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file "/Users/insert/.local/state/nvim/swap//%Users%insert%.local%share%nvim%site%pack%packer%start%omnisharp-vim%log%stdio.log.swp"
    to avoid this message.
    ```
    however i am unfamilliar with what this means and how to fix
@nickspoons
Copy link
Member

The commands are only available from .cs files

@vulbyte
Copy link
Author

vulbyte commented Jul 15, 2023

heya, thank you very much for the reply and your time

sadly that is the case, i'm in a cs file right now attempting to do so and there's no options. even after running the install again in said file

edit 1: that's also after cd'ing into a cs directory and attempting to rerun :PackerSync

@nickspoons
Copy link
Member

Is the filetype cs according to vim?

:echo &ft

Could you please run :scriptnames from a .cs file and ensure that the omnisharp-vim scripts are listed as having been sourced?

@vulbyte
Copy link
Author

vulbyte commented Jul 15, 2023

yes it is, running the command you listed returns cs

and after running :scriptnames returns a long list, but here's the omnisharp ones that appear:

  8: ~/.local/share/nvim/site/pack/packer/start/omnisharp-vim/ftdetect/omnisharplog.vim
...
 63: ~/.local/share/nvim/site/pack/packer/start/omnisharp-vim/plugin/OmniSharp.vim
...
100: ~/.local/share/nvim/site/pack/packer/start/omnisharp-vim/ftplugin/cs/OmniSharp.vim
101: ~/.local/share/nvim/site/pack/packer/start/omnisharp-vim/autoload/OmniSharp/util.vim
102: ~/.local/share/nvim/site/pack/packer/start/omnisharp-vim/autoload/OmniSharp.vim
103: ~/.local/share/nvim/site/pack/packer/start/omnisharp-vim/autoload/OmniSharp/buffer.vim
104: ~/.local/share/nvim/site/pack/packer/start/omnisharp-vim/autoload/OmniSharp/proc.vim
105: ~/.local/share/nvim/site/pack/packer/start/omnisharp-vim/autoload/OmniSharp/log.vim

@nickspoons
Copy link
Member

Pretty weird, your:scriptnames shows that https://github.com/OmniSharp/omnisharp-vim/blob/master/ftplugin/cs/OmniSharp.vim is being sourced so you should have commands in that cs buffer. But when you do :Omni<C-d> it only shows those 3 commands.

The only way that makes sense is if one of the first 3 lines of the script are causing the script to exit early, and if that is happening there should be some kind of warning in your :messages output.

Beyond checking that, you might need to debug the script I linked by inserting e.g. echomsg 'a' etc. between the first few lines, and see how far the process gets, e.g.:

echomsg 'a'
if !get(g:, 'OmniSharp_loaded', 0) | finish | endif
echomsg 'b'
if !OmniSharp#util#CheckCapabilities() | finish | endif
echomsg 'c'
if get(b:, 'OmniSharp_ftplugin_loaded', 0) | finish | endif
echomsg 'd'
let b:OmniSharp_ftplugin_loaded = 1
echomsg 'e'

@vulbyte
Copy link
Author

vulbyte commented Jul 15, 2023

thanks again for the reply,

i resolved the errors that were appearing in the first message in edit 2 by running chmod 777 in my homebrew folder, so there's no no errors at all, no messages either. i'm current now only getting the message:
OmniSharp-Roslyn v1.39.7 installed to '/Users/insert/.cache/omnisharp-vim/omnisharp-roslyn'

getting to your suggestions
i opened up the folder in ~/.local/share/nvim/site/pack/packer/start/omnisharp-vim/ftplugin/cs/Omnisharp.vim
and affed the echomsg's you suggest, combined with sprinkling in some others for redundancy sake, the finale of which being echomsg 'k' which is on the last line.

running this new file by using the commands :w then :so returns the following error:

a
b
c
d
e
OmniSharp-Roslyn v1.39.7 installed to '/Users/insert/.cache/omnisharp-vim/omnisharp-roslyn'
Error detected while processing :source (no file)..function OmniSharp#StartServerIfNotRunning[5]..OmniSharp#StartServer[50]..<SNR>104_StartServer[15]..OmniSharp#proc#Start[2]..OmniSharp#proc#neovimJobStart:
line   12:
E475: Invalid value for argument cmd: '/Users/insert/.cache/omnisharp-vim/omnisharp-roslyn/run' is not executable
f
g
h
i
j
k

trying to just it as expected, i load into nvim, fuzzy find my way to a Test.cs file within a unity project.
i then get the output:

a
b
c
d
e
The OmniSharp server does not appear to be installed. Would you like to install it?
(Y)es, [N]o:

implying it is running, if i then type y i get:

Installing OmniSharp Roslyn, please wait...
OmniSharp-Roslyn v1.39.7 installed to '/Users/insert/.cache/omnisharp-vim/omnisharp-roslyn'
Press ENTER or type command to continue

so i press enter and...

no syntax highlighting, and nothing seems to work. no syntax highlighting, no suggestions, nothing at all except for some of my predone configs like :set rnu and my various hotkeys i have predefined.

if i check the :messages the only thing in their other then the self placed logs is the abcdef logs from above and the omnisharp prompt. and :Omni<c-d> is still returning the same 3 options, install, openlog, and status.

open log is still blank,
install returns:

Installing OmniSharp Roslyn, please wait...
OmniSharp-Roslyn v1.39.7 installed to '/Users/insert/.cache/omnisharp-vim/omnisharp-roslyn'
Press ENTER or type command to continue

status returns "No servers started" still.

being real why is this my luck lol

@nickspoons
Copy link
Member

installed to '/Users/insert/.cache/omnisharp-vim/omnisharp-roslyn'

Has it actually installed though? Is omnisharp-roslyn present and executable at that location? You should be able to run /Users/insert/.cache/omnisharp-vim/omnisharp-roslyn/run on the command line (outside vim)

@vulbyte
Copy link
Author

vulbyte commented Jul 15, 2023

checking the location you specified, there is infact a "run" file. i don't personally know how to run it because i'm not hyper familiar with the terminal, but what i see in that directory you specified is:

  ../
  ./
  omnisharp/
  OmniSharpInstall-version.txt
  license.md
  omnisharp-osx.tar.gz
  run

edit:
when i tried to simply point to the file in the terminal i was told "access denied" to which i thought it might be another permission issue, so i chmod 777 it again just to attempt to see if that would would, and after doing so adn reattempting to open the file, i am now greeted to this list of :messages errors again:

a
b
c
d
e
The OmniSharp server does not appear to be installed. Would you like to install it?

Installing OmniSharp Roslyn, please wait...
OmniSharp-Roslyn v1.39.7 installed to '/Users/insert/.cache/omnisharp-vim/omnisharp-roslyn'
Error detected while processing function <SNR>95_NetrwBrowseChgDir[197]..BufReadPost Autocommands for "*":
Error executing lua callback: ...brew/Cellar/neovim/0.9.1/share/nvim/runtime/filetype.lua:21: Error executing lua: ...brew/Cellar/neovim/0.9.1/share/nvim/runtime/filetype.lua:22: function <SNR>95_NetrwBrowseChgDir[197]..BufReadPost Autocommands for "*"..FileType Autocomma
nds for "*"..function <SNR>1_LoadFTPlugin[21]..script /Users/insert/.local/share/nvim/site/pack/packer/start/omnisharp-vim/ftplugin/cs/OmniSharp.vim[12]..function OmniSharp#StartServerIfNotRunning[5]..OmniSharp#StartServer[50]..<SNR>102_StartServer[15]..OmniSharp#proc#Sta
rt[2]..OmniSharp#proc#neovimJobStart, line 12: Vim(let):E475: Invalid value for argument cmd: '/Users/insert/.cache/omnisharp-vim/omnisharp-roslyn/run' is not executable
stack traceback:
        [C]: in function 'nvim_cmd'
        ...brew/Cellar/neovim/0.9.1/share/nvim/runtime/filetype.lua:22: in function <...brew/Cellar/neovim/0.9.1/share/nvim/runtime/filetype.lua:21>
        [C]: in function 'nvim_buf_call'
        ...brew/Cellar/neovim/0.9.1/share/nvim/runtime/filetype.lua:21: in function <...brew/Cellar/neovim/0.9.1/share/nvim/runtime/filetype.lua:10>
stack traceback:
        [C]: in function 'nvim_buf_call'
        ...brew/Cellar/neovim/0.9.1/share/nvim/runtime/filetype.lua:21: in function <...brew/Cellar/neovim/0.9.1/share/nvim/runtime/filetype.lua:10>
Press ENTER or type command to continue

this makes little sense to me as the files it is calling should be 777'd aswell at this point

@nickspoons
Copy link
Member

Ok well in your second example you've reinstalled the server so that run file that you made executable has now been replaced with a non-executable version.

You've got a strange setup there, I don't know why things are non-executable and I don't use macs or neovim so I can't repro.

But just to test running the server, do this:

cd /path/to/csproj/or/sln
 /Users/insert/.cache/omnisharp-vim/omnisharp-roslyn/run

Replace the path with an actual path to your csharp project. The server should be able to run and show some output.

@vulbyte
Copy link
Author

vulbyte commented Jul 16, 2023

doing what you ask, i had to first rename the run file to run.sh so macOS could actually guess what to do. while adding a small modification to attempt to help the debugging i modified the file as such:

#!/usr/bin/env bash

echo "a"

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

echo 'b'

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

echo 'c'

no_omnisharp=false

echo 'd'

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

echo 'e'

if [ "$no_omnisharp" = true ]; then
    "${mono_cmd}" "$@"
    echo 'e.1'
else
    "${mono_cmd}" "${omnisharp_cmd}" "$@"
    echo 'e.2'
fi

echo 'f: final'

and after testing this is the result:

/Users/insert/.cache/omnisharp-vim/omnisharp-roslyn/run.sh
a
b
c
d
e
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Stdio.Host","Message":"Starting OmniSharp on MacOS 13.4.1 (Unknown)"},"Seq":1,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Services.DotNetCliService","Message":"Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK"},"Seq":2,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Services.DotNetCliService","Message":"Using the 'dotnet' on the PATH."},"Seq":3,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Services.DotNetCliService","Message":"DotNetPath set to dotnet"},"Seq":4,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.Discovery.MSBuildLocator","Message":"Located 0 MSBuild instance(s)"},"Seq":5,"Type":"event"}
Could not locate MSBuild instance to register with OmniSharp.
e.2
f: final

skimming from what is given it seems to have an issue loading 'msbuild', however:

% msbuild --version
Microsoft (R) Build Engine version 16.10.1 for Mono
Copyright (C) Microsoft Corporation. All rights reserved.

16.10.1.51301%                           

which if i check

% which msbuild
/Library/Frameworks/Mono.framework/Versions/Current/Commands/msbuild

and in my ~/.zshrc
reads:

export PATH=/Library/Frameworks/Python.framework/Versions/3.11/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/System/Library/Frameworks/Python:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/opt/homebrew/bin:/opt/homebrew/bin
export PATH="/opt/homebrew/bin:$PATH"
export PATH="/opt/homebrew/bin:$PATH"
export PATH="$HOME/.cargo/bin:$PATH"
export PATH="/usr/local/bin:$PATH"
export PATH="/Library/Frameworks/Mono.framework/Versions/Current/Commands/msbuild:$PATH"

export PATH="/opt/homebrew/sbin:$PATH"

so i'm not followingf why the dots might not be connecting, because as far as i can tell everything with msbuild and dotnet are working correctly. and outside the changes i made to the run.sh file, i'm not literate enough with it to make any informed changes that aren't just firing blindly into the dark hoping for the best.

what do you suggest i might be able to try from here?

@nickspoons
Copy link
Member

There are lots of issues here. Primarily:

  1. You have permissions issues preventing run from executing, and I suspect that there are permissions issues preventing vim from creating it's log files (you say the log is empty).
  2. Omnisharp-roslyn can't find an msbuild it can use.

Before going any further, what kind of project are you going to build? dotnet6/7/8? Or .NET Framework (Unity)? If dotnet, then you should add let g:OmniSharp_server_use_net6 = 1 to your config, restart neovim and then reinstall the server, to install a native dotnet build instead of relying on mono. Then omnisharp-vim will be executing a compiled OmniSharp binary instead of the run.sh script, macos may like that better.

@nickspoons
Copy link
Member

and in my ~/.zshrc

Vim/neovim won't be able to see environment variables you set in .zshrc, you can check by running :echo $PATH in neovim. These should be in e.g. .zshenv

@vulbyte
Copy link
Author

vulbyte commented Jul 16, 2023

"1."
in regards to run i believe i 777'd that whole directory so it should (i think) have fixed that.

"2."
no idea about the omnisharp-roslyn not finding ms build but guessing later attempts to address that

"what proj"
2 mainly, my current tackle is blazor applications. however unity for fun (passion projects) and standalone things would be a huge + ontop of that a i sorta dislike blazor. really trying to move move away from vsc and i enjoy the idea of not needing to use an ide's which i've found to be slow and sorta annoying to work with; and the added bonus of more friendly crossplatform tools as i use linux at home and have a linux server.

if it at all matters, i was pointed here towards this project from this video: https://www.youtube.com/watch?v=FlhNSNMNYOo, so i'm not sure if there's any glaring flaws, but they used macOS aswell and all seemed to run fine.

"check by running :echo $PATH"
after doing so i have this returned

/Users/insert/.local/share/nvim/mason/bin:/opt/homebrew/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands/msbuild:/usr/
local/bin:/Users/insert/.cargo/bin:/opt/homebrew/bin:/opt/homebrew/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/usr/loca
l/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/System/Library/Frameworks/Python:/usr/local/share/dotnet:/Users/inse
rt/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/opt/homebrew/bin:/opt/homebrew/bin

so 🤷 lol, however i added the commands over from my .zshrc file (cause i don't think that'll cause any issues to my knowledge). after adding them and runnign the :echo $PATH i get this out (again i believe)

local/bin:/Users/insert/.cargo/bin:/opt/homebrew/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/usr/local/bin:/System/Cryp
texes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/System/Library/Frameworks/Python:/usr/local/share/dotnet:/Users/insert/.dotnet/tools:/
Library/Frameworks/Mono.framework/Versions/Current/Commands:/opt/homebrew/bin:/opt/homebrew/bin```

"If dotnet"
for fun i added this anyways as a .lua script cause worst case scenario i can turn it off (i think, famous LW)
``vim.g.OmniSharp_server_use_net6 = 1`` should function the same, just called differently.

@nickspoons
Copy link
Member

So did you restart and reinstall the server after vim.g.OmniSharp_server_use_net6 = 1?

@vulbyte
Copy link
Author

vulbyte commented Jul 16, 2023

correct, i did

@nickspoons
Copy link
Member

Ok, do you get anything in :OmniSharpOpenLog with the new server?

What about running /Users/insert/.cache/omnisharp-vim/omnisharp-roslyn/OmniSharp on the command line?

@vulbyte
Copy link
Author

vulbyte commented Jul 16, 2023

correct, i did, now after one prompt to install the roslyn i selected y, then i was never prompted again, just outputting the flags i get confirming it is running. i now have much much more of the Omnisharp settings after poking around, including things like codeformat, debug proj, and more.

if i type :OmniSharpStatus i have returned:
/Users/insert/assets/saveFiles/unity/test/test.sln pid: 7601 loading (0 of 0 projects) for 5 minutes
(progress, yay)

and running omnisharp log i'm now greated this:

NVIM v0.9.1

OmniSharp server started.
    Path: /Users/insert/.cache/omnisharp-vim/omnisharp-roslyn/OmniSharp
    Target: /Users/insert/assets/saveFiles/unity/test/test.sln
    PID: 7601

(more progress, yay)

however the last issue now is i'm welcomed to this:
https://imgur.com/a/8g9YeML
note, for anyone viewing this in the future, if that imgur link is gone, basically every line is an error

@nickspoons
Copy link
Member

So this is a Unity project. net6 won't work for Unity projects, which use .Net Framework

@vulbyte
Copy link
Author

vulbyte commented Jul 16, 2023

ah yes, small brain kicking in lol
i removed the line above simply by commenting it out. i went back into my config file i made for omnisharp, commented out the use net6 part and replaces it with this code:

print("LOADING: ./after/plugin/omnisharp-vim.lua")
-- vim.g.OmniSharp_server_use_net6 = 1
vim.g.OmniSharp_server_use_mono = 1
print("LOADING: ./after/plugin/omnisharp-vim.lua")

(the print statements just so i can verify it's actually being loaded on launching nvim

Error detected while processing :source (no file):
E488: Trailing characters: (: print(
E16: Invalid range: -- vim.g.OmniSharp_server_use_net6 = 1
"OmniSharp_server_use_mono" [New]
Cannot open file "OmniSharp_server_use_mono"
"=" [New]
"1" [New]
Cannot open file "1"
E480: No match: g
E488: Trailing characters: (: print(

so i moved the settings into the init.lua file within ~/.config/nvim/init.lua which cleared the errors.

i also just added other flags i could think of just to make life easier

vim.g.OmniSharp_server_use_net6 = 0
vim.g.OmniSharp_server_use_net7 = 0
vim.g.OmniSharp_server_use_net8 = 0

vim.g.OmniSharp_server_use_mono = 1

after doing so i loaded a unity and started the server and saw it was loading, so i let it load, then after attempting to type literally every key i pressed gave me this error:

E5248: Invalid character in group name
E5248: Invalid character in group name
Press ENTER or type command to continue

edit: and the same "whole file error" dispite restarting the omnisharp server

@nickspoons
Copy link
Member

Let's see the command line output of running the server directly, outside vim.

It would be interesting to add the debug loglevel flag:

/Users/insert/.cache/omnisharp-vim/omnisharp-roslyn/OmniSharp -l debug

@nickspoons
Copy link
Member

It would be quite helpful to see your actual config. Are you by any chance running other lsp services at the same time?

@vulbyte
Copy link
Author

vulbyte commented Jul 16, 2023

here you are for the command you mentioned -l debug:

A fatal error occurred. The required library libhostfxr.dylib could not be found.
If this is a self-contained application, that library should exist in [/Users/insert/.cache/omnisharp-vim/omnisharp-roslyn/].
If this is a framework-dependent application, install the runtime in the global location [/usr/local/share/dotnet/x64] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet/install_location].

The .NET runtime can be found at:
  - https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=arm64&rid=osx.11.2-arm64&apphost_version=6.0.0-preview.7.21317.1

if you wanna see ym config i actually made a github repo so i can easily sync my desktop and laptop, you can see the repo here: https://github.com/vulbyte/nvimConfig

edit 1:
the main file you should care about is:
./lua/vulbyte/packer

@nickspoons
Copy link
Member

Ok so you do have nvim lsp in there, which is quite possibly conflicting with omnisharp-vim, I suspect that's where the E5248: Invalid character in group name is coming from

@vulbyte
Copy link
Author

vulbyte commented Jul 16, 2023

sorry, do you mean lsp-zero, or specifically nvim lsp (one part askign for myself, other part for future people who might read this)

edit 1:
tried lsp-zero and that did nothing

@nickspoons
Copy link
Member

I don't know what all of your plugins do. It would be really helpful to comment out everything except omnisharp-vim to concentrate on getting it working. Alternatively, commenting out omnisharp-vim to see if that E5248: Invalid character in group name error happens without it.

Regarding the omnisharp-roslyn output, that error doesn't look good, the server is crashing. If the server can't run from the command line then it can't run from vim either. Is that the full output you got or just part of it?

@vulbyte
Copy link
Author

vulbyte commented Jul 16, 2023

most of the plugins are seperated, this is probably the first that has any significant overlap with another (the other being lsp zero).

to if it was actually omnisharp as you mentioned, i removed it from the packer.lua file and ran :PackerSync which promted me to remove the omnisharp directory, which i prompted y to so there should be nothign running.
after doing so and going back into the unity test proj; the same errors seemed to happen."

so my first immediate thing is that i should probably try disable lsp-zero for .cs files.
to do so i first went into :Mason which automajically manages my lsp's, then uninstalled any cs/omnisharp related ls's. and after restarting nvim those errors went away, so now then i attempted to re-add omnisharp-vim and see if that does anything.

successfully reinstalled,
and after re-opening i reopened the test .cs proj, to which i was met with:

Error detected while processing function <SNR>98_NetrwBrowseChgDir:
line  197:
E325: ATTENTION
stderr: ['A fatal error occurred. The required library libhostfxr.dylib could not be found.', 'If this is a self-contained application, that library should exist in [/Users/insert/.cache/omnisharp-vim/omnisharp-roslyn/].', 'If this is a framework-dependent application, in
stall the runtime in the global location [/usr/local/share/dotnet/x64] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet/install_location].', '', 'The .NET runtime can be found at:', '  - https://a
ka.ms/dotnet-core-applaunch?missing_runtime=true&arch=arm64&rid=osx.11.2-arm64&apphost_version=6.0.0-preview.7.21317.1', '']

so after seeing that i looked up the file libhostfxr.dylib and found this thread:
dotnet/efcore#26663
which then led me here:
dotnet/efcore#27787

and that just seems way over my head and doesn't seem to have any clear resolution (and is 2 years old at this point so i imagine it would be resolved by now. so from here i'm not quite sure where to go

@nickspoons
Copy link
Member

Nice job, that's good to confirm that it was other plugins causing those editor errors

The libhostfxr.dylib error is the same one you were getting running omnisharp-roslyn from the command line so that's the issue here.

@nickspoons
Copy link
Member

It's peculiar though because this should be the mono build of omnisharp-roslyn and shouldn't be talking about DOTNET at all. I wonder if it's picking the wrong msbuild? Could you post the full output of running the server on the command line with -l debug?

@vulbyte
Copy link
Author

vulbyte commented Jul 17, 2023

of course this is the error that prints out with the command i used:

 % /Users/insert/.cache/omnisharp-vim/omnisharp-roslyn/OmniSharp -l debug
A fatal error occurred. The required library libhostfxr.dylib could not be found.
If this is a self-contained application, that library should exist in [/Users/insert/.cache/omnisharp-vim/omnisharp-roslyn/].
If this is a framework-dependent application, install the runtime in the global location [/usr/local/share/dotnet/x64] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet/install_location].

The .NET runtime can be found at:
  - https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=arm64&rid=osx.11.2-arm64&apphost_version=6.0.0-preview.7.21317.1

@nickspoons
Copy link
Member

That looks like the net6 build. You were going to go back to the mono build, right? In which case you need to remove the ...use_net6 =1 and reinstall the server, and then run it using the run script, not the OmniSharp executable

@nickspoons
Copy link
Member

Don't worry about the .NET SDK requires MSBuild instances version 17.4.0 or higher warning, I can see in my own logs that omnisharp-roslyn can give that warning but still run fine with Mono 16.10.1.

This is what that section of the log should look like:

[dbug]: OmniSharp.CompositionHostBuilder
        .NET SDK requires MSBuild instances version 17.0.0 or higher
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: Mono 16.10.1 - "/usr/lib/mono/msbuild/Current/bin"
[dbug]: OmniSharp.CompositionHostBuilder
        MSBuild instance Mono 16.10.1 scored at 2
[warn]: OmniSharp.CompositionHostBuilder
        It looks like you have Mono installed which contains a MSBuild lower than 17.0.0 which is the minimum supported by the configured .NET Core Sdk.
 Try updating Mono to the latest stable or preview version to enable better .NET Core Sdk support.
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Mono 16.10.1 - "/usr/lib/mono/msbuild/Current/bin"
[dbug]: OmniSharp.WorkspaceInitializer
        Starting with OmniSharp options: ...

@vulbyte
Copy link
Author

vulbyte commented Jul 27, 2023

edited by nickspoons to fix markup


sorry for not specifying this, both actually have the let g:OmniSharp_loglevel = 'debug' enabled, it's just that for whatever reason with ..use_mono = 1 it doesn't actually output a log. typing :OmniSharpOpenLog with 0 links me files (which are the log files located here:

/Users/insert/.local/share/nvim/site/pack/packer/start/omnisharp-vim/log/202307171249_50350_omnisharp.log
/Users/insert/.local/share/nvim/site/pack/packer/start/omnisharp-vim/log/202307171254_50421_omnisharp.log
/Users/insert/.local/share/nvim/site/pack/packer/start/omnisharp-vim/log/202307261707_73729_omnisharp.log
/Users/insert/.local/share/nvim/site/pack/packer/start/omnisharp-vim/log/202307261943_79880_omnisharp.log

) while 1 simply outputs directly into nvim like before, and i can toggle it back and forth and has been repeatable each time.

as for when you specified: "You are trying to run mono/.NET Framework, not dotnet. So you need to find an MSBuild package for your OS. NOT the dotnet msbuild." which to me isn't super clear (small brain issues), so you simply mean redownloading the dotnet sdk from https://dotnet.microsoft.com/en-us/download?

@nickspoons
Copy link
Member

The ..._use_mono settings and the ..._use_net6 settings are for using different versions of the server, so any time you change them, you need to re-install the server, are you doing that?

so you simply mean redownloading the dotnet sdk from https://dotnet.microsoft.com/en-us/download?

No. There are 2 completely different .NET environments: .NET Framework (old and obsolete but still used by Unity, supported on *nix by mono) and dotnet (also called .NET Core for a while). If you were just using dotnet then this would all be simpler, but you're trying to use .NET Framework with mono. In this case you need a mono version of MSBuild, and according to that output from omnisharp-roslyn you don't have one.

Reinstalling dotnet isn't going to help here. dotnet has its own version of MSBuild but that is not compatible with .NET Framework/mono.

@nickspoons
Copy link
Member

Try creating a ~/.omnisharp/omnisharp.json like this:

{
    "MSBuild": {
        "MSBuildOverride": {
            "MSBuildPath": "/Library/Frameworks/Mono.framework/Versions/Current/Commands",
            "Name": "Mono msbuild, path overridden in omnisharp.json"
        }
    }
}

(from OmniSharp/omnisharp-roslyn#1545 (comment) )

@vulbyte
Copy link
Author

vulbyte commented Jul 27, 2023

edited by nickspoons to fix markup


The ..._use_mono settings and the ..._use_net6 settings are for using different versions of the server, so any time you change them, you need to re-install the server, are you doing that?

yes* so i haven't been doing it each and every time because i honestly don't know how to specifically, however it has been asking pretty commonly to Install Omnishart? so even without redownloading/installing it should still be frequent enought that it isn't an issue i think™️; i have been restarting vim each time tho.

the omnisharp explanation

ah yes, just like "product" and "product scarlette", 2 very easy to tell apart names (lol), i've honestly seen them and thought they were all just the same thing akin to how ppl call react a library, framework, and a cluster of that stuff

try creating a ~/.omnisharp/omnisharp.json

okay, i actually noticed the whole folder is actually empty so that's wonderful, adding that now

spongebob esc time later joke

  • started up the project and nvim again,
  • asked to install again, said yes
  • installed with no log, so running :OmniSharpOpenLog i read: nothing
    not even an install error, no syntax highlighting, nothing, so i check the log location incase there's something their and;
    nothing

so :qa! and try it again and:
this time an inline error:

The OmniSharp server does not appear to be installed. Would you like to install it?

Installing OmniSharp Roslyn, please wait...
OmniSharp-Roslyn v1.39.8 installed to '/Users/insert/.cache/omnisharp-vim/omnisharp-roslyn'
Error detected while processing function <SNR>98_NetrwBrowseChgDir[197]..BufReadPost Autocommands for "*":
Error executing lua callback: ...brew/Cellar/neovim/0.9.1/share/nvim/runtime/filetype.lua:21:
    Error executing lua: ...brew/Cellar/neovim/0.9.1/share/nvim/runtime/filetype.lua:22:
    function <SNR>98_NetrwBrowseChgDir[197]
    ..BufReadPost Autocommands for "*"
    ..FileType Autocommands for "*"
    ..function <SNR>1_LoadFTPlugin[21]
    ..script /Users/insert/.local/share/nvim/site/pack/packer/start/omnisharp-vim/ftplugin/cs/OmniSharp.vim[7]
    ..function OmniSharp#StartServerIfNotRunning[5]
    ..OmniSharp#StartServer[50]
    ..<SNR>105_StartServer[15]
    ..OmniSharp#proc#Start[2]
    ..OmniSharp#proc#neovimJobStart, line 12:
    Vim(let):E475: Invalid value for argument cmd: '/Users/insert/.cache/omnisharp-vim/omnisharp-roslyn/run' is not executable
stack traceback:
        [C]: in function 'nvim_cmd'
        ...brew/Cellar/neovim/0.9.1/share/nvim/runtime/filetype.lua:22: in function <...brew/Cellar/neovim/0.9.1/share/nvim/runtime/filetype.lua:21>
        [C]: in function 'nvim_buf_call'
        ...brew/Cellar/neovim/0.9.1/share/nvim/runtime/filetype.lua:21: in function <...brew/Cellar/neovim/0.9.1/share/nvim/runtime/filetype.lua:10>
stack traceback:
        [C]: in function 'nvim_buf_call'
        ...brew/Cellar/neovim/0.9.1/share/nvim/runtime/filetype.lua:21: in function <...brew/Cellar/neovim/0.9.1/share/nvim/runtime/filetype.lua:10>

so now we seem to be back at the same issue as before, with Vim(let):E475: Invalid value for argument cmd: '/Users/insert/.cache/omnisharp-vim/omnisharp-roslyn/run' is not executable, so attempting to run it via: cd /Users/insert/.cache/omnisharp-vim/omnisharp-roslyn dotnet build -c Release i get the following:

MSBuild version 17.6.8+c70978d4d for .NET
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.

so it at least seems to be working, so attempting teh same dotnet build -c Release in the unity project give me the error:
same error as above

at this point i'm unsure why this is happening again, and am sorta stuck spinning wheels again (sadly)

@nickspoons
Copy link
Member

The non-executable run file is an omnisharp-roslyn big. It has been fixed today but won't be available until the next release. However I have also added a chmod +x to omnisharp-vim so update omnisharp-vim plugin to resolve that one (next time you install the server.).

@nickspoons
Copy link
Member

cd /Users/insert/.cache/omnisharp-vim/omnisharp-roslyn dotnet build -c Release

What are you trying to do here? You cd into the server directly and then run dotnet build?

To run the server on the command line, cd into your project directory where your .csproj/.sln are, then run the server mono /Users/insert/.cache/omnisharp-vim/omnisharp-roslyn/OmniSharp.exe

@nickspoons
Copy link
Member

so i haven't been doing it each and every time because i honestly don't know how to specifically

:OmniSharpInstall

@vulbyte
Copy link
Author

vulbyte commented Jul 27, 2023

edited by nickspoons to fix markup


okay, updated the omnisharp-vim plugin which read out:

✓ Updated OmniSharp/omnisharp-vim: 5ce2674..9c12ecc
  URL: https://github.com/OmniSharp/omnisharp-vim
  Commits:
    9c12ecc Drop unsupported python 2.7 tox action completely (9 days ago)
    5bdee70 Drop unsupported python 2.7 tox action (9 days ago)
    ffc417a Ensure installed server `run` script is executable (9 days ago)

so it looks like it should be good (i'll touch more on this in a sec, typing as i read),

what are you trying to do? [...]

basically, my misunderstand but that's valid, not super familliar with local stuff, most of my experiance is higher level stuff like html/css/js so i'm not great with this command line stuff yet, thank you creately for the verification.

:OmniSharpInstall

ah yes, small brain moment

testing omnisharp-vim after the new update
cd into project, nvim, load a .cs file, in the output reads:

The OmniSharp server does not appear to be installed. Would you like to install it?

Installing OmniSharp Roslyn, please wait...
OmniSharp-Roslyn v1.39.8^@https://github.com/OmniSharp/omnisharp-roslyn/releases/download/v1.39.8/omnisharp-osx.tar.gz installed to '/Users/insert/.cache/omnisharp-vim/omnisharp-roslyn'

syntax highlighting is back, opening :OmniSharpOpenLog because there's no output file again returns:

NVIM v0.9.1

OmniSharp server started.
    Path: /Users/insert/.cache/omnisharp-vim/omnisharp-roslyn/run
    Target: /Users/insert/assets/saveFiles/unity/test/test.sln
    PID: 84634
    Command: /Users/insert/.cache/omnisharp-vim/omnisharp-roslyn/run -s /Users/insert/assets/saveFiles/unity/test/test.sln -l debug -e utf-8

Request: /updatebuffer
[dbug]: OmniSharp.CompositionHostBuilder
        Loaded OmniSharp.Cake, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
[dbug]: OmniSharp.CompositionHostBuilder
        Loaded OmniSharp.DotNetTest, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
[dbug]: OmniSharp.CompositionHostBuilder
        Loaded OmniSharp.Host, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
[dbug]: OmniSharp.CompositionHostBuilder
        Loaded OmniSharp.MSBuild, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
[dbug]: OmniSharp.CompositionHostBuilder
        Loaded OmniSharp.Roslyn, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
[dbug]: OmniSharp.CompositionHostBuilder
        Loaded OmniSharp.Roslyn.CSharp, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
[dbug]: OmniSharp.CompositionHostBuilder
        Loaded OmniSharp.Script, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
[dbug]: OmniSharp.CompositionHostBuilder
        Loaded OmniSharp.Shared, Version=1.39.0.0, Culture=neutral, PublicKeyToken=7e5bf7b3b470b509
[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on MacOS 13.4.1 (x64)
[info]: OmniSharp.Services.DotNetCliService
        Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
        Using the 'dotnet' on the PATH.
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[dbug]: OmniSharp.CompositionHostBuilder
        .NET SDK requires MSBuild instances version 17.4.0 or higher

which is promising, no lsp suggestions however, so after checking :messages i was greeted to:

Error detected while processing function <SNR>98_NetrwBrowseChgDir:
line  197:
E325: ATTENTION
stderr: System.IO.FileNotFoundException: /Library/Frameworks/Mono.framework/Versions/Current/Commands/Microsoft.Build.dll
  at System.Diagnostics.FileVersionInfo.GetVersionInfo (System.String fileName) [0x0000d] in <3d05db74c0154ea0ba79ffba6c4417f9>:0
  at OmniSharp.MSBuild.Discovery.MSBuildInstanceProvider.GetMSBuildVersion (System.String microsoftBuildPath) [0x00000] in <0fc46f3a737b4f7b8012aaae06dada70>:0
  at OmniSharp.MSBuild.Discovery.Providers.UserOverrideInstanceProvider.GetInstances () [0x00035] in <0fc46f3a737b4f7b8012aaae06dada70>:0
  at OmniSharp.MSBuild.Discovery.MSBuildLocator.GetInstances () [0x0001b] in <0fc46f3a737b4f7b8012aaae06dada70>:0
  at OmniSharp.MSBuild.Discovery.Extensions.GetBestInstance (OmniSharp.MSBuild.Discovery.IMSBuildLocator msbuildLocator, System.Version minimumMSBuildVersion, Microsoft.Extensions.Logging.ILogger logger, System.Boolean& invalidVSFound, System.Boolean& vsWithoutSdkResolver) [0x0000b] in <0fc46f3a737b4f7b8012aaae06dada70>:0
  at OmniSharp.MSBuild.Discovery.Extensions.RegisterDefaultInstance (OmniSharp.MSBuild.Discovery.IMSBuildLocator msbuildLocator, Microsoft.Extensions.Logging.ILogger logger, OmniSharp.Services.DotNetInfo dotNetInfo) [0x0001e] in <0fc46f3a737b4f7b8012aaae06dada70>:0
  at OmniSharp.CompositionHostBuilder.Build (System.String workingDirectory) [0x000ad] in <0fc46f3a737b4f7b8012aaae06dada70>:0
  at OmniSharp.Stdio.Host..ctor (System.IO.TextReader input, OmniSharp.Services.ISharedTextWriter writer, OmniSharp.IOmniSharpEnvironment environment, System.IServiceProvider serviceProvider, OmniSharp.CompositionHostBuilder compositionHostBuilder, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, System.Threading.CancellationTokenSource cancellationTokenSource) [0x00065] in <72716602499640c9b48919f1662633a0>:0
  at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_1.<Main>b__1 () [0x0017d] in<1440b8f7ec1643f6a3bdc25fb0a6c62e>:0
  at OmniSharp.CommandLineApplication+<>c__DisplayClass12_0.<OnExecute>b__0 () [0x0000b] in <0fc46f3a737b4f7b8012aaae06dada70>:0
  at McMaster.Extensions.CommandLineUtils.CommandLineApplication+<>c__DisplayClass146_0.<OnExecute>b__0 (System.Threading.CancellationToken _) [0x00000] in <abe0fc6797a94a73931eea5cecaffd78>:0
  at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync (System.String[] args, System.Threading.CancellationToken cancellationToken) [0x000bf] in <abe0fc6797a94a73931eea5cecaffd78>:0
  at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute (System.String[] args) [0x00016] in <abe0fc6797a94a73931eea5cecaffd78>:0
  at OmniSharp.CommandLineApplication.Execute (System.String[] args) [0x00081] in <0fc46f3a737b4f7b8012aaae06dada70>:0
  at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_0.<Main>b__0 () [0x00028] in <1440b8f7ec1643f6a3bdc25fb0a6c62e>:0
  at OmniSharp.HostHelpers.Start (System.Func`1[TResult] action) [0x0001c] in <0fc46f3a737b4f7b8012aaae06dada70>:0

which seems very off, and i don't understand what these mean, but they seem similar to .json errors i've seen before, so i'll disable the ~/.omnisharp/omnisharp.json script to see if that does anything notable,

and after doing so; no issues in messages, yay! however no syntax highlighting, so i'll attempt to reinstall using :OmniSharpInstall and see if that improves anything.

after waiting approximately 10 seconds, i check :messages again, to which (cutting out unrelated things i know for a fact aren't related) i'm greeted to:

Loaded server for /Users/insert/assets/saveFiles/unity/test/test.sln in 19.4s
OmniSharp-Roslyn v1.39.8^@https://github.com/OmniSharp/omnisharp-roslyn/releases/download/v1.39.8/omnisharp-osx.tar.gz installed to '/Users/insert/.cache/omnisharp-vim/omnisharp-roslyn'

with no errors, which seems great, however there are still no lsp suggestions, and the highlighting even after a reinstall and restarting nvim is... weird:
undefined - Imgur
(for anyone reading this in the footage, the highlighting is mostly working, but serialize field has a gradient instead of being a flat color [which i don't hate but don't think is intentional], random things being highlighted inconsistently, such as 2 components that have the "[SerializeField] flag, one is highlighted but the other isn't and other oddities

this script is working still in unity so there shouldn't be any oddities causing the lsp to "trip", and even then where it does trip seems very odd.

i don't think i have the built in lsp enabled if that's something needed for this, but this still feels... odd.
do you have any suggestions for what might be causing this or how to fix this?

@nickspoons
Copy link
Member

nickspoons commented Jul 27, 2023

I think you're flailing about a bit much, I don't understand a lot of the things you're trying.

:OmniSharpOpenLog because there's no output file again

What does this mean? What kind of output for are you expecting? :OmniSharpOpenLog is the correct way to open the log.

Your log stops before it gets to the bit about which version of msbuild it has found which I don't understand. Did you post the full log? You need an msbuild and omnisharp-roslyn doesn't seem to be about to find it itself so you do need that omnisharp.json file, don't disable it.

there are still no lsp suggestions

How are you requesting lsp suggestions? Omnisharp-vim is very similar to an LSP client but is not an LSP client (it predates LSP).

@nickspoons
Copy link
Member

After formatting so I could read the errors and logs properly, the error you are getting in your :messages output starts with this:

System.IO.FileNotFoundException: /Library/Frameworks/Mono.framework/Versions/Current/Commands/Microsoft.Build.dll

Once again this looks like MSBuild has not been installed in a way that omnisharp-roslyn expects. The path I suggested for your omnisharp.json file could very well be wrong, I'm guessing as I don't know what your filesystem looks like. Try and see if that Microsoft.Build.dll file exists somewhere under /Library/Frameworks/Mono.framework/.

It could be worth trying a "manual" install of mono from www.mono-project.com rather than homebrew.

@nickspoons
Copy link
Member

The highlighting definitely looks weird. In fact ... it looks like the highlighting is out by 2 lines. If you imagine taking the highlights and moving them down 2 lines they work. How that can be the case I don't know ... but I think it's a good idea to leave that for now, until you can confirm from the logs that the correct server is in place and is talking to msbuild etc.

@vulbyte
Copy link
Author

vulbyte commented Jul 27, 2023

edited by nickspoons to fix markdown formatting


I think you're flailing about a bit much, I don't understand a lot of the things you're trying.

aplogogies, just sorta sharing what i see and think what i'm supposed to do, adn trying to take my own steps to attempt to fix this instead of just being like "you fix it for me" but i can back off if you would prefer

What does this mean? What kind of output for are you expecting?

within my omnisharp config i still have:

vim.g.OmniSharp_loglevel = 'debug'

which should output to a log file, but it only does so if i have vim.g.OmniSharp_server_use_mono = 1 but right now it's set to 0, so it doesn't output a file for whatever reason.

Your log stops before it gets to the bit about which version of msbuild it has found which I don't understand. Did you post the full log? You need an msbuild and omnisharp-roslyn doesn't seem to be about to find it itself so you do need that omnisharp.json file, don't disable it.

each time i have copy pasted a log, the only things i have omitted is stuff i know you wouldn't care about such as my print statements to make sure all my files are loading correctly. if i'm even remotely unsure about it i've included it.

as for the omnisharp.json i'll reinable that and try again. so after install mono, still no logs so typing :messages

Error detected while processing function <SNR>98_NetrwBrowseChgDir:
line  197:
E325: ATTENTION
stderr: System.IO.FileNotFoundException: /Library/Frameworks/Mono.framework/Versions/Current/Commands/Microsoft.Build.dll
  at System.Diagnostics.FileVersionInfo.GetVersionInfo (System.String fileName) [0x0000d] in <82bec50af1654ae3a3e8652d3a37f39f>:0
  at OmniSharp.MSBuild.Discovery.MSBuildInstanceProvider.GetMSBuildVersion (System.String microsoftBuildPath) [0x00000] in <0fc46f3a737b4f7b8012aaae06dada70>:0
  at OmniSharp.MSBuild.Discovery.Providers.UserOverrideInstanceProvider.GetInstances () [0x00035] in <0fc46f3a737b4f7b8012aaae06dada70>:0
  at OmniSharp.MSBuild.Discovery.MSBuildLocator.GetInstances () [0x0001b] in <0fc46f3a737b4f7b8012aaae06dada70>:0
  at OmniSharp.MSBuild.Discovery.Extensions.GetBestInstance (OmniSharp.MSBuild.Discovery.IMSBuildLocator msbuildLocator, System.Version minimumMSBuildVersion, Microsoft.Extensions.Logging.ILogger logger, System.Boolean& invalidVSFound, System.Boolean& vsWithoutSdkResolver) [0x0000b] in <0fc46f3a737b4f7b8012aaae06dada70>:0
  at OmniSharp.MSBuild.Discovery.Extensions.RegisterDefaultInstance (OmniSharp.MSBuild.Discovery.IMSBuildLocator msbuildLocator, Microsoft.Extensions.Logging.ILogger logger, OmniSharp.Services.DotNetInfo dotNetInfo) [0x0001e] in <0fc46f3a737b4f7b8012aaae06dada70>:0
  at OmniSharp.CompositionHostBuilder.Build (System.String workingDirectory) [0x000ad] in <0fc46f3a737b4f7b8012aaae06dada70>:0
  at OmniSharp.Stdio.Host..ctor (System.IO.TextReader input, OmniSharp.Services.ISharedTextWriter writer, OmniSharp.IOmniSharpEnvironment environment, System.IServiceProvider serviceProvider, OmniSharp.CompositionHostBuilder compositionHostBuilder, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, System.Threading.CancellationTokenSource cancellationTokenSource) [0x00065] in <72716602499640c9b48919f1662633a0>:0
  at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_1.<Main>b__1 () [0x0017d] in<1440b8f7ec1643f6a3bdc25fb0a6c62e>:0
  at OmniSharp.CommandLineApplication+<>c__DisplayClass12_0.<OnExecute>b__0 () [0x0000b] in <0fc46f3a737b4f7b8012aaae06dada70>:0
  at McMaster.Extensions.CommandLineUtils.CommandLineApplication+<>c__DisplayClass146_0.<OnExecute>b__0 (System.Threading.CancellationToken _) [0x00000] in <abe0fc6797a94a73931eea5cecaffd78>:0
  at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync (System.String[] args, System.Threading.CancellationToken cancellationToken) [0x000bf] in <abe0fc6797a94a73931eea5cecaffd78>:0
  at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute (System.String[] args) [0x00016] in <abe0fc6797a94a73931eea5cecaffd78>:0
  at OmniSharp.CommandLineApplication.Execute (System.String[] args) [0x00081] in <0fc46f3a737b4f7b8012aaae06dada70>:0
  at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_0.<Main>b__0 () [0x00028] in <1440b8f7ec1643f6a3bdc25fb0a6c62e>:0
  at OmniSharp.HostHelpers.Start (System.Func`1[TResult] action) [0x0001c] in <0fc46f3a737b4f7b8012aaae06dada70>:0

above is pre :OmniSharpInstall below is post :OmniSharpInstall

OmniSharp-Roslyn v1.39.8^@https://github.com/OmniSharp/omnisharp-roslyn/releases/download/v1.39.8/omnisharp-osx.tar.gz installed to '/Users/insert/.cache/omnisharp-vim/omnisharp-roslyn'
Server load notification for /Users/insert/assets/saveFiles/unity/test/test.sln not received after 180 seconds - continuing.
Press ENTER or type command to continue

syntax highlighting now seems to be fixed, however still no suggestions/lsp goodness.

edit: outside the highlighting which now looks fixed

@nickspoons
Copy link
Member

But your server is crashing and has been for a long time, you don't have a valid msbuild available. Any highlighting you are seeing is not coming from omnisharp-vim, which isn't getting anything from the server.

If I were you I'd be moving my entire nvim config to a .bak directory and trying to create a minimal init.vim that you know contains nothing but omnisharp-vim.

@vulbyte
Copy link
Author

vulbyte commented Jul 27, 2023

okay, my isse is i'm not sure to resolve this, as i've mentioned before when i run MSbuild --version i get:

Microsoft (R) Build Engine version 16.10.1 for Mono
Copyright (C) Microsoft Corporation. All rights reserved.

16.10.1.31401%                

and i just reinstalled it using the stable mono branch, and i'm unsure what to do

edit 1: i also have 0 idea where the highlighting is coming from, as i tested something which made omnisharp-vim not even load and there was no highlighting anymore so idk what's up with it

edit 2: after prodding gpt cause i'm getting floundering right now, it gave me these commands:

cd /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/Current/bin
ls Microsoft.Build.dll

and trurned:

Microsoft.Build.dll

so to my understanding, i have the file exactly where omni is looking, but it isn't reading it for whatever reason. (as far as i know .dll's are a windows thing, so is it something where it's giving me windowsOS files while i'm on macOS and that's causing it to just crap the bed?

@nickspoons
Copy link
Member

nickspoons commented Jul 27, 2023

But is that path to Microsoft.Build.dll the one you have in your omnisharp.json? I don't think you have that full /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/Current/bin, do you?

@vulbyte
Copy link
Author

vulbyte commented Jul 27, 2023

i believe i do, it exists and has a bunch of files. if i ls that directory i get this:

ls /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/Current/bin
MSBuild.dll                                             Microsoft.NET.StringTools.dll.config                    SdkResolvers
MSBuild.dll.config                                      Microsoft.NET.props                                     SdkVersions.Details.xml
MSBuild.rsp                                             Microsoft.NETCoreSdk.BundledVersions.props              Sdks
Microsoft.Bcl.AsyncInterfaces.dll                       Microsoft.NETFramework.CurrentVersion.props             System.Buffers.dll
Microsoft.Build.Framework.dll                           Microsoft.NETFramework.CurrentVersion.targets           System.Collections.Immutable.dll
Microsoft.Build.Framework.xml                           Microsoft.NETFramework.props                            System.Configuration.ConfigurationManager.dll
Microsoft.Build.NuGetSdkResolver.dll                    Microsoft.NETFramework.targets                          System.Memory.dll
Microsoft.Build.Tasks.Core.dll                          Microsoft.ServiceModel.targets                          System.Numerics.Vectors.dll
Microsoft.Build.Tasks.Core.dll.config                   Microsoft.VisualBasic.CrossTargeting.targets            System.Reflection.Metadata.dll
Microsoft.Build.Tasks.Core.xml                          Microsoft.VisualBasic.CurrentVersion.targets            System.Resources.Extensions.dll
Microsoft.Build.Tasks.v12.0.dll                         Microsoft.VisualBasic.Mono.targets                      System.Runtime.CompilerServices.Unsafe.dll
Microsoft.Build.Tasks.v4.0.dll                          Microsoft.VisualBasic.targets                           System.Security.AccessControl.dll
Microsoft.Build.Utilities.Core.dll                      Microsoft.VisualStudio.Setup.Configuration.Interop.dll  System.Security.Permissions.dll
Microsoft.Build.Utilities.Core.dll.config               Microsoft.Web.XmlTransform.dll                          System.Security.Principal.Windows.dll
Microsoft.Build.Utilities.Core.xml                      Microsoft.WinFx.targets                                 System.Text.Encodings.Web.dll
Microsoft.Build.Utilities.v12.0.dll                     Microsoft.WorkflowBuildExtensions.targets               System.Text.Json.dll
Microsoft.Build.Utilities.v4.0.dll                      Microsoft.Xaml.targets                                  System.Threading.Tasks.Dataflow.dll
Microsoft.Build.dll                                     Newtonsoft.Json.dll                                     System.Threading.Tasks.Extensions.dll
Microsoft.Build.dll.config                              NuGet.Build.Tasks.dll                                   System.ValueTuple.dll
Microsoft.Build.xml                                     NuGet.Commands.dll                                      Workflow.VisualBasic.targets
Microsoft.Build.xsd                                     NuGet.Common.dll                                        Workflow.targets
Microsoft.CSharp.CrossTargeting.targets                 NuGet.Configuration.dll                                 cs
Microsoft.CSharp.CurrentVersion.targets                 NuGet.Credentials.dll                                   de
Microsoft.CSharp.Mono.targets                           NuGet.DependencyResolver.Core.dll                       en
Microsoft.CSharp.targets                                NuGet.Frameworks.dll                                    es
Microsoft.Common.CrossTargeting.targets                 NuGet.LibraryModel.dll                                  fr
Microsoft.Common.CurrentVersion.targets                 NuGet.PackageManagement.dll                             it
Microsoft.Common.Mono.targets                           NuGet.Packaging.dll                                     ja
Microsoft.Common.overridetasks                          NuGet.ProjectModel.dll                                  ko
Microsoft.Common.targets                                NuGet.Protocol.dll                                      pl
Microsoft.Common.tasks                                  NuGet.Resolver.dll                                      pt-BR
Microsoft.Data.Entity.targets                           NuGet.Versioning.dll                                    ru
Microsoft.Managed.After.targets                         NuGet.props                                             tr
Microsoft.Managed.Before.targets                        NuGet.targets                                           zh-Hans
Microsoft.Managed.targets                               Roslyn                                                  zh-Hant
Microsoft.NET.StringTools.dll                           RuntimeIdentifierGraph.json

@nickspoons
Copy link
Member

as far as i know .dll's are a windows thing, so is it something where it's giving me windowsOS files while i'm on macOS and that's causing it to just crap the bed?

No, C# produces DLLs on any OS, that's fine.

@nickspoons
Copy link
Member

I posted this as an edit to an earlier comment but you may have missed it so here it is as a separate comment

Here is the path from your System.IO.FileNotFoundException error:

/Library/Frameworks/Mono.framework/Versions/Current/Commands/Microsoft.Build.dll

Here is the file on your filesystem according to what you just posted:

/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/Current/bin/Microsoft.Build.dll

So update your ~/.omnisharp/omnisharp.json to this:

{
    "MSBuild": {
        "MSBuildOverride": {
            "MSBuildPath": "/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/Current/bin",
            "Name": "Mono msbuild, path overridden in omnisharp.json"
        }
    }
}

@nickspoons
Copy link
Member

I just realised you must have vim.g.OmniSharp_proc_debug = 1 in your config. Please remove that, it is not useful here, it's really only for plugin development purposes, and it's affecting your logs.

@vulbyte
Copy link
Author

vulbyte commented Jul 27, 2023

with that clumsy small brain moment fixed, and i then checked the log again and was greeted to:
https://pastebin.com/ pasting their cause it's like 20k lines which i think means it's working). so i think it's working fine now, so my follow up question (because i think this is thankfully end of the line) how do i enable such things as lsp suggestions, errors, and the like?

edit: assuming i have a setting not enabled or something simple

edit2: fixed link error

@nickspoons
Copy link
Member

Your link is broken. Remember, in markdown, links are like this: [text](url), not the other way around. Also, inline quotes get just a single backtick around them, not double backticks, and quoted blocks should have a triple backtick on a line by itself (not inline) and also require an empty line above and below

@nickspoons
Copy link
Member

pasting their cause it's like 20k lines

Try vim.g.OmniSharp_loglevel = 'DEBUG' instead of vim.g.OmniSharp_loglevel = 'debug'. That will output all server logging but not the actual request and response content json. That will bring your log size right down, you don't need to be logging requests and responses.

@nickspoons
Copy link
Member

lsp suggestions

I've asked you this before but what do you mean by this? Do you mean completion suggestions as you type?

errors, and the like

OmniSharp-vim doesn't provide auto-completion or error highlighting by itself, it integrates with other plugins for that.

For errors, use ALE. There are various options for completion but f you aren't using one already I'd recommend asyncomplete.

Take a look at the Example config which has error linting, autocompletion, lightline integration, plus uses vim-sharpenup to create mappings etc.

@vulbyte
Copy link
Author

vulbyte commented Jul 27, 2023

Your link is broken. Remember, in markdown, links are like this: text, not the other way around. Also, inline quotes get just a single backtick around them, not double backticks, and quoted blocks should have a triple backtick on a line by itself (not inline) and also require an empty line above and below
my bad, first time really having any extensive use with md so non of this is really ingrained yet.

Try [...]
the log for that reads:

https://drive.google.com/file/d/1nEuiK_FyoJhpbaYGbK_pAIqQKXxNZphl/view?usp=sharing
(had to upload caue the file is like 12k lines before it's done)

edit: i now realize after reading the dead last message it was still loading

@nickspoons
Copy link
Member

This looks good.

Good noticing that line about .editorconfig too. You should enable editorconfig support in your omnisharp.json file. Mine looks like this:

{
   "Documentation": "https://github.com/OmniSharp/omnisharp-roslyn/wiki/Configuration-Options",
   "FormattingOptions": {
      "EnableEditorConfigSupport": true,
      "OrganizeImports": true,
      "SeparateImportDirectiveGroups": true
   },
   "RoslynExtensionsOptions": {
      "AnalyzeOpenDocumentsOnly": false,
      "EnableAnalyzersSupport": true,
      "EnableDecompilationSupport": true,
      "EnableImportCompletion": true
   }
}

Note the "Documentation" entry, which is just there so I remember where the rest of the omnisharp.json options are documented.

@vulbyte
Copy link
Author

vulbyte commented Jul 27, 2023

wonderful, thank you i tossed that in because that all sounds like stuff i want, owever i seem to still be lacking whatever i need for suggestions, and after looking threw said link, i can't seem to see anything that i reconize to be related to that (sorry if small brain is extra dry today)

@nickspoons
Copy link
Member

nickspoons commented Jul 27, 2023

If by "suggestions" you mean completions as you type, the example config uses asyncomplete:

" Autocompletion
Plug 'prabirshrestha/asyncomplete.vim'

Or just use normal vim omnicompletion (CTRL-x CTRL-o) which directly asks omnisharp-vim for completion options without requiring extra plugins.

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

No branches or pull requests

2 participants