OmniSharp-VIM, OmniSharp-Roslyn, and the dotnet kernel on Ubuntu 16.10 - Syntax checking does not recognize C # 6 and requires a solution file

I am trying to configure my Ubuntu machine to develop dotnet cells. I carefully installed Omnisharp-vim and installed it to work with the OmniSharp-Roslyn server. I also have Syntastic and YouCompleteMe. I get syntax checking and Intellisense. I have two problems:

  • Omnisharp-vim does not work without a solution file. In basic Dotnet projects, it is not necessary to have decision files. How do I get around this?

  • I get a syntax error for valid C # 6 code. For example, it does not recognize the name of the operator.

+7
c # vim .net-core syntastic omnisharp
source share
1 answer

How?

Add a valid global.json file to the root directory.

 {} 

Add two lines at the top of your vimrc file.

 let g:OmniSharp_server_type = 'roslyn' let g:OmniSharp_prefer_global_sln = 1 

Why?

These two OmniSharp settings OmniSharp omnisharp-vim to use Roslyn and use the directory containing the global.json file.

Here is the source code for OmniSharp.vim that uses these variables.

 if g:OmniSharp_server_type ==# 'roslyn' && g:OmniSharp_prefer_global_sln let global_solution_files = s:globpath(dir, 'global.json') call filter(global_solution_files, 'filereadable(v:val)') if !empty(global_solution_files) let solution_files = [dir] break endif endif 

If this does not work ...

Try starting OmniSharp manually from the command line:

 omnisharp-vim\omnisharp-roslyn\artifacts\scripts\OmniSharp.cmd -s C:\temp\ 

The C:\temp\ directory contains the new .NET Core project with a valid global.json file.

+2
source share

All Articles