mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-26 20:54:22 +01:00
autocomplete: improved rendering of completions
This commit is contained in:
parent
3d6af521db
commit
93d013d1f4
@ -175,26 +175,25 @@ public class ClangCompletionProvider extends LanguageAwareCompletionProvider {
|
|||||||
}
|
}
|
||||||
if (chunk.typedtext != null) {
|
if (chunk.typedtext != null) {
|
||||||
template += chunk.typedtext;
|
template += chunk.typedtext;
|
||||||
|
shortDesc += chunk.typedtext;
|
||||||
typedText = chunk.typedtext;
|
typedText = chunk.typedtext;
|
||||||
}
|
}
|
||||||
if (chunk.placeholder != null) {
|
if (chunk.placeholder != null) {
|
||||||
String[] spl = chunk.placeholder.split(" ");
|
String[] spl = chunk.placeholder.split(" ");
|
||||||
template += "${" + spl[spl.length - 1] + "}";
|
template += "${" + spl[spl.length - 1] + "}";
|
||||||
shortDesc += spl[spl.length - 1] + ", ";
|
shortDesc += spl[spl.length - 1];
|
||||||
}
|
}
|
||||||
if (chunk.info != null) {
|
if (chunk.info != null) {
|
||||||
// System.out.println("INFO: "+chunk.info);
|
// System.out.println("INFO: "+chunk.info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
template += "${cursor}";
|
template += "${cursor}";
|
||||||
int lastComma = shortDesc.lastIndexOf(",");
|
|
||||||
if (lastComma > 0) {
|
|
||||||
shortDesc = shortDesc.substring(0, lastComma);
|
|
||||||
}
|
|
||||||
shortDesc += ")";
|
|
||||||
System.out.println("TEMPLATE: " + template);
|
System.out.println("TEMPLATE: " + template);
|
||||||
return new TemplateCompletion(this, typedText,
|
System.out.println("SHORT: " + shortDesc);
|
||||||
shortDesc + " : " + returnType, template);
|
if (!returnType.isEmpty()) {
|
||||||
|
shortDesc += " : " + returnType;
|
||||||
|
}
|
||||||
|
return new TemplateCompletion(this, typedText, shortDesc, template);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,21 +120,25 @@ public class CompletionsRenderer extends DefaultListCellRenderer {
|
|||||||
//
|
//
|
||||||
// } else
|
// } else
|
||||||
if (value instanceof ShorthandCompletion) {
|
if (value instanceof ShorthandCompletion) {
|
||||||
text = ((ShorthandCompletion) value).getShortDescription();
|
ShorthandCompletion v = (ShorthandCompletion) value;
|
||||||
|
text = v.getShortDescription();
|
||||||
tokenType = CompletionType.TEMPLATE;
|
tokenType = CompletionType.TEMPLATE;
|
||||||
} else if (value instanceof FunctionCompletion) {
|
} else if (value instanceof FunctionCompletion) {
|
||||||
text = font(((FunctionCompletion) value).getInputText(), LIGHT_BLUE)
|
FunctionCompletion v = (FunctionCompletion) value;
|
||||||
+ font(((FunctionCompletion) value).getShortDescription(), GRAY);
|
text = font(v.getInputText(), LIGHT_BLUE) + " "
|
||||||
|
+ font(v.getShortDescription(), GRAY);
|
||||||
tokenType = CompletionType.FUNCTION;
|
tokenType = CompletionType.FUNCTION;
|
||||||
} else if (value instanceof BasicCompletion) {
|
} else if (value instanceof BasicCompletion) {
|
||||||
text = ((BasicCompletion) value).getInputText();
|
BasicCompletion v = (BasicCompletion) value;
|
||||||
if (((BasicCompletion) value).getShortDescription() != null) {
|
if (v.getShortDescription() != null) {
|
||||||
text = ((BasicCompletion) value).getShortDescription();
|
text = v.getShortDescription();
|
||||||
|
} else {
|
||||||
|
text = v.getInputText();
|
||||||
}
|
}
|
||||||
} else if (value instanceof TemplateCompletion) {
|
} else if (value instanceof TemplateCompletion) {
|
||||||
TemplateCompletion template = (TemplateCompletion) value;
|
TemplateCompletion v = (TemplateCompletion) value;
|
||||||
text = font(template.getInputText(), LIGHT_BLUE)
|
text = font(v.getInputText(), LIGHT_BLUE) + " "
|
||||||
+ font(template.getDefinitionString(), GRAY);
|
+ font(v.getDefinitionString(), GRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text == null) {
|
if (text == null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user