private final SCLCompletionType completionType;
public SCLCompletionProposal(SCLValue value, int replacementOffset, String prefix) {
- this.name = value.getName().name;
- this.module = value.getName().module;
+ String tempName = value.getName().name;
+ String tempModule = value.getName().module;
+ int p = tempName.lastIndexOf('.');
+ if(p >= 0) {
+ tempModule = tempModule + "." + tempName.substring(0, p);
+ tempName = tempName.substring(p+1);
+ }
+ this.name = tempName;
+ this.module = tempModule;
this.documentation = value.getDocumentation();
this.content = name + " :: " + value.getType() + " (" + module + ")";
this.replacementOffset = replacementOffset;
@Override
public boolean validate(IDocument document, int offset, DocumentEvent event) {
try {
-// System.out.println("replacementOffset : " + replacementOffset);
-// System.out.println("offset : " + offset);
+ String n = getName();
+ //System.out.println(n + " (" + n.length() + ") " + replacementOffset + " " + offset);
boolean a = offset >= replacementOffset;
- boolean b = offset < replacementOffset + getName().length();
+ boolean b = offset <= replacementOffset + n.length();
String s = document.get(replacementOffset, offset - replacementOffset);
prefix = s;
- String d = getName();//.substring(0, offset - prefixStart);
- boolean c = d.toLowerCase().startsWith(s.toLowerCase());
+ //System.out.println("prefix: " + s + " - " + prefix);
+ boolean c = n.toLowerCase().startsWith(s.toLowerCase());
+ //System.out.println("matches: " + a + " " + b + " " + c);
return a && b && c;
} catch (BadLocationException x) {
//x.printStackTrace();