Refine search
public static boolean processChildren(@NotNull PsiElement element, @NotNull PsiScopeProcessor processor, @NotNull ResolveState substitutor, @Nullable PsiElement lastParent, @NotNull PsiElement place) { PsiElement run = lastParent == null ? element.getLastChild() : lastParent.getPrevSibling(); while (run != null) { if (run instanceof GoCompositeElement && !run.processDeclarations(processor, substitutor, null, place)) return false; run = run.getPrevSibling(); } return true; }
private static void error(@NotNull String title, @NotNull Project project, @Nullable Exception ex) { String message = ex == null ? "" : ExceptionUtil.getUserStackTrace(ex, LOG); NotificationType type = NotificationType.ERROR; Notifications.Bus.notify(GoConstants.GO_EXECUTION_NOTIFICATION_GROUP.createNotification(title, message, type, null), project); }
@Nullable private static GoCompositeLit getStructLiteralByReference(@NotNull GoReferenceExpression fieldReferenceExpression, @NotNull GoAssignmentStatement assignment) { GoStatement previousStatement = PsiTreeUtil.getPrevSiblingOfType(assignment, GoStatement.class); if (previousStatement instanceof GoSimpleStatement) { return getStructLiteral(fieldReferenceExpression, (GoSimpleStatement)previousStatement); } if (previousStatement instanceof GoAssignmentStatement) { return getStructLiteral(fieldReferenceExpression, (GoAssignmentStatement)previousStatement); } return null; }
private boolean processTypeRef(@Nullable GoType type, @NotNull GoScopeProcessor processor, @NotNull ResolveState state) { if (type == null) { return true; } if (builtin(type)) { // do not process builtin types like 'int int' or 'string string' return true; } return processInTypeRef(type.getTypeReferenceExpression(), processor, state); }
@Nullable private static String getStatementsCoverageString(@NotNull FileCoverageInfo info) { double percent = calcPercent(info.coveredLineCount, info.totalLineCount); return info.totalLineCount > 0 ? new DecimalFormat("##.#" + STATEMENTS_SUFFIX, DecimalFormatSymbols.getInstance(Locale.US)) .format(percent) : null; }
@Nullable private static String getFilesCoverageString(@NotNull DirCoverageInfo info) { double percent = calcPercent(info.coveredFilesCount, info.totalFilesCount); return info.totalFilesCount > 0 ? new DecimalFormat("##.#" + FILES_SUFFIX, DecimalFormatSymbols.getInstance(Locale.US)).format(percent) : null; }
@NotNull @Override protected GoExecutor createExecutor(@NotNull Project project, @Nullable Module module, @NotNull String title, @NotNull String filePath) { VirtualFile executable = getExecutable(project, module); assert executable != null; return GoExecutor.in(project, module).withExePath(executable.getPath()).withParameters("-w", filePath).showOutputOnError(); } }