-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Codist Beta 7.6 #283
Comments
Small suggestion: Is it possible to add a variant of Find Derived Classes / Interfaces, where only the classes / interfaces that directly inherit are shown (not the entire chain, i.e. no grand-children, no great-grand-children, etc.)? |
There's a new beta version which implements limited derivation search. |
That's awesome! You are so fast! Thank you! |
Just tried latest beta. Does not seem to work for me - the list is always empty, even though there are several directly-derived classes in other assemblies (some abstract, some not). Interfaces seem to work though. |
The issue is when those derived classes are in other assemblies / projects than the base class. If the two classes share the same assembly, then it works just fine. |
Please try the new beta. |
Still the same issue. If a derived class is in the same assembly, it shows up. If it is in different assembly, it does not show up. If however I search for all derived classes (previous default behavior) - they all show up. |
Perhaps you could just use filtering down approach - i.e. use the code that works - that lists all derived classes, but then check each candidate manually to make sure it actually is directly-derived. That way none of the directly derived classes will be missed. |
It had something to do with generic classes. OK, please download the new beta. |
Unfortunately it still does not work. And in my case there are no generic classes involved. Unfortunately as of yet I could not produce a repro that I can send, because it does work in the test solution I made with 2 projects. So, perhaps you can just reuse the old code that lists all derived classes / interfaces, and then manually check each one if it is a directly-derived, and if it is keep it in the list (as opposed to trying to get only directly derived classes only in the first place). |
Yes, it is what Codist is doing--find all derived classes first and filter them, keeping those which have type.BaseType = questionedType. I have a solution that has multiple projects and the filter is doing its job without any problem. |
In other words, perhaps you can reuse Codist/Codist/Controls/SymbolCommands.cs Line 45 in 88d9aa2
And then manually check each item in |
Oh I see. Very strange then. What filtering code are you using to get at directly-derived classes? Can you share your code? |
internal static async Task FindDerivedClassesAsync(this SemanticContext context, ISymbol symbol, bool directDerive) {
var type = symbol as INamedTypeSymbol;
var classes = await SymbolFinder.FindDerivedClassesAsync(type, context.Document.Project.Solution).ConfigureAwait(false);
if (directDerive) {
if (type.IsGenericType) {
classes = classes.Where(t => {
var bt = t.BaseType;
return bt.Equals(type) || bt.IsGenericType && bt.OriginalDefinition.Equals(type);
});
}
else {
classes = classes.Where(t => t.BaseType.Equals(type));
}
}
await SyncHelper.SwitchToMainThreadAsync(default);
ShowSymbolMenuForResult(symbol, context, classes.ToList(), directDerive ? R.T_DirectlyDerivedClasses : R.T_DerivedClasses, false);
} |
Thank you for sharing the code. I guess it maybe something to do with Roslyn. I will get back to you if I get some more ideas. |
Could you perhaps add some logging into this routine that will record fully qualified name of: |
Somehow the |
That's what I thought. Which is why I thought it would be nice to see the actual lists that Roslyn gives for each case, including their base types. Just to see what we are comparing with what. Perhaps instead of qualified names, record location / project / assembly of the symbol in question? BTW, this may also shed some light into other Roslyn-related / find-symbol-related areas as well - as to why they may fail too. |
I mean the idea is to have a text representation of each |
BTW: Do the latest beta version of Codist re-introduce parenthesis/quotes automatic surrounding of selected text issue? I noticed that my selection gets surrounded with |
Yes. It does. A few users asked for that. |
Oh I see. Please make it optional. Right now it is very annoying - I certainly do not want any smart behavior with selections - just plain overwrite. Perhaps add a new checkbox under Feature Controllers on the General Page. Or introduce a whole new options page with typing/editor tweaks? |
Once the first character is typed,
On my side, situation 2 + situation 3 is far more frequent than situation 1. Thus I can tolerate situation 1. Anyway, an option will be there in the next version. |
Thank you for explanation. I will give it a try. But glad to know that there will also be an option! Does the new beta you just released contain any logging with regards to |
The previous implementation did not allow the above situation 2, and situation 1 required moving the caret, thus it was very very very annoying 😡 . That feature will by default turned off in the finally released version unless I found some better way to introduce the changes in the new version to the users.
No. Not yet. The log will have to be quite verbose I guess. I need to figure out what to be logged. |
Ideally assembly / project name, file location (at least first code file in case of |
Please try this beta, which generates some logs. To activate the log and make Codist log to the log file:
{
"Version": "7.5.0",
"LogPath": "D:\\log.txt",
"DisplayOptimizations": "HideSearchBox, HideAccountBox, ShowCpu",
// reset omitted ... |
Thanks so much. I will try it soon and let you know my findings! |
Just tried it. Unfortunately VS crashes when I attempted Ctrl+FindDerived:
The log file was empty. |
Yes, the new approach is quite smart! I like how you handled the common cases. But what if I want to type just one of the parenthesis replacing selection. Presumably I would have to hit |
Also, got another VS crash (unrelated to logging or Derived Classes thing) - apparently when it tried to display Super Quick Info:
|
I checked out the source code of Roslyn and found that there was no magic. Please try the new beta and see whether it works. |
No. You don't need hitting Delete twice. Do NOT press Delete before typing |
This is awesome! I really like it! |
Tried the new beta. Directly-Derived Classes is empty once again. And log file is empty too. I guess this version has no logging. It would be nice to see the log, so can you please enable logging for this routine? |
In short, the log would not help since the underlying conditions are complicated. I reproduced the problem of BaseType comparison while I was developing the hierarchical result presentation. Then I checked more thoroughly into the source code of Roslyn and found that special type comparison mechanism was used while searching for derived classes. |
Glad you were able to at least reproduce the issue on your end, as I could not produce a repro - it only occurs in my large solution. Hopefully the workaround won't be too difficult. Though I do think that perhaps having some kind of logging mechanism for Roslyn-related stuff in Codist could be useful potentially to diagnose other kinds of issues, like the one from a few months back where symbols could not be navigated to in the NaviBar. |
While I am working on prerequisites for #231, this issue has been partially addressed in the previous beta and will get better dealt with in upcoming versions. |
The new beta should be able to fix the missing classes in Find Derived Classes command. A new button is added to copy the symbol list content to clipboard. The potential crash in Quick Info repositioning is also addressed. |
The new beta works great! Thank you so much for all your work! I really like the new hierarchical display of derived classes too! |
Please help test the new hierarchical view by comparing its output with the one from the previous implementation. |
I will keep an eye on this. So far the counts have matched, so it works really well. I will let you know if I come across inconsistencies. |
@fitdev I am going to release this version.
|
Both items work as they should! Really like the new derived classes representation! |
Maybe there will be a tree view in the future version, so we can collapse and expand hierarchical items. |
That would be great or a multi-column list-view like control! I think though in general, (perhaps I even suggested it sometime ago in a separate issue), it would be nice to have improved sorting/filtering capability for the symbol list control (including the one used for NaviBar). Like ability to filter not just accessibility levels but kinds of classes - static, record, sealed, etc; kinds of members - extension, virtual, abstract, etc. |
Download
Codist 9081
Codist 9076
Codist 9058
Codist 9056
Codist 9020
Codist 9015
Codist 8980
Codist 8973
Codist 8926
Codist 8918
What's New
The text was updated successfully, but these errors were encountered: