Skip to content

Commit f8c1724

Browse files
cmagliefacchinm
authored andcommitted
codecompletion: added function parameters support.
1 parent dc7a732 commit f8c1724

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

Diff for: app/src/cc/arduino/autocomplete/ArduinoCompletionsList.java

+18
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class ArduinoCompletion {
1010
ArduinoCompletionDetail completion;
1111
String type;
1212
String location;
13+
List<ArduinoParameter> parameters;
1314

1415
public ArduinoCompletionDetail getCompletion() {
1516
return completion;
@@ -22,6 +23,23 @@ public String getType() {
2223
public String getLocation() {
2324
return location;
2425
}
26+
27+
public List<ArduinoParameter> getParameters() {
28+
return parameters;
29+
}
30+
}
31+
32+
class ArduinoParameter {
33+
String name;
34+
String type;
35+
36+
public String getName() {
37+
return name;
38+
}
39+
40+
public String getType() {
41+
return type;
42+
}
2543
}
2644

2745
class ArduinoCompletionDetail {

Diff for: app/src/cc/arduino/autocomplete/ClangCompletionProvider.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,12 @@ protected List<Completion> getCompletionsImpl(JTextComponent textarea) {
7070

7171
if (cc.type.equals("Function")) {
7272
List<Parameter> params = new ArrayList<>();
73+
int i=0;
7374
for (CompletionChunk chunk : cc.completion.chunks) {
7475
if (chunk.placeholder != null) {
75-
params.add(new Parameter("type", chunk.placeholder));
76+
ArduinoParameter p = cc.parameters.get(i);
77+
params.add(new Parameter(p.type, p.name));
78+
i++;
7679
}
7780
}
7881

0 commit comments

Comments
 (0)