-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Productivity: Completion should have a way to see items there is no using/reference for #7053
Comments
This would be pretty good. For example extension methods. I always for get to add the using statement for "System.Data.Entity" which gives you a bunch more extension methods for Entity Framework. I think it definitely needs some visual cue as to whether or not a using and/or reference needs to be added. Also need to be careful about how much is included. With fuzzy matching you could include a whole bunch of symbols which might be more confusing than helpful. I am not sure how the filtering/fuzzy matching is done. Some sort of distance function i.e. Levenshtein distance? But for symbols that are not already accessible there should probably be some minimum match quality before a symbol is included. Maybe this could be user configurable. Or am I just making things more complicated than they need to be?? |
@dfkeenan I think we'll definitely have to be careful, and provide some indication that a significant operation (adding a nuget package, reference, or using) is also going to happen. I'm less excited about the idea of making the match quality a user configurable thing though... |
@Pilchie I was just throwing ideas out there. As long as the match quality threshold is well balanced there is no need to make it user configurable. |
Would love to see this bumped :-). After not using Resharper for a month now, this is definitely the most important feature I miss, it speeds up writing code a ton! |
@DustinCampbell this feature is so important for us, nearly two years since this issues created,do you have any plans? so thanks! |
@DustinCampbell @Pilchie @kuhlenh any news?cry cry cry...... |
@sunxinzhe2012 added the milestone. This is definitely near the top of our backlog :) |
@kuhlenh oh yeah,good job,tk u and your team! |
+1 on this as per mail thread. |
Thoughts:
|
Is there anything that can be done to get this pulled into 15.5 or another 15.x release? This is the last major thing I use ReSharper for... |
I don't think such a table would be necessary. We could certainly just populate the list with the known typenames that the AssemblySymbol already exposes. Then, we could lazily find that type for the description when it is shown. Now, if we want to also show the import that will be added, we would need to know the containing namespace for the type. This is not currently easily exposed, but it could be if we update the declaration-table at the compiler layer appropriately. i.e. the compiler knows exactly what namespace the type is in when it builds the TypeNames collection. We could have a TypeName-to-Container map that gets created as well and exposed from assembly symbols. The benefit here is that this is already in the declaration table, is extremely cheap, and is easy to keep up to date. Importantly, it does not cause symbols to be created, and it does not require walking the entire symbol. |
That. Or there could be a new chord that creates this sort of list. i.e. instead of ctrl-space, ctrl-shift-space. Also, i'm skeptical that "a massive and cluttered list" is actually a problem. Today, it's easy to get into a situation where you have a dozen or so imports, and the list already contains 10k+ entries. At this point the list is already massive and cluttered. So having more entries doesn't really change anything. I think what is relevant is that the list not feel cluttered once the user starts filtering things down. And that will take a bit of experimentation to see if there actually is an issue or not. My gut tells me 'no'. But we'd need to see. |
I would not want an extra chord. I like the way R# presents the types that need an import -- the types are there:
I don't think type pollution would be a problem. Limiting to only being after the filter is expired also impedes discovery. The whole point is that I don't know/fully remember the type name (or am too lazy to use the import). The completion should add the using statement too (if that wasn't already obvious). |
Discovery seems hard no matter what. Your list will have 100s of thousands of items in it. How do you discover anything of value in that, unless you are filtering down to things you think are are relevant? |
One concern after testing PR from @genlu . wdyt? |
I agree that in scope items should be before the unimported ones. And the namespace of the unimported one should be in parenthesis of the list to show where it’s coming from. |
@Dreamescaper Thanks for the feedback! And I agree with you, we need to prioritize in-scope symbols in completion list to make it usable. I will fix that. Other other hand, have you noticed any perf regression in typing (which has been the main focus of the PR, so I'm curious)? @onovotny Are you suggesting to add parenthesis to the greyed-out namespace text? |
Yes, for two reasons:
|
OK, I will take your feedback in to account. Thanks! :) |
Completion for unimported types is implemented by #34808. Currently we only have an option to enable/disable it in completion list. New short cut OR new filter will come in a later update (but not both, and we are still debating internally which way to go). |
@onovotny FYI I didn't add parenthesis to namespace in current implementation. Will wait for more feedbacks until making a final decision. |
@genlu If you don't prefer parentheses, what about something like |
@jnm2 I thin that's reasonable too |
@genlu |
@Dreamescaper Ah, I see. Will fix. Thanks! |
Great catch @Dreamescaper . Def something we'll want to look into improving @genlu . Completion items rules have a match priority. We might want to make these negative to indicate they have less priority than a match with any normal ( |
@CyrusNajmabadi Making the match priority for import items lower probably wouldn't help in this particular case, I think the reason that the import item is considered a better match is because it doesn't have the |
@Dreamescaper I have created a bug to track this #35163. Thanks! |
That seems strange to me. We likely need to rethink some of the logic here :) |
I started using this today and it's fantastic! Thanks for all your hard work! |
Pretty cool indeed. Should we file problems we encounter as separate issues? |
@YairHalberstadt @chucker |
How do I enable this feature? What version of VS will this be in? |
@oliverjanik it's shipping (as opt-in) in VS 2019 16.1. https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes#net-productivity |
No description provided.
The text was updated successfully, but these errors were encountered: