Skip to content

Commit 906c752

Browse files
committed
Rewrote the compiler completion engine to support all target types.
1 parent f78a60b commit 906c752

File tree

3 files changed

+393
-164
lines changed

3 files changed

+393
-164
lines changed

common/src/com/intellij/plugins/haxe/compilation/HaxeCompilerError.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@ public int getColumn() {
6767
return column;
6868
}
6969

70+
public boolean isInformationalMessage() {
71+
return CompilerMessageCategory.INFORMATION.equals(category);
72+
}
73+
74+
public boolean isErrorMessage() {
75+
return CompilerMessageCategory.ERROR.equals(category);
76+
}
77+
78+
public boolean isWarningMessage() {
79+
return CompilerMessageCategory.WARNING.equals(category);
80+
}
81+
7082
@Nullable
7183
public static HaxeCompilerError create(@NotNull String rootPath, final String message) {
7284
return create(rootPath, message, true);
@@ -116,7 +128,7 @@ else if ((m = pBareError.matcher(message)).matches()) {
116128
// match the pattern.
117129
else if ((m = pGenericError.matcher(message)).matches()) {
118130
String error = m.group(1).trim();
119-
if (isInformationalMessage(error)) {
131+
if (matchesInformationalPattern(error)) {
120132
return new HaxeCompilerError(CompilerMessageCategory.INFORMATION,
121133
message.trim(), "", -1, -1);
122134
}
@@ -188,7 +200,7 @@ private static String buildGenericErrorMessage(String error, String reason) {
188200
return msg.toString();
189201
}
190202

191-
private static boolean isInformationalMessage(String message) {
203+
private static boolean matchesInformationalPattern(String message) {
192204
Boolean isStatusMessage = pGeneratingStatusMessage.matcher(message).matches();
193205
Boolean isInfoMessages = mInformationalMessages.contains(message);
194206
Boolean isCompilingStatusMessage = pCompilingStatusMessage.matcher(message).matches();

src/META-INF/plugin.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
<p>Documentation: http://github.com/HaxeFoundation/intellij-haxe/README.md.</p>
3838
<p>Support: http://github.com/HaxeFoundation/intellij-haxe/issues.</p>
3939
<p/>
40+
<p>Unreleased:</p>
41+
<ul>
42+
<li>Reworked code completion using the compiler.</li>
43+
</ul>
4044
<p>0.10.1.1: (community release)</p)
4145
<ul>
4246
<li>Update compatibility for 2016.3.2</li>
@@ -690,11 +694,14 @@
690694
<completion.contributor language="Haxe" implementationClass="com.intellij.plugins.haxe.ide.HaxeClassNameCompletionContributor"/>
691695
<completion.contributor language="Haxe" implementationClass="com.intellij.plugins.haxe.ide.HaxeSmartCompletionContributor"/>
692696
<completion.contributor language="Haxe" implementationClass="com.intellij.plugins.haxe.ide.HaxeMetaTagsCompletionContributor"/>
693-
<completion.contributor language="Haxe" order="LAST" implementationClass="com.intellij.plugins.haxe.ide.HaxeCompilerCompletionContributor"/>
694697
<completion.contributor language="HXML" implementationClass="com.intellij.plugins.haxe.ide.HXMLCompilerArgumentsCompletionContributor"/>
695698
<completion.contributor language="HXML" implementationClass="com.intellij.plugins.haxe.ide.HXMLHaxelibCompletionContributor"/>
696699
<completion.contributor language="HXML" implementationClass="com.intellij.plugins.haxe.ide.HXMLDefineCompletionContributor"/>
697700
<completion.contributor language="XML" implementationClass="com.intellij.plugins.haxe.ide.XmlHaxelibCompletionContributor"/>
701+
<!-- Keep the compiler contributor last because it is slow compared to the internal stuff.
702+
Don't use order="LAST" because that puts it after the default contributor, which puts up the "No Suggestions"
703+
box, and we want compiler error messages to be displayed instead. -->
704+
<completion.contributor language="Haxe" implementationClass="com.intellij.plugins.haxe.ide.HaxeCompilerCompletionContributor"/>
698705

699706
<configurationType implementation="com.intellij.plugins.haxe.runner.HaxeRunConfigurationType"/>
700707

0 commit comments

Comments
 (0)