mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-189725 'Smart step into' doesn't work immediately sometimes
This commit is contained in:
@@ -44,6 +44,7 @@ import one.util.streamex.StreamEx;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@@ -423,7 +424,7 @@ public class DebugProcessEvents extends DebugProcessImpl {
|
||||
preprocessEvent(suspendContext, thread);
|
||||
|
||||
//noinspection HardCodedStringLiteral
|
||||
RequestHint hint = (RequestHint)event.request().getProperty("hint");
|
||||
RequestHint hint = getRequestHint(event);
|
||||
|
||||
deleteStepRequests(event.thread());
|
||||
|
||||
@@ -469,6 +470,10 @@ public class DebugProcessEvents extends DebugProcessImpl {
|
||||
}
|
||||
}
|
||||
|
||||
private static RequestHint getRequestHint(Event event) {
|
||||
return (RequestHint)event.request().getProperty("hint");
|
||||
}
|
||||
|
||||
private void processLocatableEvent(final SuspendContextImpl suspendContext, final LocatableEvent event) {
|
||||
ThreadReference thread = event.thread();
|
||||
//LOG.assertTrue(thread.isSuspended());
|
||||
@@ -531,6 +536,24 @@ public class DebugProcessEvents extends DebugProcessImpl {
|
||||
});
|
||||
}
|
||||
|
||||
// special check for smart step into with this breakpoint inside the expressions
|
||||
EventSet eventSet = suspendContext.getEventSet();
|
||||
if (eventSet != null && eventSet.size() > 1) {
|
||||
List<StepEvent> stepEvents = StreamEx.of(eventSet).select(StepEvent.class).toList();
|
||||
if (!stepEvents.isEmpty()) {
|
||||
resumePreferred = resumePreferred ||
|
||||
stepEvents.stream()
|
||||
.map(DebugProcessEvents::getRequestHint)
|
||||
.allMatch(h -> {
|
||||
if (h != null) {
|
||||
Integer depth = h.checkCurrentPosition(suspendContext);
|
||||
return depth != null && depth != RequestHint.STOP;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(!requestHit || resumePreferred) {
|
||||
suspendManager.voteResume(suspendContext);
|
||||
}
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
/*
|
||||
* @author: Eugene Zhuravlev
|
||||
@@ -181,6 +167,21 @@ public class RequestHint {
|
||||
return mySteppedOut;
|
||||
}
|
||||
|
||||
public Integer checkCurrentPosition(SuspendContextImpl context) {
|
||||
if ((myDepth == StepRequest.STEP_OVER || myDepth == StepRequest.STEP_INTO) && myPosition != null) {
|
||||
SourcePosition locationPosition = ContextUtil.getSourcePosition(context);
|
||||
if (locationPosition != null) {
|
||||
return ReadAction.compute(() -> {
|
||||
if (myPosition.getFile().equals(locationPosition.getFile()) && isTheSameFrame(context) && !mySteppedOut) {
|
||||
return isOnTheSameLine(locationPosition) ? myDepth : STOP;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getNextStepDepth(final SuspendContextImpl context) {
|
||||
try {
|
||||
final StackFrameProxyImpl frameProxy = context.getFrameProxy();
|
||||
@@ -196,19 +197,9 @@ public class RequestHint {
|
||||
return myMethodFilter.onReached(context, this);
|
||||
}
|
||||
|
||||
if ((myDepth == StepRequest.STEP_OVER || myDepth == StepRequest.STEP_INTO) && myPosition != null) {
|
||||
SourcePosition locationPosition = ContextUtil.getSourcePosition(context);
|
||||
if (locationPosition != null) {
|
||||
Integer resultDepth = ReadAction.compute(() -> {
|
||||
if (myPosition.getFile().equals(locationPosition.getFile()) && isTheSameFrame(context) && !mySteppedOut) {
|
||||
return isOnTheSameLine(locationPosition) ? myDepth : STOP;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
if (resultDepth != null) {
|
||||
return resultDepth.intValue();
|
||||
}
|
||||
}
|
||||
Integer resultDepth = checkCurrentPosition(context);
|
||||
if (resultDepth != null) {
|
||||
return resultDepth.intValue();
|
||||
}
|
||||
|
||||
// Now check filters
|
||||
|
||||
Reference in New Issue
Block a user