Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
4ian committed Nov 29, 2023
1 parent d412f90 commit d4a3c60
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Core/GDCore/IDE/Events/ExpressionCompletionFinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,10 @@ class GD_CORE_API ExpressionCompletionFinder
auto type = gd::ExpressionTypeFinder::GetType(
platform, projectScopedContainers, rootType, node);

// Only attempt to complete with the children of the variable
// if it's the last child (no more `.AnotherVariable` written after).
bool eagerlyCompleteIfExactMatch = node.child == nullptr;

if (gd::ValueTypeMetadata::IsTypeLegacyPreScopedVariable(type)) {
if (type == "globalvar" || type == "scenevar") {
const auto* variablesContainer =
Expand Down Expand Up @@ -564,7 +567,10 @@ class GD_CORE_API ExpressionCompletionFinder
node.childIdentifierName);
}
} else {
// Complete a root variable of the scene or project:
// Complete a root variable of the scene or project.

// Don't attempt to complete children variables if there is
// already a dot written (`MyVariable.`).
bool eagerlyCompleteIfPossible =
!node.identifierNameDotLocation.IsValid();
AddCompletionsForVariablesMatchingSearch(
Expand Down Expand Up @@ -592,7 +598,10 @@ class GD_CORE_API ExpressionCompletionFinder
node.childIdentifierName);
}
} else {
// Complete a root variable of the object:
// Complete a root variable of the object.

// Don't attempt to complete children variables if there is
// already a dot written (`MyVariable.`).
bool eagerlyCompleteIfPossible =
!node.identifierNameDotLocation.IsValid();
AddCompletionsForObjectOrGroupVariablesMatchingSearch(
Expand Down

0 comments on commit d4a3c60

Please sign in to comment.