Omnisharp-roslyn: Nuget dependencies not complete (eg.: Newtonsoft.Json)

Created on 24 Mar 2018  路  11Comments  路  Source: OmniSharp/omnisharp-roslyn

All 11 comments

Instead of just touch coreApp.sln, create the sln file with dotnet and add the project to the solution:

dotnet new sln
dotnet sln add coreApp.csproj

Now you can get completion etc.

Same problem, no completion.
asciicast

You didn't add the NuGet reference to your .csproj file in that example

dotnet new sln -o coreApp
cd coreApp
dotnet new console
dotnet sln add coreApp.csproj
dotnet add coreApp.csproj package "Newtonsoft.Json"
dotnet restore
vim Program.cs

Line 5 adds the Newtonsoft.Json reference, just as you manually added it to coreApp.csproj in your first example

In the previous example I already have Newtonsoft.Json refered on csproj xml, I just still working on same directory of the first example.

Still doesn't work, using each of the commands that you suggest.
asciicast

Well then I'm stuck. I've tested those commands a couple of times now and it works fine for me with dotnet --version 2.1.101.

Could you try to create a valid program using Newtonsoft and see if it can build? Something like this:

using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace coreApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(JObject.Parse("{'Hello':'world'}").ToString(Formatting.Indented));
        }
    }
}

Then do dotnet run and see if it works?

Runs correctly, Netonsoft related completion still doesn't work.
asciicast

My dotnet version is 2.1.101 too.

OK! Looking to YCM third_party directory, I see that it's using OmniSharpServer and not this omnisharp-roslyn.

I'll need ask to YCM to support omnisharp-roslyn.

Since it's not a roslyn problem, do you want to close the issue @DavidUser?

Was this page helpful?
0 / 5 - 0 ratings