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

Get empty 'Description on company-mode candidate #485

Open
stardiviner opened this issue Jun 24, 2019 · 17 comments
Open

Get empty 'Description on company-mode candidate #485

stardiviner opened this issue Jun 24, 2019 · 17 comments

Comments

@stardiviner
Copy link

I press [F1] on company-mode candidate to get document. But it shows nothing. I then enable omnisharp-debug. Check out debug output log. Found the (Description) is empty.
Currently using Omnisharp-Roslyn. Does it support Description?

@stardiviner
Copy link
Author

Any idea about this issue? If want more information, how can I debug deeper?

@stardiviner
Copy link
Author

I created a new project through dotnet new console -o myApp on my Arch Linux machine.

Here is my *omnisharp-log* buffer output:

[09:14:53] starting server on project root "/home/stardiviner/Documents/learning/.NET/myApp/"
[09:14:53] Using server binary on /home/stardiviner/Code/.NET/omnisharp-roslyn/run
[09:14:55] INFORMATION: OmniSharp.Stdio.Host, Starting OmniSharp on arch 0.0 (x64)
[09:14:55] INFORMATION: OmniSharp.Services.DotNetCliService, DotNetPath set to dotnet
[09:14:55] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "/home/stardiviner/Code/.NET/omnisharp-roslyn/omnisharp/.msbuild/Current/Bin"
[09:14:55] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, MSBUILD_EXE_PATH environment variable set to '/home/stardiviner/Code/.NET/omnisharp-roslyn/omnisharp/.msbuild/Current/Bin/MSBuild.dll'
[09:14:55] INFORMATION: OmniSharp.MSBuild.Discovery.MSBuildLocator, Registered MSBuild instance: StandAlone 15.0 - "/home/stardiviner/Code/.NET/omnisharp-roslyn/omnisharp/.msbuild/Current/Bin"
            MSBuildExtensionsPath = /usr/lib/mono/xbuild
            BypassFrameworkInstallChecks = true
            CscToolPath = /home/stardiviner/Code/.NET/omnisharp-roslyn/omnisharp/.msbuild/Current/Bin/Roslyn
            CscToolExe = csc.exe
            MSBuildToolsPath = /home/stardiviner/Code/.NET/omnisharp-roslyn/omnisharp/.msbuild/Current/Bin
            TargetFrameworkRootPath = /usr/lib/mono/xbuild-frameworks
[09:14:58] INFORMATION: OmniSharp.Cake.CakeProjectSystem, Detecting Cake files in '/home/stardiviner/Documents/learning/.NET/myApp'.
[09:14:58] INFORMATION: OmniSharp.Cake.CakeProjectSystem, Could not find any Cake files
[09:14:58] INFORMATION: OmniSharp.WorkspaceInitializer, Project system 'OmniSharp.DotNet.DotNetProjectSystem' is disabled in the configuration.
[09:14:58] INFORMATION: OmniSharp.MSBuild.ProjectSystem, No solution files found in '/home/stardiviner/Documents/learning/.NET/myApp'
[09:14:58] INFORMATION: OmniSharp.MSBuild.ProjectManager, Queue project update for '/home/stardiviner/Documents/learning/.NET/myApp/myApp.csproj'
[09:14:58] INFORMATION: OmniSharp.Script.ScriptProjectSystem, Detecting CSX files in '/home/stardiviner/Documents/learning/.NET/myApp'.
[09:14:58] INFORMATION: OmniSharp.Script.ScriptProjectSystem, Could not find any CSX files
[09:14:58] INFORMATION: OmniSharp.WorkspaceInitializer, Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[09:14:58] INFORMATION: OmniSharp.MSBuild.ProjectManager, Loading project: /home/stardiviner/Documents/learning/.NET/myApp/myApp.csproj
[09:14:58] INFORMATION: OmniSharp.WorkspaceInitializer, Configuration finished.
[09:14:58] INFORMATION: OmniSharp.Stdio.Host, Omnisharp server running using Stdio at location '/home/stardiviner/Documents/learning/.NET/myApp' on host -1.
[09:15:00] WARNING: OmniSharp.MSBuild.ProjectManager, Failed to load project file '/home/stardiviner/Documents/learning/.NET/myApp/myApp.csproj'.
[09:15:00] ERROR: OmniSharp.MSBuild.ProjectManager, Attempted to update project that is not loaded: /home/stardiviner/Documents/learning/.NET/myApp/myApp.csproj
[09:15:03] INFORMATION: OmniSharp.OmniSharpWorkspace, Miscellaneous file: /home/stardiviner/Documents/learning/.NET/myApp/Program.cs added to workspace

@razzmatazz
Copy link
Contributor

Hi @stardiviner ; Sorry for writing back so late.

Not sure how to approach the problem. omnisharp-emacs does provide Description to company-mode and and this feature does work for me on macOS/emacs 26.2.

Bildschirmfoto 2019-07-02 um 23 17 59

Do you get other things working for you? What if you move over a symbol that has documentation and then invoke:

  • M-x omnisharp-current-type-documentation
    or
  • M-x omnisharp-current-type-information?

Do you get something meaningful? It should show a tooltip-on-point on the symbol, like this:
Bildschirmfoto 2019-07-02 um 23 20 55

@stardiviner
Copy link
Author

stardiviner commented Jul 4, 2019

I toggle ed omnisharp-debug. Here is the log in *omnisharp-log* buffer. when I execute upper two commands:

omnisharp-current-type-documentation

[09:40:16] --> 44 /typelookup ((Arguments (IncludeDocumentation . t) (FileName . "/home/stardiviner/Documents/learning/.NET/myApp/Program.cs") (Line . "14") (Column . "28") (Buffer . "using System;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;

namespace myApp
{
  class Program
  {
      public static void Main()
      {
          Console.WriteLine(\"Hello World!\");
          // Console.WriteLine(Console.Read());
          Console.WriteLine();
          
          using (var db = new BloggingContext())
          {
              db.Blogs.Add(new Blog { Url = \"http://blogs.msdn.com/adonet\" });
              var count = db.SaveChanges();
              Console.WriteLine(\"{0} records saved to database\", count);

              Console.WriteLine();
              Console.WriteLine(\"All blogs in database:\");
              foreach (var blog in db.Blogs)
              {
                  Console.WriteLine(\" - {0}\", blog.Url);
              }
          }
      }
  }
}
")) (Command . "/typelookup") (Seq . 44))
omnisharp-current-type-information

[09:41:04] --> 45 /typelookup ((Arguments (IncludeDocumentation . t) (FileName . "/home/stardiviner/Documents/learning/.NET/myApp/Program.cs") (Line . "14") (Column . "28") (Buffer . "using System;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;

namespace myApp
{
  class Program
  {
      public static void Main()
      {
          Console.WriteLine(\"Hello World!\");
          // Console.WriteLine(Console.Read());
          Console.WriteLine();
          
          using (var db = new BloggingContext())
          {
              db.Blogs.Add(new Blog { Url = \"http://blogs.msdn.com/adonet\" });
              var count = db.SaveChanges();
              Console.WriteLine(\"{0} records saved to database\", count);

              Console.WriteLine();
              Console.WriteLine(\"All blogs in database:\");
              foreach (var blog in db.Blogs)
              {
                  Console.WriteLine(\" - {0}\", blog.Url);
              }
          }
      }
  }
}
")) (Command . "/typelookup") (Seq . 45))

The second command did raise up a tooltip.
Seems it should work. But I still can't get document with [F1] on candidate. weird.

@stardiviner
Copy link
Author

Gentil ping @razzmatazz :)

@razzmatazz
Copy link
Contributor

razzmatazz commented Dec 21, 2019

Hi @stardiviner sorry for missing on your comment from July :E

The [F1] key does work for me, but I think you should look for /autocomplete request on the log, as this is what I get when omnisharp-emacs asks the server for autocompletion items after entering a '.' (dot):

[14:14:35] --> 332 /autocomplete ((Arguments (WantDocumentationForEveryCompletionResult . t) (WantMethodHeader . t) (WantReturnType . t) (WantSnippet . t) (WantImportableTypes . :json-false) (WordToComplete . #("Somet" 0 5 (fontified nil omnisharp-result ((CompletionText . "Something") (Description . "Documentation for 'Something'
") (DisplayText . "Something()") (RequiredNamespaceImport) (MethodHeader . #("Something()" 0 11 (omnisharp-item #5 omnisharp-ann " : void" omnisharp-allow-templating t))) (ReturnType . "void") (Snippet . "Something();$0") (Kind . "Method") (IsSuggestionMode . :json-false) (Preselect . :json-false))))) (WantKind . t) (FileName . "/Users/bob/emacs/csharp-test/Program.cs") (Line . "10") (Column . "18") (Buffer . "using System;

namespace csharp_test
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(\"Hello World!\");
            Somet();
        }

        /// <summary>
        ///   Documentation for 'Something'
        /// </summary>
        static void Something()
        {
        }
    }
}
")) (Command . "/autocomplete") (Seq . 332))

Bildschirmfoto 2019-12-21 um 14 21 44

Could you check what is your response from the server for the /autocomplete response?

@razzmatazz
Copy link
Contributor

Btw, which server (omnisharp-roslyn) version are you using? Maybe there have been fixes for you particular toolset. Which .net core version/toolset are you using?

@stardiviner
Copy link
Author

image

Here is the debug log:

[20:42:30] --> 29 /autocomplete ((Arguments (WantDocumentationForEveryCompletionResult . t) (WantMethodHeader . t) (WantReturnType . t) (WantSnippet . t) (WantImportableTypes . :json-false) (WordToComplete . #("Con" 0 1 (fontified t) 1 2 (fontified t) 2 3 (fontified t))) (WantKind . t) (FileName . "/home/stardiviner/Documents/learning/dotNET/myApp/Program.cs") (Line . "13") (Column . "14") (Buffer . "using System;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;

namespace myApp
{
  class Program
  {
      public static void Main()
      {
          Console.WriteLine(\"Hello World!\");
          Con
          // Console.WriteLine(Console.Read());
          
          using (var db = new BloggingContext())
          {
              db.Blogs.Add(new Blog { Url = \"http://blogs.msdn.com/adonet\" });
              var count = db.SaveChanges();
              Console.WriteLine(\"{0} records saved to database\", count);

              Console.WriteLine();
              Console.WriteLine(\"All blogs in database:\");
              foreach (var blog in db.Blogs)
              {
                  Console.WriteLine(\" - {0}\", blog.Url);
              }
          }
      }
  }
}
")) (Command . "/autocomplete") (Seq . 29))
[20:42:31] --> 30 /autocomplete ((Arguments (WantDocumentationForEveryCompletionResult . t) (WantMethodHeader . t) (WantReturnType . t) (WantSnippet . t) (WantImportableTypes . :json-false) (WordToComplete . #("Cons" 0 1 (fontified t) 1 2 (fontified t) 2 3 (fontified t) 3 4 (fontified t))) (WantKind . t) (FileName . "/home/stardiviner/Documents/learning/dotNET/myApp/Program.cs") (Line . "13") (Column . "15") (Buffer . "using System;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;

namespace myApp
{
  class Program
  {
      public static void Main()
      {
          Console.WriteLine(\"Hello World!\");
          Cons
          // Console.WriteLine(Console.Read());
          
          using (var db = new BloggingContext())
          {
              db.Blogs.Add(new Blog { Url = \"http://blogs.msdn.com/adonet\" });
              var count = db.SaveChanges();
              Console.WriteLine(\"{0} records saved to database\", count);

              Console.WriteLine();
              Console.WriteLine(\"All blogs in database:\");
              foreach (var blog in db.Blogs)
              {
                  Console.WriteLine(\" - {0}\", blog.Url);
              }
          }
      }
  }
}
")) (Command . "/autocomplete") (Seq . 30))

@stardiviner
Copy link
Author

I have not found the Description which contains the docstring.

@razzmatazz
Copy link
Contributor

razzmatazz commented Dec 21, 2019

Could you check for later responses/requests on the log? As the buffer contents sent on your request does not match your screenshot:
Bildschirmfoto 2019-12-21 um 14 53 56

@stardiviner
Copy link
Author

*omnisharp-log*: [21:02:34] --> 79 /autocomplete ((Arguments (WantDocumentationForEveryCompletionResult . t) (WantMethodHeader . t) (WantReturnType . t) (WantSnippet . t) (WantImportableTypes . :json-false) (WordToComplete . #("wri" 0 1 (fontified nil omnisharp-result ((CompletionText . "Console") (Description . "") (DisplayText . "Console") (RequiredNamespaceImport) (MethodHeader . #("Console" 0 7 (omnisharp-item #5 omnisharp-ann " : " omnisharp-allow-templating t))) (ReturnType) (Snippet . "Console$0") (Kind . "Class") (IsSuggestionMode . :json-false) (Preselect . :json-false))) 1 2 (fontified nil omnisharp-result ((CompletionText . "Console") (Description . "") (DisplayText . "Console") (RequiredNamespaceImport) (MethodHeader . #("Console" 0 7 (omnisharp-item #5 omnisharp-ann " : " omnisharp-allow-templating t))) (ReturnType) (Snippet . "Console$0") (Kind . "Class") (IsSuggestionMode . :json-false) (Preselect . :json-false))) 2 3 (fontified nil omnisharp-result ((CompletionText . "Console") (Description . "") (DisplayText . "Console") (RequiredNamespaceImport) (MethodHeader . #("Console" 0 7 (omnisharp-item #5 omnisharp-ann " : " omnisharp-allow-templating t))) (ReturnType) (Snippet . "Console$0") (Kind . "Class") (IsSuggestionMode . :json-false) (Preselect . :json-false))))) (WantKind . t) (FileName . "/home/stardiviner/Documents/learning/dotNET/myApp/Program.cs") (Line . "13") (Column . "22") (Buffer . "using System;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;

namespace myApp
{
  class Program
  {
      public static void Main()
      {
          Console.WriteLine(\"Hello World!\");
          Console.wri
          // Console.WriteLine(Console.Read());
          
          using (var db = new BloggingContext())
          {
              db.Blogs.Add(new Blog { Url = \"http://blogs.msdn.com/adonet\" });
              var count = db.SaveChanges();
              Console.WriteLine(\"{0} records saved to database\", count);

              Console.WriteLine();
              Console.WriteLine(\"All blogs in database:\");
              foreach (var blog in db.Blogs)
              {
                  Console.WriteLine(\" - {0}\", blog.Url);
              }
          }
      }
  }
}
")) (Command . "/autocomplete") (Seq . 79))
*omnisharp-log*: [21:02:35] --> 80 /codecheck ((Arguments (FileName . "/home/stardiviner/Documents/learning/dotNET/myApp/Program.cs") (Line . "13") (Column . "22") (Buffer . "using System;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;

namespace myApp
{
  class Program
  {
      public static void Main()
      {
          Console.WriteLine(\"Hello World!\");
          Console.wri
          // Console.WriteLine(Console.Read());
          
          using (var db = new BloggingContext())
          {
              db.Blogs.Add(new Blog { Url = \"http://blogs.msdn.com/adonet\" });
              var count = db.SaveChanges();
              Console.WriteLine(\"{0} records saved to database\", count);

              Console.WriteLine();
              Console.WriteLine(\"All blogs in database:\");
              foreach (var blog in db.Blogs)
              {
                  Console.WriteLine(\" - {0}\", blog.Url);
              }
          }
      }
  }
}
")) (Command . "/codecheck") (Seq . 80))

@razzmatazz
Copy link
Contributor

razzmatazz commented Dec 21, 2019

It seeems your /autocomplete response has only Console mentioned as suggestion items:

*omnisharp-log*: [21:02:34] --> 79 /autocomplete ((Arguments (WantDocumentationForEveryCompletionResult . t) (WantMethodHeader . t) (WantReturnType . t) (WantSnippet . t) (WantImportableTypes . :json-false) (WordToComplete . #("wri" 0 1 (fontified nil omnisharp-result ((CompletionText . "Console") (Description . "") (DisplayText . "Console") (RequiredNamespaceImport) (MethodHeader . #("Console" 0 7 (omnisharp-item #5 omnisharp-ann " : " omnisharp-allow-templating t))) (ReturnType) (Snippet . "Console$0") (Kind . "Class") (IsSuggestionMode . :json-false) (Preselect . :json-false))) 1 2 (fontified nil omnisharp-result ((CompletionText . "Console") (Description . "") (DisplayText . "Console") (RequiredNamespaceImport) (MethodHeader . #("Console" 0 7 (omnisharp-item #5 omnisharp-ann " : " omnisharp-allow-templating t))) (ReturnType) (Snippet . "Console$0") (Kind . "Class") (IsSuggestionMode . :json-false) (Preselect . :json-false))) 2 3 (fontified nil omnisharp-result ((CompletionText . "Console") (Description . "") (DisplayText . "Console") (RequiredNamespaceImport) (MethodHeader . #("Console" 0 7 (omnisharp-item #5 omnisharp-ann " : " omnisharp-allow-templating t))) (ReturnType) (Snippet . "Console$0") (Kind . "Class") (IsSuggestionMode . :json-false) (Preselect . :json-false))))) (WantKind . t) (FileName . "/home/stardiviner/Documents/learning/dotNET/myApp/Program.cs") (Line . "13") (Column . "22") (Buffer . "using System;

Could you search for you *omnisharp-log* for /autocomplete responses where Write is listed, as in your screenshot?

Also it can be that SDK you are using does not provide Console.WriteLine documentation to roslyn server (for some reason). Have you tried writing you own method in the file and annotating it with documentation and then try to autocomplete on that and see if that works?

Which version of .net SDK & omnisharp-roslyn you have installed?

@stardiviner
Copy link
Author

I added Something function. Still error>

[21:59:47] --> 171 /autocomplete ((Arguments (WantDocumentationForEveryCompletionResult . t) (WantMethodHeader . t) (WantReturnType . t) (WantSnippet . t) (WantImportableTypes . :json-false) (WordToComplete . #("s" 0 1 (fontified nil omnisharp-result ((CompletionText . "Program") (Description . "") (DisplayText . "Program") (RequiredNamespaceImport) (MethodHeader . #("Program" 0 7 (omnisharp-item #5 omnisharp-ann " : " omnisharp-allow-templating t))) (ReturnType) (Snippet . "Program$0") (Kind . "Class") (IsSuggestionMode . :json-false) (Preselect . :json-false))))) (WantKind . t) (FileName . "/home/stardiviner/Documents/learning/dotNET/myApp/Program.cs") (Line . "13") (Column . "20") (Buffer . "using System;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;

namespace myApp
{
  class Program
  {
      public static void Main()
      {
          Console.WriteLine(\"Hello World!\");
          Program.s
          // Console.WriteLine(Console.Read());
          
          using (var db = new BloggingContext())
          {
              db.Blogs.Add(new Blog { Url = \"http://blogs.msdn.com/adonet\" });
              var count = db.SaveChanges();
              Console.WriteLine(\"{0} records saved to database\", count);

              Console.WriteLine();
              Console.WriteLine(\"All blogs in database:\");
              foreach (var blog in db.Blogs)
              {
                  Console.WriteLine(\" - {0}\", blog.Url);
              }
          }
      }

      
          /// <summary>
/// Document for something.
/// </summary>
          static void Someting()
          {
              
          }
  }
}
")) (Command . "/autocomplete") (Seq . 171))

image

@stardiviner
Copy link
Author

stardiviner commented Dec 21, 2019

dotnet --version - 2.2.108
System: Arch Linux
omnisharp-roslyn version: (I remember I downloaded from GitHub release page. time is around this issue time June 24, I checked, 1.32.20.)

@stardiviner
Copy link
Author

I will take a try to update omnisharp-roslyn and try again.

@razzmatazz
Copy link
Contributor

Hmm, while browsing omnisharp-roslyn repo, I think I found an issue reported with the server itself:

This sounds exactly what you're encountering and it might just be language server issue.

@stardiviner
Copy link
Author

Interesting, glad that finally located problem issue. I have not successly try new version omnisharp-rolysn yet because network issue of build.sh.

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