File mainFile = new File(path);
Map<String, SortedSet<String>> userImports = null;
for (GHCMessage ghcMessage : ghcMessages) {
if (FileUtil.filesEqual(new File(ghcMessage.getFileName()), mainFile)) {
LineColRange lcRange = ghcMessage.getRange();
TextRange range = lcRange.getRange(psiFile);
String message = ghcMessage.getErrorMessage();
CompilerMessageCategory category = ghcMessage.getCategory();
Annotation out = null;
switch (category) {
case ERROR:
out = annotationHolder.createErrorAnnotation(range, message);
break;
case WARNING:
out = annotationHolder.createWarningAnnotation(range, message);
break;
case INFORMATION:
out = annotationHolder.createInfoAnnotation(range, message);
break;
case STATISTICS:
break;
}
if (out != null) {
if (message.startsWith("Not in scope")) {
Module module = DeclarationPosition.getDeclModule(psiFile);
String symbol = psiFile.getText().substring(range.getStartOffset(), range.getEndOffset());
int dotIndex = symbol.lastIndexOf('.');
String unqualifiedSymbol = dotIndex >= 0 ? symbol.substring(dotIndex + 1) : symbol;
if (userImports == null) {
userImports = listUserImports(module, Paths.get(path));
}