Skip to content

Completion missing members of lambda parameter in fault tolerance case#34312

Merged
ivanbasov merged 17 commits intodotnet:masterfrom
ivanbasov:theninclude
Mar 29, 2019
Merged

Completion missing members of lambda parameter in fault tolerance case#34312
ivanbasov merged 17 commits intodotnet:masterfrom
ivanbasov:theninclude

Conversation

@ivanbasov
Copy link
Copy Markdown
Contributor

Fix #8237

@ivanbasov ivanbasov added the IDE-IntelliSense Completion, Signature Help, Quick Info label Mar 21, 2019
@ivanbasov ivanbasov added this to the 16.1.P1 milestone Mar 21, 2019
@ivanbasov ivanbasov requested review from a team and CyrusNajmabadi March 21, 2019 00:04
@ivanbasov ivanbasov changed the title Theninclude Completion missing members of lambda parameter in fault tolerance case Mar 21, 2019
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whooboy. this is complex.

  1. Consider doc'ing this.
  2. should we pull these type parameters up to the class? Does either language ever call this same method with a different instantiation? #Resolved

Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this whole method needs comments helping explain what is going on. i.e.: // this code is to help give intellisense in the following case: .... And then explain what we're looking for and what this is working around. #Resolved

Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm going to hold off until then, aas that will really help me understand what's going on here and why it's appropriate. Ping me whne you think it's good to look again! #Resolved

Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single is very dangerous. We should verify we only have one ref before doing this. you never know if a future compiler change might break this. #Resolved

@ivanbasov
Copy link
Copy Markdown
Contributor Author

ivanbasov commented Mar 26, 2019

@CyrusNajmabadi , @dpoeschl , could you please review? #Resolved

<PackageReference Include="Microsoft.VisualStudio.Shell.15.0" Version="$(MicrosoftVisualStudioShell150Version)" />
<PackageReference Include="Microsoft.VisualStudio.ComponentModelHost" Version="$(MicrosoftVisualStudioComponentModelHostVersion)" />
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />
<PackageReference Include="StreamJsonRpc" Version="$(StreamJsonRpcVersion)" />
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this? #Resolved

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is from another PR. Thank you!


In reply to: 268920484 [](ancestors = 268920484)

protected abstract bool TryGetOrdinalInArgumentList(SyntaxNode argumentOpt, out int ordinalInInvocation);

// This code is to help give intellisense in the following case:
// query.Include(a => a.SomeProerty).ThenInclude(a => a.
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proerty #Resolved

// Cannot proceed without DeclaringSyntaxReferences.
// We expect that there is a single DeclaringSyntaxReferences in the scenario.
// If anything changes on the compiler side, the approach should be revised.
if (containingMethod.DeclaringSyntaxReferences.IsDefaultOrEmpty || containingMethod.DeclaringSyntaxReferences.Length > 1)
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DeclaringSyntaxReferences is never Default. So you could just simple this to .DeclaringSyntaxReferences.Length != 1 #Resolved

continue;
}

type = type.GetAllTypeArguments()[ordinalInLambda];
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allTypeArguments[ordinalInLambda] #Resolved


Return New VisualBasicRecommendationServiceRunner(context, filterOutOfScopeLocals, cancellationToken)
End Function

Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove. #Resolved

End Sub

Public Overrides Function GetSymbols() As ImmutableArray(Of ISymbol)

Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove... #Resolved

End Function

Protected Overrides Function IsInvocationExpression(syntaxNode As SyntaxNode) As Boolean

Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove #Resolved

End Function

Protected Overrides Function IsLambdaExpression(syntaxNode As SyntaxNode) As Boolean

Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove #Resolved

Copy link
Copy Markdown
Contributor Author

@ivanbasov ivanbasov Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of those empty lines. I just found them in the original code. Was it an obsolete code style? #Resolved

Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah... that's super bizarre... i'm not sure how that happened. def can remove :) (and can get rid of all my comments). #Resolved

Copy link
Copy Markdown
Contributor Author

@ivanbasov ivanbasov Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Thanks! Will remove all the empty lines #Resolved

End Function

Protected Overrides Function TryGetOrdinalInArgumentList(argumentOpt As SyntaxNode, ByRef ordinalInInvocation As Integer) As Boolean

Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove #Resolved


ordinalInInvocation = -1
Return False
End Function
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, fwiw, i think you could use ISyntaxFacts and not need the top two methods. You could also move this method into the base type. #Resolved

End Function

Private Function GetUnqualifiedSymbolsForLabelContext() As ImmutableArray(Of ISymbol)

Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove. this style is not used at all in the IDE. #Resolved

End Function

Private Function IsOrContainsValidAccessibleClass(namespaceOrTypeSymbol As INamespaceOrTypeSymbol, within As ISymbol) As Boolean

Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please undo all of this :) it's just not the IDE style (i also don't understand why we'd want it). #Resolved

return default(IIncludableQueryable<TEntity, TProperty>);
}
}
}]]>
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you extract this into a constant and just include that in all these tests. it really bloats to have to have it in each test. #Resolved

Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it also makes it harder to tell how each test differs. #Resolved


Friend Class Registration
Public Property Activities As ICollection(Of Activity)
End Class
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same point here. #Resolved

{
var builder = ArrayBuilder<ITypeSymbol>.GetInstance();
var expressionSymbol = _context.SemanticModel.Compilation.GetTypeByMetadataName(typeof(Expression<>).FullName);
var funcSymbol = _context.SemanticModel.Compilation.GetTypeByMetadataName(typeof(Func<>).FullName);
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to be resilient to these not being around.

it's rare, but it can definitely happen during solution load (when we don't have all references properly attached). Either we can bail here if they're null, or we can check them in the loop accordingly. #Resolved

cancellationToken As CancellationToken) As AbstractRecommendationServiceRunner(Of VisualBasicSyntaxContext)
Return New VisualBasicRecommendationServiceRunner(context, filterOutOfScopeLocals, cancellationToken)
End Function
End Class
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi Mar 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can just revert this file. #Resolved

Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. would like test cleanup, and we need some null checks. I don't need to review again. Tnx!

@ivanbasov
Copy link
Copy Markdown
Contributor Author

@dpoeschl please review

@ivanbasov
Copy link
Copy Markdown
Contributor Author

@genlu could you please review?

@ivanbasov ivanbasov modified the milestones: 16.1.P1, 16.1.P2 Mar 27, 2019
Copy link
Copy Markdown
Member

@genlu genlu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@ivanbasov ivanbasov merged commit f38ba3a into dotnet:master Mar 29, 2019
@ivanbasov ivanbasov deleted the theninclude branch March 29, 2019 19:02
@gafter
Copy link
Copy Markdown
Member

gafter commented Mar 29, 2019

Nice work @ivanbasov !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

IDE-IntelliSense Completion, Signature Help, Quick Info

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants