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

support for unimported types #720

Open
ton190 opened this issue Jul 16, 2021 · 8 comments
Open

support for unimported types #720

ton190 opened this issue Jul 16, 2021 · 8 comments

Comments

@ton190
Copy link

ton190 commented Jul 16, 2021

In Visual Studio you get suggestions for all types, even if they are not imported. How to do it in omnisharp-vim?

@nickspoons
Copy link
Member

I don't know about Visual Studio, but VScode (which uses the same language server as OmniSharp-roslyn) has moved to a new completion engine, which does this. I'd like us to move to the new engine too but it's not trivial, unfortunately.

So, it's a matter of someone finding time to do the work. It's a great feature though, it'll be cool to get it working here.

@ton190
Copy link
Author

ton190 commented Jul 16, 2021

Thank you for explanation.
Only 4 thinks are missing in vim for c#

  1. Unimported types support
  2. Razor Pages support
  3. Break Points
  4. .resx files support

Hope it will be implemented at some point in future.

@nickspoons
Copy link
Member

If you're using dotnet core, you can debug with breakpoints using vimspector, which I've only used a couple of times so far (most of my work projects are .Net Framework) but it works really well.

@ton190
Copy link
Author

ton190 commented Jul 17, 2021

Thanks. Did not know about this plugin.

@ton190 ton190 closed this as completed Jul 17, 2021
@nickspoons
Copy link
Member

You're welcome. I think we might as well leave this issue open, getting un-imported types supported is a valid thing to track.

@nickspoons nickspoons reopened this Jul 17, 2021
@ton190 ton190 closed this as completed Jul 17, 2021
@ton190 ton190 reopened this Jul 17, 2021
@Kevinizevbigie
Copy link

Hi @nickspoons, is unimported type support still on the roadmap? thanks

@nickspoons
Copy link
Member

@vinn2010 It is already supported to a certain extent, if you enable it in OmniSharp-roslyn with the EnableImportCompletion option in ~/.omnisharp/omnisharp.json, i.e.:

{
   "RoslynExtensionsOptions": {
      "AnalyzeOpenDocumentsOnly": false,
      "EnableAnalyzersSupport": true,
      "EnableDecompilationSupport": true,
      "EnableImportCompletion": true
   }
}

This makes unimported types appear in completions, e.g. Console will be presented as a completion option for Conso when you don't have using System;. However, OmniSharp-vim does not automatically add the missing using statement when you select the option, and the completion option does not have completion documentation included until the using statement is added. In most cases you'll be able to do it with a quick :OmniSharpFixUsings after the completion.

The ideal functionality here would be to insert the using automatically. However realistically it is unlikely that I'll get around to doing it. Happy to merge a good PR, although as I said earlier, it's not trivial.

@Kevinizevbigie
Copy link

Very useful. I wasn't aware of OmniSharpFixUsings, this is really all I need by doing:

" Add usings on save
autocmd BufWritePost *.cs OmniSharpFixUsings

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

3 participants