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

Typing "override" gives no suggestion based on the base class. #1044

Open
AlexandreFiset opened this issue Dec 15, 2016 · 43 comments
Open

Typing "override" gives no suggestion based on the base class. #1044

AlexandreFiset opened this issue Dec 15, 2016 · 43 comments

Comments

@AlexandreFiset
Copy link

@AlexandreFiset AlexandreFiset commented Dec 15, 2016

Environment data

dotnet --info output:
VS Code version: 1.8.0
C# Extension version: 1.5.3

Steps to reproduce

  1. Create a class.
  2. Create a virtual/abstract method.
  3. Create a new class that derives from class 1.
  4. Type "override".
  5. Notice there is no autocomplete as opposed to Monodevelop and VS2015 that both support this awesome, practical behaviour.

Expected behavior

Typing "override" should show me a list of all possible overrides from base class.

Actual behavior

Typing "override" gives no suggestion based on the base class.

@grzegorz-herman

This comment has been minimized.

Copy link

@grzegorz-herman grzegorz-herman commented Jan 2, 2017

I second this request. When inheriting generic base classes with elaborate type arguments, not having to re-type the signatures would save a lot of energy!

@Leopotam

This comment has been minimized.

Copy link
Contributor

@Leopotam Leopotam commented Jan 2, 2017

+1 - i have alot of pain each time for searching parent class with method signature (it can be down 2-4 levels of abstraction sequence), want to write "override" keyword and select method from list.

@juanfornospomelo

This comment has been minimized.

Copy link

@juanfornospomelo juanfornospomelo commented Mar 3, 2017

+1

@appetizermonster

This comment has been minimized.

Copy link

@appetizermonster appetizermonster commented Mar 22, 2017

+1

@Leopotam

This comment has been minimized.

Copy link
Contributor

@Leopotam Leopotam commented Mar 22, 2017

@DustinCampbell multiple requests during last 3 months - no assignees. Can we know devs plans about this problem?

@DustinCampbell

This comment has been minimized.

Copy link
Collaborator

@DustinCampbell DustinCampbell commented Mar 22, 2017

The work is primarily in omnisharp-roslyn, where we need to create a new endpoint. It's on my list, but at the moment, all work goes serially through me. So, as I work through the backlog in priority order, I'll get to it.

Do note that this is an open source project and we're accepting contributions! 😄

@chuckries

This comment has been minimized.

Copy link
Contributor

@chuckries chuckries commented Mar 23, 2017

@DustinCampbell I'd be interested in taking a shot at this, but I really have no clue what's going on. I set up a debuggable Omnisharp on my box and hooked it up to VS Code. All I've determined so far is that after typing 'override' and a space, the csharp intellisense service is not getting an AutocompleteRequest. Any suggestions on where to go from there?

@DustinCampbell

This comment has been minimized.

Copy link
Collaborator

@DustinCampbell DustinCampbell commented Mar 23, 2017

In the VS Code extension, you'll need to ensure that completion can trigger on a space character (assuming that's possible).

@chuckries

This comment has been minimized.

Copy link
Contributor

@chuckries chuckries commented Mar 23, 2017

There are some immediate issues with this. If we include the space character as a completion target, the full completion list appears on every space. It does not look like vscodes 'provideCompletionItems' gives any indication of whether the autcomplete was triggered automatically by typing or manually by a gesture (ctrl + space being the default).

I know VS IDE's behavior is to show the completion list for override items on space after 'override'. Maybe here we include these items when typing override?

@DustinCampbell

This comment has been minimized.

Copy link
Collaborator

@DustinCampbell DustinCampbell commented Mar 23, 2017

Note: You'd need to update OmniSharp itself to make this work. This can't be done via extension alone and requires a new endpoint to be added to OmniSharp.

I would prefer to replicate Visual Studio's behavior here if we can. We have a goal of making features which are heavy on muscle memory somewhat consistent within the Visual Studio family.

@chuckries

This comment has been minimized.

Copy link
Contributor

@chuckries chuckries commented Mar 23, 2017

Even with the correct endpoint in place on the server, I'm not sure how we could get the extension to trigger the request at the right time.

@DustinCampbell

This comment has been minimized.

Copy link
Collaborator

@DustinCampbell DustinCampbell commented Mar 23, 2017

Sure we can. We need a new endpoint in the OmniSharp server and the extension would stop listening to the old /autocomplete endpoint. The new endpoint would essentially be a passthrough to the Roslyn CompletionService API. That API provides a lot more smarts about whether a list should trigger or not.

@chuckries

This comment has been minimized.

Copy link
Contributor

@chuckries chuckries commented Mar 23, 2017

I'm a little confused, it looks like the existing AutoComplete endpoint is using Roslyn's CompletionService. In fact, the CompletionService is actually giving me the correct completions for override:
image

These are getting dropped on the floor because they are not keywords.

Is a new server endpoint part of a bigger work item?

@DustinCampbell

This comment has been minimized.

Copy link
Collaborator

@DustinCampbell DustinCampbell commented Mar 23, 2017

Yes, it is part of a bigger work item. Today, we only use it for keywords because of backward compatibility of the /autocomplete endpoint with other OmniSharp editors (like VIM, Emacs, Sublime, Atom, etc.). In addition, the /autocomplete endpoint is not suitable for all of the information that can be returned by the Roslyn CompletionService.

That bigger work item is tracked here: OmniSharp/omnisharp-roslyn#78.

@chuckries

This comment has been minimized.

Copy link
Contributor

@chuckries chuckries commented Mar 23, 2017

I see. I think in that case I'll bow out. Thanks for the info!

@chuckries

This comment has been minimized.

Copy link
Contributor

@chuckries chuckries commented Mar 23, 2017

FWIW, I still think you will run into issues on the VS Code side. You will need to begin triggering autocomplete v2 requests on space. This will cause available 'recommended symbols' to show up on every space.

@DustinCampbell

This comment has been minimized.

Copy link
Collaborator

@DustinCampbell DustinCampbell commented Mar 23, 2017

Only if the new service allows triggers on space. The Roslyn CompletionService allows completion to be triggered differently depending on what character was typed and what the current position is in the syntax tree. So, it returns a completion list when SPACE is typed after "override" and "new". It won't return a list at all in other situations.

@chuckries

This comment has been minimized.

Copy link
Contributor

@chuckries chuckries commented Mar 23, 2017

Today's implementation gets the completion list and then appends all 'recommended symbols' for the position as well.

                var model = await document.GetSemanticModelAsync();
                var symbols = await Recommender.GetRecommendedSymbolsAtPositionAsync(model, position, _workspace);

If the extension queries Omnisharp on SPACE, even though Roslyn's CompletetionService returns no completions, the list of recommended symbols would still be returned and shown on every SPACE. It seems like we would want to show recommended symbols ONLY if the autocomplete was triggered manually with a gesture (ctrl + SPACE). VS Code's API does not allow you to determine if the autcomplete is triggered manually or not.

@DustinCampbell

This comment has been minimized.

Copy link
Collaborator

@DustinCampbell DustinCampbell commented Mar 23, 2017

Yes. I know that's how it works today. That code would all go away with the new end point.

@DustinCampbell

This comment has been minimized.

Copy link
Collaborator

@DustinCampbell DustinCampbell commented Mar 23, 2017

The thing that might not be clear is that this would be a brand new end point that lives next to autocomplete. It would all be new code that just talks to Roslyn's CompletionService.

@chuckries

This comment has been minimized.

Copy link
Contributor

@chuckries chuckries commented Mar 23, 2017

The issues I think I am seeing all relate to querying Omnisharp from the extension, regardless of new endpoint. In VS there are instances where intellisense shows nothing until you manually invoke it using ctrl + SPACE. If we want to show autcomplete after the override keyword, the extension must be invoking it's completionProvider on SPACE. On most SPACE's, there will be no autcompletes to show. However, the user may want to manually invoke autcomplete to show recommendations. I do not believe VS Code will allow you to distinguish between these two. A space and a ctrl + space would trigger the exact same request.

@DustinCampbell

This comment has been minimized.

Copy link
Collaborator

@DustinCampbell DustinCampbell commented Mar 23, 2017

Space and Ctrl+Space should trigger the same request. This is something we've been trying to move toward in VS.

@chuckries

This comment has been minimized.

Copy link
Contributor

@chuckries chuckries commented Mar 24, 2017

Thank you for your patience and information. I am asking simply because I am interested in this space. I am curious what the plan is for cases where there are no autocomplete items, but the user may want to invoke intellisense with ctrl + SPACE in order to see available suggestions that are not necessarily autocomplete items. For example, if I type int i = followed by a SPACE, there are no autocomplete items but I may want to invoke Intellisense with ctrl + SPACE to see all available suggestions.

@DustinCampbell

This comment has been minimized.

Copy link
Collaborator

@DustinCampbell DustinCampbell commented Mar 24, 2017

Correct. After typing int i = followed by SPACE, the Roslyn CompletionService won't return a completion list. The issue here is that OmniSharp will need a completion end point that allows different triggers to be specified by the VS Code extension. Roslyn distinguishes between typing as a trigger (e.g. SPACE) and an invocation of the list (e.g. CTRL+SPACE).

@chuckries

This comment has been minimized.

Copy link
Contributor

@chuckries chuckries commented Mar 24, 2017

that allows different triggers to be specified by the VS Code extension

I think this may be an issue. I couldn't find any way to distinguish these triggers from the VS Code endpoint. VS Code's API reports SPACE and CTRL+SPACE as identical triggers.

@DustinCampbell

This comment has been minimized.

Copy link
Collaborator

@DustinCampbell DustinCampbell commented Mar 24, 2017

If that's the case, we'll probably need an ask on VS Code to help us distinguish between them.

@appetizermonster

This comment has been minimized.

Copy link

@appetizermonster appetizermonster commented Apr 12, 2017

Is there any news? 😃

@Leopotam

This comment has been minimized.

Copy link
Contributor

@Leopotam Leopotam commented Apr 12, 2017

appetizermonster

Assignees
No one assigned

I think, no. You can check commits, logging and addiing TODO-s comments more important than basic language features :)

@pedro15

This comment has been minimized.

Copy link

@pedro15 pedro15 commented Oct 7, 2017

Any news ?? :D

@DustinCampbell

This comment has been minimized.

Copy link
Collaborator

@DustinCampbell DustinCampbell commented Oct 7, 2017

@pedro15: A crude form of override completion is already present. It just doesn't trigger on SPACE. You have type the first character of the override method.

@pedro15

This comment has been minimized.

Copy link

@pedro15 pedro15 commented Oct 8, 2017

@DustinCampbel Thanks !

@AlexandreFiset

This comment has been minimized.

Copy link
Author

@AlexandreFiset AlexandreFiset commented Oct 10, 2017

As of the latest version of both VSCode and OmniSharp (October 10th), the auto-complete for overriding of methods still isn't implemented.

If you were to override MyMethod (int myInt), you would have to manually type the requirement, plus do all the formatting by yourself.

Yes, typing "override M" now gives me the name of the base method, but at the bottom of the list of suggestions (even if that is the only method to override) and with no autoformat.

Again a deal breaker to me. I can't believe people are using VSCode; even Monodevelop is vastly superior.

Going back to Visual Studio.

@DustinCampbell

This comment has been minimized.

Copy link
Collaborator

@DustinCampbell DustinCampbell commented Oct 10, 2017

@AlexandreFiset: Thanks for the feedback! I agree that this is an important feature, and there are a couple of active pull requests that bring this particular completion list feature much closer to being implemented. That said, do note that C# for VS Code is an open source project. So, if you're passionate about a particular feature and have some spare cycles, feel free to contribute. We'd be happy to work with you to get a pull request merged.

@AlexandreFiset

This comment has been minimized.

Copy link
Author

@AlexandreFiset AlexandreFiset commented Oct 10, 2017

@DustinCampbell I understand that and unfortunately with my company and the growing team I can't really invest time in other projects for the time being. That being said, I left a comment to avoid other people wasting their time installing VSCode and hit the same wall as I did. I'll try to budget some resources to help out in the future.

@P-Daddy

This comment has been minimized.

Copy link

@P-Daddy P-Daddy commented Nov 4, 2017

@AlexandreFiset : I think you're being a bit harsh. I don't think anybody's "wasting their time" by installing VS Code. All in all, it's an excellent product, and it keeps getting better, and OmniSharp really takes it a long way toward being a full Visual Studio replacement.

Yes, there are a couple of things that it still doesn't do quite as well as Visual Studio, including this issue, but it doesn't make sense that that would cause you to be so incredulous that people would still find it a highly useful tool, or for you to describe it as "vastly" inferior to MonoDevelop (which is also worthy of far more esteem than you seem to hold for it).

In many ways, I find VS Code superior to VS proper. It's a lot faster, and it uses a lot less RAM (especially over time ... VS seems to leak). Its hot exit feature is a whole world better than Visual Studio's backup feature. It's more configurable (and it's easier to find configuration options by searching for them than by navigating a tree). It's a lot easier to use it with non .NET languages. Its command palette is a more developer-friendly method of accessing features. And let's not forget that it does all this equally well (as far as I know) on Windows, OS X, and Linux, and that it's free and open source.

As for me, anyway, I'm grateful to @DustinCampbell, @bpasero, and their teams for putting together a pretty amazing tool and to @microsoft for giving it away.

@AbhimanyuAryan

This comment has been minimized.

Copy link

@AbhimanyuAryan AbhimanyuAryan commented Nov 26, 2017

Looking forward to this. Anytime timeline/roadmap when will this fix?

@helios02

This comment has been minimized.

Copy link

@helios02 helios02 commented Mar 28, 2018

Any update on auto-completing method signatures for overrides? Thanks.

@bugproof

This comment has been minimized.

Copy link

@bugproof bugproof commented Sep 21, 2018

@P-Daddy using vs code instead of vs or anything more full-blown might have advantages you mentioned about but I think the drawback is productivity, you're way more productive using full-blown IDEs(with let's say ReSharper) than omnisharp with an editor like vs-code (at least at this moment). If you have a good hardware, running full-blown IDE is not that slow in my experience.

the issue here is showing the drawbacks, but omnisharp still isn't perfect and it might change in the future

VS or Rider is way more superior for serious dotnet development.

@Leopotam

This comment has been minimized.

Copy link
Contributor

@Leopotam Leopotam commented Sep 21, 2018

@Necronux why not stop developing omnisharp-vscode then? What is main goal of this extension?

@bugproof

This comment has been minimized.

Copy link

@bugproof bugproof commented Sep 22, 2018

@Leopotam I'm not saying it's worthless, but I'm saying it's still far behind full-blown IDEs to be productive with it. You will certainly spend more time writing some piece of code with omnisharp-vscode than with vs or rider.

It's meant to be lightweight but we aren't there yet with features to compete with IDEs.

btw.

Omnisharp itself(the server) is not even documented. IIRC it has some kind of HTTP API but it's not documented anywhere so I can't even imagine the pain to get started if you wanted to contribute to omnisharp-vscode

@sattha

This comment has been minimized.

Copy link

@sattha sattha commented Mar 28, 2019

+1 still hope for this in 2019

@keithelder

This comment has been minimized.

Copy link

@keithelder keithelder commented Apr 17, 2019

@DustinCampbell I just ran into this and sitting here thinking I was doing something weird in VSCode by not getting the return arguments from the method I override. Is it time to start with beer bribery to maybe get this implemented? :)

@ssameng

This comment has been minimized.

Copy link

@ssameng ssameng commented Jun 13, 2019

I check back every hundred times Visual Studio Mac hangs and crashes on me (so every week?) hoping this is implemented. I sadly am just not nearly as productive without this feature.

I'd love to support this in some way so I can finally switch to VS Code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.