@Override public boolean process( @NotNull String name, @NotNull GoNamedElement element, @NotNull ExistingImportData importData, @NotNull CompletionResultSet result) { GoTypeSpec spec = ((GoTypeSpec) element); boolean forTypes = myParent instanceof GoTypeReferenceExpression; double priority; if (importData.exists) { priority = forTypes ? GoCompletionUtil.TYPE_PRIORITY : GoCompletionUtil.TYPE_CONVERSION; } else { priority = forTypes ? GoCompletionUtil.NOT_IMPORTED_TYPE_PRIORITY : GoCompletionUtil.NOT_IMPORTED_TYPE_CONVERSION; } String lookupString = replacePackageWithAlias(name, importData.alias); if (forTypes) { result.addElement( GoCompletionUtil.createTypeLookupElement( spec, lookupString, GoAutoImportInsertHandler.SIMPLE_INSERT_HANDLER, importData.importPath, priority)); } else { result.addElement( GoCompletionUtil.createTypeConversionLookupElement( spec, lookupString, GoAutoImportInsertHandler.TYPE_CONVERSION_INSERT_HANDLER, importData.importPath, priority)); } return true; }
@Override public boolean process( @NotNull String name, @NotNull GoNamedElement element, @NotNull ExistingImportData importData, @NotNull CompletionResultSet result) { double priority = importData.exists ? GoCompletionUtil.VAR_PRIORITY : GoCompletionUtil.NOT_IMPORTED_VAR_PRIORITY; result.addElement( GoCompletionUtil.createVariableLikeLookupElement( element, replacePackageWithAlias(name, importData.alias), GoAutoImportInsertHandler.SIMPLE_INSERT_HANDLER, priority)); return true; }
@Override public boolean process( @NotNull String name, @NotNull GoNamedElement element, @NotNull ExistingImportData importData, @NotNull CompletionResultSet result) { GoFunctionDeclaration function = ((GoFunctionDeclaration) element); double priority = importData.exists ? GoCompletionUtil.FUNCTION_PRIORITY : GoCompletionUtil.NOT_IMPORTED_FUNCTION_PRIORITY; result.addElement( GoCompletionUtil.createFunctionOrMethodLookupElement( function, replacePackageWithAlias(name, importData.alias), GoAutoImportInsertHandler.FUNCTION_INSERT_HANDLER, priority)); return true; }