Skip to content

Commit

Permalink
language-server: fixes a class being incorrectly auto-imported when a…
Browse files Browse the repository at this point in the history
… .* import for its package already exists (closes #653)
  • Loading branch information
joshtynjala committed Dec 8, 2022
1 parent 611db5f commit 53fb0b5
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ public static boolean needsImport(IASNode offsetNode, String qualifiedName) {
// things in this package don't need to be imported
return false;
}
String packageImportName = qualifiedName.substring(0, packageEndIndex) + ".*";
IASNode node = offsetNode;
while (node != null) {
if (node instanceof IPackageNode) {
Expand All @@ -235,7 +236,8 @@ public static boolean needsImport(IASNode offsetNode, String qualifiedName) {
IASNode child = node.getChild(i);
if (child instanceof IImportNode) {
IImportNode importNode = (IImportNode) child;
if (qualifiedName.equals(importNode.getImportName())) {
String importNodeName = importNode.getImportName();
if (qualifiedName.equals(importNodeName) || packageImportName.equals(importNodeName)) {
return false;
}
}
Expand Down

0 comments on commit 53fb0b5

Please sign in to comment.