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 @@ -1220,12 +1220,9 @@ public boolean edit_isPostfixCompletionApplicable(VirtualFile file, int _offset,
final Ref<Boolean> resultRef = Ref.create(false);
final CountDownLatch latch = new CountDownLatch(1);
final int offset = getOriginalOffset(file, _offset);
server.edit_isPostfixCompletionApplicable(fileUri, key, offset, new IsPostfixCompletionApplicableConsumer() {
@Override
public void isPostfixCompletionApplicable(Boolean value) {
resultRef.set(value);
latch.countDown();
}
server.edit_isPostfixCompletionApplicable(fileUri, key, offset, value -> {
resultRef.set(value);
latch.countDown();
});

awaitForLatchCheckingCanceled(server, latch, POSTFIX_COMPLETION_TIMEOUT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,7 @@ void textDocumentContentDidChange(@NotNull String fileUri) {
file.setWritable(false);

VirtualFile finalFile = file;
ApplicationManager.getApplication().invokeLater(() -> {
FileDocumentManager.getInstance().reloadFiles(finalFile);
}, ModalityState.nonModal(), myService.getDisposedCondition());
ApplicationManager.getApplication().invokeLater(() -> FileDocumentManager.getInstance().reloadFiles(finalFile), ModalityState.nonModal(), myService.getDisposedCondition());
});
}

Expand Down Expand Up @@ -405,9 +403,7 @@ private void forceFileAnnotation(final @Nullable VirtualFile file, final boolean
// but it will cache RemoteAnalysisServerImpl$ServerResponseReaderThread in FileStatusMap.threads and as a result,
// DartAnalysisServerService.myProject will be leaked in tests
ApplicationManager.getApplication()
.invokeLater(() -> {
DaemonCodeAnalyzer.getInstance(project).restart();
},
.invokeLater(() -> DaemonCodeAnalyzer.getInstance(project).restart(),
ModalityState.nonModal(),
myService.getDisposedCondition());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void onServerStarted() {
}

void scheduleDartRootsUpdate(@Nullable Runnable onSuccess) {
ReadAction.nonBlocking(() -> calcIncludedAndExcludedDartRootPaths())
ReadAction.nonBlocking(this::calcIncludedAndExcludedDartRootPaths)
.coalesceBy(this)
.expireWith(DartAnalysisServerService.getInstance(myProject))
.finishOnUiThread(ModalityState.nonModal(), includedAndExcludedRootPaths -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ public void performCopy(@NotNull DataContext dataContext) {
public void uiDataSnapshot(@NotNull DataSink sink) {
super.uiDataSnapshot(sink);
sink.set(PlatformDataKeys.COPY_PROVIDER, this);
sink.lazy(CommonDataKeys.NAVIGATABLE, () -> createNavigatable());
sink.lazy(CommonDataKeys.NAVIGATABLE, this::createNavigatable);
}

private @Nullable Navigatable createNavigatable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ public boolean equals(Object object) {

@Override
public void uiDataSnapshot(@NotNull DataSink sink) {
sink.lazy(CommonDataKeys.PSI_ELEMENT, () -> {
return getNameElement();
});
sink.lazy(CommonDataKeys.PSI_ELEMENT, this::getNameElement);
sink.lazy(UsageView.USAGE_INFO_KEY, () -> {
final DartComponentName nameElement = getNameElement();
return nameElement != null ? new UsageInfo(nameElement) : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,9 @@
// See https://youtrack.jetbrains.com/issue/WEB-17629.

public final class DartVmServiceValue extends XNamedValue {
private static final LayeredIcon FINAL_FIELD_ICON = LayeredIcon.layeredIcon(() -> {
return new Icon[]{AllIcons.Nodes.Field, IconManager.getInstance().getPlatformIcon(PlatformIcons.FinalMark)};
});
private static final LayeredIcon STATIC_FIELD_ICON = LayeredIcon.layeredIcon(() -> {
return new Icon[]{AllIcons.Nodes.Field, IconManager.getInstance().getPlatformIcon(PlatformIcons.StaticMark)};
});
private static final LayeredIcon STATIC_FINAL_FIELD_ICON = LayeredIcon.layeredIcon(() -> {
return new Icon[]{AllIcons.Nodes.Field, IconManager.getInstance().getPlatformIcon(PlatformIcons.StaticMark), IconManager.getInstance().getPlatformIcon(PlatformIcons.FinalMark)};
});
private static final LayeredIcon FINAL_FIELD_ICON = LayeredIcon.layeredIcon(() -> new Icon[]{AllIcons.Nodes.Field, IconManager.getInstance().getPlatformIcon(PlatformIcons.FinalMark)});
private static final LayeredIcon STATIC_FIELD_ICON = LayeredIcon.layeredIcon(() -> new Icon[]{AllIcons.Nodes.Field, IconManager.getInstance().getPlatformIcon(PlatformIcons.StaticMark)});
private static final LayeredIcon STATIC_FINAL_FIELD_ICON = LayeredIcon.layeredIcon(() -> new Icon[]{AllIcons.Nodes.Field, IconManager.getInstance().getPlatformIcon(PlatformIcons.StaticMark), IconManager.getInstance().getPlatformIcon(PlatformIcons.FinalMark)});

private final @NotNull DartVmServiceDebugProcess myDebugProcess;
private final @NotNull String myIsolateId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,7 @@ private static PsiElement doResolveTypeReference(final DartType dartType) {
// find type parameter
if (result.isEmpty()) {
PsiTreeUtil.treeWalkUp(dartResolveProcessor, dartType, null, ResolveState.initial());
for (Iterator<DartComponentName> iterator = result.iterator(); iterator.hasNext(); ) {
if (!(iterator.next().getParent() instanceof DartTypeParameter)) {
iterator.remove();
}
}
result.removeIf(dartComponentName -> !(dartComponentName.getParent() instanceof DartTypeParameter));
}

// global
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void visitReferenceExpression(@NotNull DartReferenceExpression reference)
List<PsiElement> results = new ArrayList<>();
DartCallHierarchyTreeStructure.collectDeclarations(reference.resolve(), results);
if (!results.isEmpty()) {
result[0] = results.get(0);
result[0] = results.getFirst();
throw new ExitVisitor();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,14 +269,14 @@ public void testNavigationTargetOffsetUpdated() {
TextRange.create(15, 16),
TextRange.create(19, 20)};
checkRegions(regions, ranges);
assertEquals(4, regions.get(4).getTargets().get(0).getOffset(getProject(), file));
assertEquals(4, regions.get(4).getTargets().getFirst().getOffset(getProject(), file));

getEditor().getCaretModel().moveToOffset(0);
myFixture.type("foo \b");
// Disable for pre-3.7.0 Dart SDK versions:
if(StringUtil.compareVersionNumbers(service.getSdkVersion(), "3.7.0") >= 0) {
checkRegions(regions, ContainerUtil.map2Array(ranges, TextRange.class, range -> range.shiftRight(3)));
assertEquals(4 + 3, regions.get(4).getTargets().get(0).getOffset(getProject(), file));
assertEquals(4 + 3, regions.get(4).getTargets().getFirst().getOffset(getProject(), file));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void f() {
<selection><caret>var x = 3;</selection>
}
""");
final List<String> intentions = ContainerUtil.map(myFixture.getAvailableIntentions(), intention -> intention.getText());
final List<String> intentions = ContainerUtil.map(myFixture.getAvailableIntentions(), IntentionAction::getText);
assertOrderedEquals(intentions,
"Surround with block",
"Edit intention settings",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ List<caret> bar(int i, bool bool, String s) {}

public void testQuickFixOrder() {
myFixture.configureByText("foo.dart", "<caret>ServerSocket f;\nclass ServerSockets{}");
final List<String> intentions = ContainerUtil.map(myFixture.getAvailableIntentions(), intention -> intention.getText());
final List<String> intentions = ContainerUtil.map(myFixture.getAvailableIntentions(), IntentionAction::getText);
assertOrderedEquals(intentions,
"Import library 'dart:io'",
"Import library 'dart:io' with 'show'",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class DartStyleLenientTest extends DartStyleTest {
*/
@Override
protected void runTestInDirectory(String dirName) throws Exception {
runTestInDirectory(dirName, new HashSet<String>(KNOWN_TO_FAIL));
runTestInDirectory(dirName, new HashSet<>(KNOWN_TO_FAIL));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private void doTest(@NotNull final String locationHint, @NotNull final String fi
final List<Location> locations = DartTestLocationProvider.INSTANCE.getLocationForTest(file, locationHint);
assertEquals(1, locations.size());

final Location location = locations.get(0);
final Location location = locations.getFirst();
final PsiElement element = location.getPsiElement();

final DartId foundId = PsiTreeUtil.findChildOfType(element, DartId.class);
Expand Down
Loading