Skip to content

Commit

Permalink
language-server: definition name completion is not skipped for overri…
Browse files Browse the repository at this point in the history
…dden functions and accessors (references #654)

follow up to commit 9c6a730
  • Loading branch information
joshtynjala committed Oct 26, 2023
1 parent b98be37 commit 06bd8a5
Showing 1 changed file with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -352,24 +352,33 @@ private CompletionList actionScriptCompletion(IASNode offsetNode, Path path, Pos
}
currentNodeForScope = currentNodeForScope.getParent();
} while (currentNodeForScope != null);

return result;
// don't return because the function might be an override
// and the name can be completed
}
if (ASTNodeID.KeywordVarID.equals(keywordNode.getNodeID())
|| ASTNodeID.KeywordConstID.equals(keywordNode.getNodeID())
|| ASTNodeID.KeywordClassID.equals(keywordNode.getNodeID())
|| ASTNodeID.KeywordInterfaceID.equals(keywordNode.getNodeID())
|| ASTNodeID.KeywordGetID.equals(keywordNode.getNodeID())
|| ASTNodeID.KeywordSetID.equals(keywordNode.getNodeID())) {
|| ASTNodeID.KeywordInterfaceID.equals(keywordNode.getNodeID())) {
return result;
}
}
if (parentNode != null && parentNode instanceof IDefinitionNode && !(parentNode instanceof IPackageNode)) {
if (parentNode != null && parentNode instanceof IDefinitionNode) {
IDefinitionNode defNode = (IDefinitionNode) parentNode;
if (offsetNode == defNode.getNameExpressionNode()) {
// no completion for definition names because names shouldn't
// conflict with each other
return result;
boolean skipCompletion = true;
if (defNode instanceof IPackageNode) {
skipCompletion = false;
} else if (defNode instanceof IFunctionNode) {
IFunctionNode funcNode = (IFunctionNode) defNode;
if (funcNode.hasModifier(ASModifier.OVERRIDE)) {
skipCompletion = false;
}
}
if (skipCompletion) {
// no completion for certain definition names where names
// shouldn't conflict with each other
return result;
}
}
}

Expand Down

0 comments on commit 06bd8a5

Please sign in to comment.