-
Notifications
You must be signed in to change notification settings - Fork 167
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
Comments
The commands are only available from .cs files |
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 |
Is the filetype
Could you please run |
yes it is, running the command you listed returns and after running
|
Pretty weird, your 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 Beyond checking that, you might need to debug the script I linked by inserting 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' |
thanks again for the reply, i resolved the errors that were appearing in the first message in edit 2 by running getting to your suggestions running this new file by using the commands
trying to just it as expected, i load into nvim, fuzzy find my way to a Test.cs file within a unity project.
implying it is running, if i then type
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 if i check the open log is still blank,
status returns "No servers started" still.
|
Has it actually installed though? Is omnisharp-roslyn present and executable at that location? You should be able to run |
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:
edit:
this makes little sense to me as the files it is calling should be 777'd aswell at this point |
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. |
doing what you ask, i had to first rename the run file to #!/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:
skimming from what is given it seems to have an issue loading 'msbuild', however:
which if i check
and in my ~/.zshrc
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? |
There are lots of issues here. Primarily:
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 |
Vim/neovim won't be able to see environment variables you set in |
"1." "2." "what proj" 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"
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
|
So did you restart and reinstall the server after |
correct, i did |
Ok, do you get anything in What about running |
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 and running omnisharp log i'm now greated this:
(more progress, yay) however the last issue now is i'm welcomed to this: |
So this is a Unity project. |
ah yes, small brain kicking in lol 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
so i moved the settings into the i also just added other flags i could think of just to make life easier
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:
edit: and the same "whole file error" dispite restarting the omnisharp server |
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 |
It would be quite helpful to see your actual config. Are you by any chance running other lsp services at the same time? |
here you are for the command you mentioned
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: |
Ok so you do have nvim lsp in there, which is quite possibly conflicting with omnisharp-vim, I suspect that's where the |
sorry, do you mean edit 1: |
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 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? |
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 so my first immediate thing is that i should probably try disable lsp-zero for successfully reinstalled,
so after seeing that i looked up the file 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 |
Nice job, that's good to confirm that it was other plugins causing those editor errors The |
It's peculiar though because this should be the |
of course this is the error that prints out with the command i used:
|
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 |
Don't worry about the This is what that section of the log should look like:
|
edited by nickspoons to fix markup sorry for not specifying this, both actually have the
) while 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? |
The
No. There are 2 completely different .NET environments: Reinstalling |
Try creating a {
"MSBuild": {
"MSBuildOverride": {
"MSBuildPath": "/Library/Frameworks/Mono.framework/Versions/Current/Commands",
"Name": "Mono msbuild, path overridden in omnisharp.json"
}
}
} |
edited by nickspoons to fix markup
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
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
okay, i actually noticed the whole folder is actually empty so that's wonderful, adding that now
so
so now we seem to be back at the same issue as before, with
so it at least seems to be working, so attempting teh same dotnet build -c Release in the unity project give me the error: at this point i'm unsure why this is happening again, and am sorta stuck spinning wheels again (sadly) |
The non-executable |
What are you trying to do here? You To run the server on the command line, |
|
I think you're flailing about a bit much, I don't understand a lot of the things you're trying.
What does this mean? What kind of output for are you expecting? 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.
How are you requesting lsp suggestions? Omnisharp-vim is very similar to an LSP client but is not an LSP client (it predates LSP). |
After formatting so I could read the errors and logs properly, the error you are getting in your
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 It could be worth trying a "manual" install of |
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. |
edited by nickspoons to fix markdown formatting
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
within my omnisharp config i still have:
which should output to a log file, but it only does so if i have
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
above is pre
syntax highlighting now seems to be fixed, however still no suggestions/lsp goodness. edit: outside the highlighting which now looks fixed |
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. |
okay, my isse is i'm not sure to resolve this, as i've mentioned before when i run
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:
and trurned:
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? |
But is that path to |
i believe i do, it exists and has a bunch of files. if i ls that directory i get this:
|
No, C# produces DLLs on any OS, that's fine. |
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
Here is the file on your filesystem according to what you just posted:
So update your {
"MSBuild": {
"MSBuildOverride": {
"MSBuildPath": "/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/Current/bin",
"Name": "Mono msbuild, path overridden in omnisharp.json"
}
}
} |
I just realised you must have |
with that clumsy small brain moment fixed, and i then checked the log again and was greeted to: edit: assuming i have a setting not enabled or something simple edit2: fixed link error |
Your link is broken. Remember, in markdown, links are like this: |
Try |
I've asked you this before but what do you mean by this? Do you mean completion suggestions as you type?
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. |
https://drive.google.com/file/d/1nEuiK_FyoJhpbaYGbK_pAIqQKXxNZphl/view?usp=sharing edit: i now realize after reading the dead last message it was still loading |
This looks good. Good noticing that line about {
"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 |
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) |
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 ( |
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:
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: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
The text was updated successfully, but these errors were encountered: