aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzzhongwei2012-08-19 23:10:18 (EDT)
committerzzhongwei2012-08-19 23:10:18 (EDT)
commitffff9e423e0d06c7b11847fb68f9fcac5b7f50df (patch)
tree1afe6dc2b701e0f2e3bf74ca57ae0e34b684b074
parentee85aa3af9009c1e18f7912cc32982a0cd2dc69e (diff)
downloadorg.eclipse.pdt-ffff9e423e0d06c7b11847fb68f9fcac5b7f50df.zip
org.eclipse.pdt-ffff9e423e0d06c7b11847fb68f9fcac5b7f50df.tar.gz
org.eclipse.pdt-ffff9e423e0d06c7b11847fb68f9fcac5b7f50df.tar.bz2
387449: Code completion supports array indexes in PHP code
https://bugs.eclipse.org/bugs/show_bug.cgi?id=387449
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/ArrayStringKeysStrategy.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/ArrayStringKeysStrategy.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/ArrayStringKeysStrategy.java
index 3453cd4..393acef 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/ArrayStringKeysStrategy.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/ArrayStringKeysStrategy.java
@@ -123,7 +123,10 @@ public class ArrayStringKeysStrategy extends AbstractCompletionStrategy {
Scalar scalar = (Scalar) s.getKey();
if (scalar.getScalarType() == Scalar.TYPE_STRING) {
String key = ASTUtils.stripQuotes(scalar.getValue());
- if (key.toLowerCase().startsWith(prefix.toLowerCase())) {
+ if (!scalar.getValue().equals(key)
+ && key.length() > 0
+ && key.toLowerCase().startsWith(
+ prefix.toLowerCase())) {
names.add(key);
}
}
@@ -137,7 +140,10 @@ public class ArrayStringKeysStrategy extends AbstractCompletionStrategy {
Scalar scalar = (Scalar) s.getIndex();
if (scalar.getScalarType() == Scalar.TYPE_STRING) {
String key = ASTUtils.stripQuotes(scalar.getValue());
- if (key.toLowerCase().startsWith(prefix.toLowerCase())) {
+ if (!scalar.getValue().equals(key)
+ && key.length() > 0
+ && key.toLowerCase().startsWith(
+ prefix.toLowerCase())) {
names.add(key);
}
}
@@ -151,7 +157,10 @@ public class ArrayStringKeysStrategy extends AbstractCompletionStrategy {
Scalar scalar = (Scalar) s.getIndex();
if (scalar.getScalarType() == Scalar.TYPE_STRING) {
String key = ASTUtils.stripQuotes(scalar.getValue());
- if (key.toLowerCase().startsWith(prefix.toLowerCase())) {
+ if (!scalar.getValue().equals(key)
+ && key.length() > 0
+ && key.toLowerCase().startsWith(
+ prefix.toLowerCase())) {
names.add(key);
}
}