@Test public void testSkipNonArrayAdditionalImportPaths() { assertEmpty(parse().getImportPaths()); }
@NotNull @Override public CompassConfig parse(@NotNull final VirtualFile file, @NotNull final String importPathsRoot, @Nullable final PsiManager psiManager) { return ReadAction.compute(() -> { PsiFile psiFile = psiManager != null ? psiManager.findFile(file) : null; if (psiFile != null) { final List<String> importPaths = new ArrayList<>(); final List<String> additionalImportPaths = new ArrayList<>(); final RubyPsiInterpreter interpreter = new RubyPsiInterpreter(true); interpreter.interpret(psiFile, arguments -> { final String cmdName = arguments.getCommand(); if (ADD_IMPORT_PATH_CALL.equals(cmdName)) { final RPsiElement firstArgument = ContainerUtil.getFirstItem(arguments.getArguments()); if (firstArgument instanceof RStringLiteral) { importPaths.add(normalizePath(((RStringLiteral)firstArgument).getContent(), importPathsRoot)); } } else if (ADDITIONAL_IMPORT_PATHS_ASSIGNMENT.equalsIgnoreCase(cmdName)) { final RAssignmentExpression assignment = RAssignmentExpressionNavigator.getAssignmentByLeftPart(arguments.getCallElement()); if (assignment != null) { additionalImportPaths.clear(); final RPsiElement value = assignment.getValue(); if (value instanceof RArray) { for (RPsiElement element : ((RArray)value).getElements()) { if (element instanceof RStringLiteral) { additionalImportPaths.add(normalizePath(((RStringLiteral)element).getContent(), importPathsRoot)); } } } } } }); importPaths.addAll(additionalImportPaths); return new CompassConfig(importPaths); } return CompassConfig.EMPTY_COMPASS_CONFIG; }); }
CompassConfigParserRM extends CompassConfigParser { @NotNull @Override public CompassConfig parse(@NotNull final VirtualFile file, @NotNull final String importPathsRoot, @Nullable final PsiManager psiManager) { return ReadAction.compute(() -> { PsiFile psiFile = psiManager != null ? psiManager.findFile(file) : null; if (psiFile != null) { final List<String> importPaths = new ArrayList<>(); final List<String> additionalImportPaths = new ArrayList<>(); final RubyPsiInterpreter interpreter = new RubyPsiInterpreter(true); interpreter.interpret(psiFile, arguments -> { final String cmdName = arguments.getCommand(); if (ADD_IMPORT_PATH_CALL.equals(cmdName)) { final RPsiElement firstArgument = ContainerUtil.getFirstItem(arguments.getArguments()); if (firstArgument instanceof RStringLiteral) { importPaths.add(normalizePath(((RStringLiteral)firstArgument).getContent(), importPathsRoot)); } } else if (ADDITIONAL_IMPORT_PATHS_ASSIGNMENT.equalsIgnoreCase(cmdName)) { final RAssignmentExpression assignment = RAssignmentExpressionNavigator.getAssignmentByLeftPart(arguments.getCallElement()); if (assignment != null) { additionalImportPaths.clear(); final RPsiElement value = assignment.getValue(); if (value instanceof RArray) { for (RPsiElement element : ((RArray)value).getElements()) { if (element instanceof RStringLiteral) { additionalImportPaths.add(normalizePath(((RStringLiteral)element).getContent(), importPathsRoot)); } } } } } }); importPaths.addAll(additionalImportPaths); return new CompassConfig(importPaths); } return CompassConfig.EMPTY_COMPASS_CONFIG; }); } }
CompassConfigParserRM extends CompassConfigParser { @NotNull @Override public CompassConfig parse(@NotNull final VirtualFile file, @NotNull final String importPathsRoot, @Nullable final PsiManager psiManager) { return ReadAction.compute(() -> { PsiFile psiFile = psiManager != null ? psiManager.findFile(file) : null; if (psiFile != null) { final List<String> importPaths = new ArrayList<>(); final List<String> additionalImportPaths = new ArrayList<>(); final RubyPsiInterpreter interpreter = new RubyPsiInterpreter(true); interpreter.interpret(psiFile, arguments -> { final String cmdName = arguments.getCommand(); if (ADD_IMPORT_PATH_CALL.equals(cmdName)) { final RPsiElement firstArgument = ContainerUtil.getFirstItem(arguments.getArguments()); if (firstArgument instanceof RStringLiteral) { importPaths.add(normalizePath(((RStringLiteral)firstArgument).getContent(), importPathsRoot)); } } else if (ADDITIONAL_IMPORT_PATHS_ASSIGNMENT.equalsIgnoreCase(cmdName)) { final RAssignmentExpression assignment = RAssignmentExpressionNavigator.getAssignmentByLeftPart(arguments.getCallElement()); if (assignment != null) { additionalImportPaths.clear(); final RPsiElement value = assignment.getValue(); if (value instanceof RArray) { for (RPsiElement element : ((RArray)value).getElements()) { if (element instanceof RStringLiteral) { additionalImportPaths.add(normalizePath(((RStringLiteral)element).getContent(), importPathsRoot)); } } } } } }); importPaths.addAll(additionalImportPaths); return new CompassConfig(importPaths); } return CompassConfig.EMPTY_COMPASS_CONFIG; }); }  }
CompassConfigParserRM extends CompassConfigParser { @NotNull @Override public CompassConfig parse(@NotNull final VirtualFile file, @NotNull final String importPathsRoot, @Nullable final PsiManager psiManager) { return ReadAction.compute(() -> { PsiFile psiFile = psiManager != null ? psiManager.findFile(file) : null; if (psiFile != null) { final List<String> importPaths = new ArrayList<>(); final List<String> additionalImportPaths = new ArrayList<>(); final RubyPsiInterpreter interpreter = new RubyPsiInterpreter(true); interpreter.interpret(psiFile, arguments -> { final String cmdName = arguments.getCommand(); if (ADD_IMPORT_PATH_CALL.equals(cmdName)) { final RPsiElement firstArgument = ContainerUtil.getFirstItem(arguments.getArguments()); if (firstArgument instanceof RStringLiteral) { importPaths.add(normalizePath(((RStringLiteral)firstArgument).getContent(), importPathsRoot)); } } else if (ADDITIONAL_IMPORT_PATHS_ASSIGNMENT.equalsIgnoreCase(cmdName)) { final RAssignmentExpression assignment = RAssignmentExpressionNavigator.getAssignmentByLeftPart(arguments.getCallElement()); if (assignment != null) { additionalImportPaths.clear(); final RPsiElement value = assignment.getValue(); if (value instanceof RArray) { for (RPsiElement element : ((RArray)value).getElements()) { if (element instanceof RStringLiteral) { additionalImportPaths.add(normalizePath(((RStringLiteral)element).getContent(), importPathsRoot)); } } } } } }); importPaths.addAll(additionalImportPaths); return new CompassConfig(importPaths); } return CompassConfig.EMPTY_COMPASS_CONFIG; }); }  @NotNull @Override CompassConfig parse(@NotNull final VirtualFile file,
                             @NotNull final String importPathsRoot,
                             @Nullable final PsiManager psiManager); }
CompassConfigParserRM extends CompassConfigParser { @NotNull @Override public CompassConfig parse(@NotNull final VirtualFile file, @NotNull final String importPathsRoot, @Nullable final PsiManager psiManager) { return ReadAction.compute(() -> { PsiFile psiFile = psiManager != null ? psiManager.findFile(file) : null; if (psiFile != null) { final List<String> importPaths = new ArrayList<>(); final List<String> additionalImportPaths = new ArrayList<>(); final RubyPsiInterpreter interpreter = new RubyPsiInterpreter(true); interpreter.interpret(psiFile, arguments -> { final String cmdName = arguments.getCommand(); if (ADD_IMPORT_PATH_CALL.equals(cmdName)) { final RPsiElement firstArgument = ContainerUtil.getFirstItem(arguments.getArguments()); if (firstArgument instanceof RStringLiteral) { importPaths.add(normalizePath(((RStringLiteral)firstArgument).getContent(), importPathsRoot)); } } else if (ADDITIONAL_IMPORT_PATHS_ASSIGNMENT.equalsIgnoreCase(cmdName)) { final RAssignmentExpression assignment = RAssignmentExpressionNavigator.getAssignmentByLeftPart(arguments.getCallElement()); if (assignment != null) { additionalImportPaths.clear(); final RPsiElement value = assignment.getValue(); if (value instanceof RArray) { for (RPsiElement element : ((RArray)value).getElements()) { if (element instanceof RStringLiteral) { additionalImportPaths.add(normalizePath(((RStringLiteral)element).getContent(), importPathsRoot)); } } } } } }); importPaths.addAll(additionalImportPaths); return new CompassConfig(importPaths); } return CompassConfig.EMPTY_COMPASS_CONFIG; }); }  @NotNull @Override CompassConfig parse(@NotNull final VirtualFile file,
                             @NotNull final String importPathsRoot,
                             @Nullable final PsiManager psiManager);  }