Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ public boolean shouldHighlightErrorElement(final @NotNull PsiErrorElement elemen
if (!(element.getLanguage() == DartLanguage.INSTANCE)) return true;

final VirtualFile file = DartResolveUtil.getRealVirtualFile(element.getContainingFile());
if (file != null && file.isInLocalFileSystem() && ProjectFileIndex.getInstance(element.getProject()).isInContent(file)) {
return false;
}

return true;
return file == null || !file.isInLocalFileSystem() || !ProjectFileIndex.getInstance(element.getProject()).isInContent(file);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public final class DartBraceMatcher implements PairedBraceMatcher {

@Override
public boolean isPairedBracesAllowedBeforeType(@NotNull IElementType lbraceType, @Nullable IElementType contextType) {
return contextType == null || !DartTokenTypesSets.STRINGS.contains(contextType);
return !DartTokenTypesSets.STRINGS.contains(contextType);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,7 @@ private static boolean isApplicableFile(final @NotNull Project project, final @N

final Module module = ModuleUtilCore.findModuleForFile(file, project);
if (module == null) return false;
if (!DartSdkLibUtil.isDartSdkEnabled(module)) return false;

return true;
return DartSdkLibUtil.isDartSdkEnabled(module);
}

private static boolean mayHaveApplicableDartFiles(final @NotNull Project project,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,7 @@ private static boolean hasIgnoreCommentOnPrevLine(@NotNull Document document, in
case '/' -> {
if (prevLine.length() > index + 1 && prevLine.charAt(index + 1) == '/') {
final String comment = prevLine.subSequence(index + 2, prevLine.length()).toString();
if (StringUtil.trimLeading(comment, ' ').startsWith(IGNORE_PREFIX)) {
return true;
}
return StringUtil.trimLeading(comment, ' ').startsWith(IGNORE_PREFIX);
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ protected boolean canUseOffset(@NotNull Document document, int offset, boolean v

if (charAtOffset == '.') {
// Do not split the cascade token, but allow wrapping in front of it.
if (offset > 0 && chars.charAt(offset - 1) == '.') {
return false;
}
return offset <= 0 || chars.charAt(offset - 1) != '.';
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@ public boolean isOpeningQuote(final HighlighterIterator iterator, final int offs

if (type == DartTokenTypes.OPEN_QUOTE) return true;

if (type == DartTokenTypes.RAW_SINGLE_QUOTED_STRING && offset == iterator.getStart() + 1) {
// start of the raw string like r'
return true;
}

return false;
return type == DartTokenTypes.RAW_SINGLE_QUOTED_STRING && offset == iterator.getStart() + 1;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
public final class DartSelectionFilter implements Condition<PsiElement> {
@Override
public boolean value(final @NotNull PsiElement psiElement) {
if (getSiblingSemicolonIfExpression(psiElement) != null) {
return false; // DartWordSelectionHandler will select this expression with the following semicolon
}
return true;
return getSiblingSemicolonIfExpression(psiElement) == null; // DartWordSelectionHandler will select this expression with the following semicolon
}

public static @Nullable PsiElement getSiblingSemicolonIfExpression(final @NotNull PsiElement psiElement) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,7 @@ protected void hyperlinkActivated(final @NotNull HyperlinkEvent e) {
}

public void reset(final @NotNull DartProblemsPresentationHelper presentationHelper) {
if (presentationHelper.getScopedAnalysisMode() == DartProblemsViewSettings.ScopedAnalysisMode.DartPackage) {
packageScopedAnalysisCheckbox.setSelected(true);
}
else {
packageScopedAnalysisCheckbox.setSelected(false);
}
packageScopedAnalysisCheckbox.setSelected(presentationHelper.getScopedAnalysisMode() == DartProblemsViewSettings.ScopedAnalysisMode.DartPackage);
}

public void addListener(final @NotNull ServerSettingsListener serverSettingsListener) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ boolean areFiltersApplied() {
if (mySettings.showErrors != DartProblemsViewSettings.SHOW_ERRORS_DEFAULT) return true;
if (mySettings.showWarnings != DartProblemsViewSettings.SHOW_WARNINGS_DEFAULT) return true;
if (mySettings.showHints != DartProblemsViewSettings.SHOW_HINTS_DEFAULT) return true;
if (mySettings.fileFilterMode != DartProblemsViewSettings.FILE_FILTER_MODE_DEFAULT) return true;

return false;
return mySettings.fileFilterMode != DartProblemsViewSettings.FILE_FILTER_MODE_DEFAULT;
}

boolean setCurrentFile(@Nullable VirtualFile file) {
Expand Down Expand Up @@ -160,9 +158,7 @@ boolean shouldShowProblem(@NotNull DartProblem problem) {

if (getFileFilterMode() == DartProblemsViewSettings.FileFilterMode.ContentRoot) {
ensureContentRootUpToDate();
if (myCurrentContentRoot == null || !myCurrentContentRoot.equals(problem.getContentRoot())) {
return false;
}
return myCurrentContentRoot != null && myCurrentContentRoot.equals(problem.getContentRoot());
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ private static boolean isApplicable(final @NotNull PsiFile psiFile) {
final Module module = ModuleUtilCore.findModuleForPsiElement(psiFile);
if (module == null || !DartSdkLibUtil.isDartSdkEnabled(module)) return false;
if (!ProjectFileIndex.getInstance(project).isInContent(vFile)) return false;
if (!DartAnalysisServerService.getInstance(project).serverReadyForRequest()) return false;

return true;
return DartAnalysisServerService.getInstance(project).serverReadyForRequest();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1027,9 +1027,7 @@ private static boolean cascadesAreSameMethod(ASTNode child1, ASTNode child2) {
String name1 = getImmediateCallName(call1);
if (name1 != null) {
String name2 = getImmediateCallName(call2);
if (name1.equals(name2)) {
return true;
}
return name1.equals(name2);
}
}
}
Expand Down Expand Up @@ -1150,9 +1148,7 @@ private static boolean hasEmptyBlock(ASTNode node) {
next = FormatterUtil.getPreviousNonWhitespaceSibling(next);
if (next != null && DartIndentProcessor.EXPRESSIONS.contains(next.getElementType())) {
ASTNode arrow = FormatterUtil.getPreviousNonWhitespaceSibling(next);
if (arrow != null && arrow.getElementType() == EXPRESSION_BODY_DEF) {
return true;
}
return arrow != null && arrow.getElementType() == EXPRESSION_BODY_DEF;
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ public boolean equals(Object o) {
DartComponentInfo info = (DartComponentInfo)o;

if (myComponentType != info.myComponentType) return false;
if (!Objects.equals(myLibraryName, info.myLibraryName)) return false;

return true;
return Objects.equals(myLibraryName, info.myLibraryName);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ public boolean equals(Object o) {
if (!myUri.equals(info.myUri)) return false;
if (!Objects.equals(myImportPrefix, info.myImportPrefix)) return false;
if (!myShowComponents.equals(info.myShowComponents)) return false;
if (!myHideComponents.equals(info.myHideComponents)) return false;

return true;
return myHideComponents.equals(info.myHideComponents);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ public boolean equals(Object o) {

DartOptionalParameterDescription that = (DartOptionalParameterDescription)o;

if (myText.equals(that.myText)) return false;

return true;
return !myText.equals(that.myText);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,7 @@ private static boolean crossesHeaderBoundary(PsiElement base, PsiElement sibling
// Having two library statements is not legal but could happen while editing.
if (baseType instanceof DartLibraryStatement && sibType instanceof DartLibraryStatement) return false;
// Having mixed library and import is also possible but not allowed in this context.
if (baseType instanceof DartLibraryStatement || sibType instanceof DartLibraryStatement) return true;
return false; // both uri-based -- allow moving part & import
return baseType instanceof DartLibraryStatement || sibType instanceof DartLibraryStatement;// both uri-based -- allow moving part & import
}

private static PsiElement getHeaderParent(PsiElement element) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,7 @@ private static boolean statementCanBePlacedAlong(final PsiElement element) {
}
if (parent instanceof DartForStatement) {
PsiElement body = DartPsiImplUtil.getForBody((DartForStatement)parent);
if (isSameStatement(element, body)) {
return true;
}
return isSameStatement(element, body);
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ protected boolean isFilteredOut(final String name) {

private static boolean isFilteredOut(final @Nullable String name, final @NotNull DartShowHideInfo showHideInfo) {
if (showHideInfo.getHideComponents().contains(name)) return true;
if (!showHideInfo.getShowComponents().isEmpty() && !showHideInfo.getShowComponents().contains(name)) return true;
return false;
return !showHideInfo.getShowComponents().isEmpty() && !showHideInfo.getShowComponents().contains(name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public boolean isModified() {
}
}
else {
if (myDartSupportEnabledInitial != myEnableDartSupportCheckBox.isSelected()) return true;
return myDartSupportEnabledInitial != myEnableDartSupportCheckBox.isSelected();
}

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void visitElement(final @NotNull PsiElement element) {
}

final DartStatements statements = PsiTreeUtil.getParentOfType(element1, DartStatements.class);
if (statements == null || element2 == null || !PsiTreeUtil.isAncestor(statements, element2, true)) {
if (element2 == null || !PsiTreeUtil.isAncestor(statements, element2, true)) {
return PsiElement.EMPTY_ARRAY;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,7 @@ private static boolean processTopLevelDeclarationsImpl(final @NotNull PsiElement
processTopLevelDeclarationsImpl(context, processor, dartCoreLib, filesOfInterest, alreadyProcessed, false);
processor.importedFileProcessingFinished(dartCoreLib);

if (!continueProcessing) {
return false;
}
return continueProcessing;
}
}

Expand Down
Loading