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

omnisharp_mono cannot find Unity assemblies upon creating a new file #159

Closed
2 tasks done
willswats opened this issue Feb 24, 2023 · 5 comments
Closed
2 tasks done

Comments

@willswats
Copy link

Problem description

Upon creating a new file in Unity, the assemblies are not found by omnisharp_mono. Using LspRestart on omnisharp_mono causes the assemblies to be found.

Why do you think this is an issue with mason-lspconfig.nvim?

I attempted this with VSCode and OmniSharp, but did not receive any errors.

Neovim version (>= 0.7)

NVIM v0.8.3
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

Operating system/version

Linux will-desktop 6.1.12-200.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Feb 15 04:35:34 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

I've manually reviewed the Nvim LPS client log (:LspLog) to find potential errors

  • Yes

I've recently downloaded the latest plugin version of mason.nvim, mason-lspconfig.nvim, and nvim-lspconfig

  • Yes

Affected language servers

omnisharp_mono

Steps to reproduce

  1. Using Unity 2021.3.18f1, create a new script.
  2. Open the script in Neovim.

Actual behavior

Receive errors:
Unnecessary using directive.
The type or namespace name 'MonoBehaviour' could not be found (are you missing a using directive or an assembly reference?)

Expected behavior

Receive no errors on newly created cs file.

LspInfo

Press q or <Esc> to close this window. Press <Tab> to view server doc.
 
 Language client log: /var/home/will/.local/state/nvim/lsp.log
 Detected filetype:   cs
 
 1 client(s) attached to this buffer: 
 
 Client: omnisharp_mono (id: 3, bufnr: [34, 68, 59])
 	filetypes:       cs, vb
 	autostart:       true
 	root directory:  /var/home/will/Local/Code/unity-astrocats
 	cmd:             omnisharp-mono -z -s /var/home/will/Local/Code/unity-astrocats --hostPID 146133 DotNet:enablePackageRestore=false --encoding utf-8 --languageserver FormattingOptions:EnableEditorConfigSupport=true Sdk:IncludePrereleases=true -z -s /var/home/will/Local/Code/unity-astrocats --hostPID 146133 DotNet:enablePackageRestore=false --encoding utf-8 --languageserver FormattingOptions:EnableEditorConfigSupport=true Sdk:IncludePrereleases=true -z -s /var/home/will/Local/Code/unity-astrocats --hostPID 146133 DotNet:enablePackageRestore=false --encoding utf-8 --languageserver FormattingOptions:EnableEditorConfigSupport=true Sdk:IncludePrereleases=true -z -s /var/home/will/Local/Code/unity-astrocats --hostPID 146133 DotNet:enablePackageRestore=false --encoding utf-8 --languageserver FormattingOptions:EnableEditorConfigSupport=true Sdk:IncludePrereleases=true
 
 2 active client(s) not attached to this buffer: 
 
 Client: marksman (id: 1, bufnr: [14])
 	filetypes:       markdown
 	autostart:       true
 	root directory:  /var/home/will/Local/Code/unity-astrocats
 	cmd:             marksman server
 
 Client: null-ls (id: 2, bufnr: [14])
 	filetypes:       javascript, javascriptreact, less, yaml, handlebars, css, jsonc, graphql, typescriptreact, typescript, scss, html, markdown.mdx, vue, json, markdown
 	autostart:       false
 	root directory:  /var/home/will/Local/Code/unity-astrocats
 	cmd:             <function>
 
 Configured servers list: tsserver, lua_ls, rust_analyzer, taplo, omnisharp_mono, html, marksman, cssls, jsonls

LspLog

No response

Healthcheck

mason: require("mason.health").check()
========================================================================
## mason.nvim report
  - OK: neovim version >= 0.7.0
  - WARNING: **Go**: not available
  - OK: **cargo**: `cargo 1.67.0 (8ecd4f20a 2023-01-10)`
  - WARNING: **luarocks**: not available
  - WARNING: **Ruby**: not available
  - WARNING: **RubyGem**: not available
  - WARNING: **Composer**: not available
  - WARNING: **PHP**: not available
  - OK: **npm**: `8.19.2`
  - OK: **node**: `v16.18.1`
  - OK: **python3**: `Python 3.10.9`
  - OK: **pip3**: `pip 21.3.1 from /usr/lib/python3.10/site-packages/pip (python 3.10)`
  - WARNING: **javac**: not available
  - WARNING: **java**: not available
  - WARNING: **julia**: not available
  - OK: **wget**: `GNU Wget 1.21.3 built on linux-gnu.`
  - OK: **curl**: `curl 7.82.0 (x86_64-redhat-linux-gnu) libcurl/7.82.0 OpenSSL/3.0.8 zlib/1.2.11 brotli/1.0.9 libidn2/2.3.4 libpsl/0.21.1 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.51.0 OpenLDAP/2.6.3`
  - OK: **gzip**: `gzip 1.11`
  - OK: **tar**: `tar (GNU tar) 1.34`
  - WARNING: **pwsh**: not available
  - OK: **bash**: `GNU bash, version 5.2.15(1)-release (x86_64-redhat-linux-gnu)`
  - OK: **sh**: `Ok`
  - OK: **python3_host_prog**: `Python 3.10.9`
  - OK: **python3_host_prog pip**: `pip 21.3.1 from /usr/lib/python3.10/site-packages/pip (python 3.10)`
  - OK: GitHub API rate limit. Used: 6. Remaining: 54. Limit: 60. Reset: Fri Feb 24 01:18:06 2023.

Screenshots or recordings

Screenshot from 2023-02-24 00-33-44

@williamboman
Copy link
Owner

Hello! This seems to be a usability issue with the server itself? In that case this is no the the place to report the issue. It should either be reported to the LSP server developers or to nvim-lspconfig, depending on what kind of issue it is.

@nyngwang
Copy link

nyngwang commented Mar 6, 2023

Hello! This seems to be a usability issue with the server itself?

^exactly. So you might be interested in this old thread, which is exactly the problem you were asking for: OmniSharp/omnisharp-roslyn#2250. @willswats

@willswats
Copy link
Author

Thank you, and sorry for posting to the wrong repository. I'll have a look through at the potential solutions and try them out.

@Nikola-Milovic
Copy link

@willswats can you share your config for omnisharp and neovim? I am having some trouble getting it to work

@willswats
Copy link
Author

@Nikola-Milovic My LSP config is here, but I'm not doing anything special for OmniSharp. Make sure you have dotnet, mono and msbuild installed. I had to install mono from the repo on from their website as Fedora Linux, doesn't include msbuild with their mono. I still haven't gotten around to trying to fix this issue yet either, I just run LspRestart (bound to a key) whenever I create a new file in Unity.

vantaboard pushed a commit to vantaboard/mason-lspconfig.nvim that referenced this issue Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants