-
Notifications
You must be signed in to change notification settings - Fork 676
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
Comments
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! |
+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. |
+1 |
+1 |
@DustinCampbell multiple requests during last 3 months - no assignees. Can we know devs plans about this problem? |
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! 😄 |
@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? |
In the VS Code extension, you'll need to ensure that completion can trigger on a space character (assuming that's possible). |
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? |
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. |
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. |
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. |
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. |
I see. I think in that case I'll bow out. Thanks for the info! |
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. |
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. |
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. |
Yes. I know that's how it works today. That code would all go away with the new end point. |
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. |
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 |
Space and Ctrl+Space should trigger the same request. This is something we've been trying to move toward in VS. |
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 |
Correct. After typing |
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. |
If that's the case, we'll probably need an ask on VS Code to help us distinguish between them. |
Is there any news? 😃 |
appetizermonster
I think, no. You can check commits, logging and addiing TODO-s comments more important than basic language features :) |
Any news ?? :D |
@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. |
@DustinCampbel Thanks ! |
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. |
@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. |
@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. |
@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. |
Looking forward to this. Anytime timeline/roadmap when will this fix? |
Any update on auto-completing method signatures for overrides? Thanks. |
@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. |
@Necronux why not stop developing |
@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 |
+1 still hope for this in 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? :) |
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. |
1,188 days later... |
Created a github account just to second this. |
now that seems to partially work for me except it does not put the return type, and doesn't type the accessibility modifier. So I have to guess more or less. Still better than nothing though |
+1 current workaround for this is to hit CTRL+. on the class definition and select "Generate overrides". |
Didn't know about that shortcut. Thanks! |
+1 for this. As temporary stop gap until the "override" + space can be made to work properly, any chance of "Generate override" command? Basically the same as the "Generate overrides" command, but instead of generating all available overrides prompts for which method to override? Also, there probably shouldn't be ellipsis on the "Generate Overrides..." command as it doesn't prompt before it does its thing. Nor on the other Generate commands for that matter. Brad |
+1 |
Or 3 years, 7 months, 15 days and counting... |
Environment data
dotnet --info
output:VS Code version: 1.8.0
C# Extension version: 1.5.3
Steps to reproduce
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.
The text was updated successfully, but these errors were encountered: