From a6652f938a3eed77e945dea5143e45b786eebcaa Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 3 Aug 2017 18:21:00 +0200 Subject: [PATCH] codecompletion: added function parameters support. --- .../autocomplete/ArduinoCompletionsList.java | 18 ++++++++++++++++++ .../autocomplete/ClangCompletionProvider.java | 5 ++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/src/cc/arduino/autocomplete/ArduinoCompletionsList.java b/app/src/cc/arduino/autocomplete/ArduinoCompletionsList.java index a29b7a1c8..023dca082 100644 --- a/app/src/cc/arduino/autocomplete/ArduinoCompletionsList.java +++ b/app/src/cc/arduino/autocomplete/ArduinoCompletionsList.java @@ -10,6 +10,7 @@ class ArduinoCompletion { ArduinoCompletionDetail completion; String type; String location; + List parameters; public ArduinoCompletionDetail getCompletion() { return completion; @@ -22,6 +23,23 @@ class ArduinoCompletion { public String getLocation() { return location; } + + public List getParameters() { + return parameters; + } +} + +class ArduinoParameter { + String name; + String type; + + public String getName() { + return name; + } + + public String getType() { + return type; + } } class ArduinoCompletionDetail { diff --git a/app/src/cc/arduino/autocomplete/ClangCompletionProvider.java b/app/src/cc/arduino/autocomplete/ClangCompletionProvider.java index 40c0f13f8..29276142f 100644 --- a/app/src/cc/arduino/autocomplete/ClangCompletionProvider.java +++ b/app/src/cc/arduino/autocomplete/ClangCompletionProvider.java @@ -70,9 +70,12 @@ public class ClangCompletionProvider extends DefaultCompletionProvider { if (cc.type.equals("Function")) { List params = new ArrayList<>(); + int i=0; for (CompletionChunk chunk : cc.completion.chunks) { if (chunk.placeholder != null) { - params.add(new Parameter("type", chunk.placeholder)); + ArduinoParameter p = cc.parameters.get(i); + params.add(new Parameter(p.type, p.name)); + i++; } }