Skip to content

Commit 33e47e8

Browse files
authored
Merge pull request #61 from cedricziel/complete-tca-types
Add autocompletion for TCA column types
2 parents 80406bd + 13a6fbc commit 33e47e8

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/main/java/com/cedricziel/idea/typo3/tca/codeInsight/TCACompletionContributor.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,32 @@ public String getLookupString() {
5858
}
5959
}
6060
);
61+
62+
/*
63+
* Complete 'type' fields in TCA
64+
*/
65+
extend(
66+
CompletionType.BASIC,
67+
PhpElementsUtil.isStringArrayValue(),
68+
new CompletionProvider<CompletionParameters>() {
69+
@Override
70+
protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) {
71+
PsiElement element = parameters.getPosition();
72+
73+
String arrayIndex = extractArrayIndexFromValue(element);
74+
if ("type".equals(arrayIndex)) {
75+
for(String name: TCAUtil.getAvailableColumnTypes(element)) {
76+
result.addElement(new LookupElement() {
77+
@NotNull
78+
@Override
79+
public String getLookupString() {
80+
return name;
81+
}
82+
});
83+
}
84+
}
85+
}
86+
}
87+
);
6188
}
6289
}

src/main/resources/META-INF/plugin.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
<h3>TCA</h3>
7272
<ul>
7373
<li>completion for built-in TCA render types</li>
74+
<li>completion for built-in TCA column types</li>
7475
</ul>
7576
7677
<h3>Code inspections</h3>
@@ -111,6 +112,7 @@ It is a great inspiration for possible solutions and parts of the code.</p>
111112
<ul>
112113
<li>Autocompletion for TCA renderTypes</li>
113114
<li>Inspection for valid renderTypes</li>
115+
<li>Autocompletion for TCA column types</li>
114116
</ul>
115117
116118
<h2>0.2.9</h2>

0 commit comments

Comments
 (0)