DEV Community

Discussion on: Have you tried IntelliCode? If so, what's your favorite (or least favorite!) suggestions so far?

Collapse
 
sampruden profile image
Sam • Edited

I just wrote the following code

if (declarationKind == DeclarationKind.Struct) return GetDeclaration("struct");
if (declarationKind == DeclarationKind.Class) return GetDeclaration("class");

On the first line Intellicode suggested DeclarationKind.Struct. That was a good suggestion. On the second line it suggested DeclarationKind.Struct again. That's a bad suggestion because not only is it unlikely to be what I want to do, it would be unreachable code.

I'd like to see it definitely not do it when it's unreachable. However, even if my if statement didn't return and the second case was reachable, I'd like Intellicode to guess that I'm unlikely to be repeating the same condition. DeclarationKind.Struct could still be starred, but shouldn't be the top priority suggestion.

If it could have seen that my "struct" string was a lowercase version of the name "Struct" and then suggested "class" because it's the lowercase version of "Class", that would be magic.

Collapse
 
lostintangent profile image
Jonathan Carter

That’s great feedback! We currently take a lot of context into account when providing suggestions, but there’s still plenty of room to improve 👍 These are both good examples for us to use to iterate. Keep the feedback coming!