mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-207762 rename time -> invocationCount
GitOrigin-RevId: a87ed092cf0fa916b3f435319c9a3f72d91d052a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2e296ab24a
commit
801e5dfa34
+13
-13
@@ -163,16 +163,16 @@ public class CodeCompletionHandlerBase {
|
||||
invokeCompletion(project, editor, 1);
|
||||
}
|
||||
|
||||
public final void invokeCompletion(@NotNull Project project, @NotNull Editor editor, int time) {
|
||||
invokeCompletion(project, editor, time, false);
|
||||
public final void invokeCompletion(@NotNull Project project, @NotNull Editor editor, int invocationCount) {
|
||||
invokeCompletion(project, editor, invocationCount, false);
|
||||
}
|
||||
|
||||
public final void invokeCompletion(@NotNull Project project, @NotNull Editor editor, int time, boolean hasModifiers) {
|
||||
public final void invokeCompletion(@NotNull Project project, @NotNull Editor editor, int invocationCount, boolean hasModifiers) {
|
||||
clearCaretMarkers(editor);
|
||||
invokeCompletionWithTracing(project, editor, time, hasModifiers, editor.getCaretModel().getPrimaryCaret());
|
||||
invokeCompletionWithTracing(project, editor, invocationCount, hasModifiers, editor.getCaretModel().getPrimaryCaret());
|
||||
}
|
||||
|
||||
private void invokeCompletion(@NotNull Project project, @NotNull Editor editor, int time, boolean hasModifiers, @NotNull Caret caret) {
|
||||
private void invokeCompletion(@NotNull Project project, @NotNull Editor editor, int invocationCount, boolean hasModifiers, @NotNull Caret caret) {
|
||||
markCaretAsProcessed(caret);
|
||||
|
||||
if (invokedExplicitly) {
|
||||
@@ -196,17 +196,17 @@ public class CodeCompletionHandlerBase {
|
||||
CompletionPhase phase = CompletionServiceImpl.getCompletionPhase();
|
||||
boolean repeated = phase.indicator != null && phase.indicator.isRepeatedInvocation(completionType, editor);
|
||||
|
||||
int newTime = phase.newCompletionStarted(time, repeated);
|
||||
int newInvocationCount = phase.newCompletionStarted(invocationCount, repeated);
|
||||
if (invokedExplicitly) {
|
||||
time = newTime;
|
||||
invocationCount = newInvocationCount;
|
||||
}
|
||||
int invocationCount = time;
|
||||
int effectiveInvocationCount = invocationCount;
|
||||
if (CompletionServiceImpl.isPhase(CompletionPhase.InsertedSingleItem.class)) {
|
||||
CompletionServiceImpl.setCompletionPhase(CompletionPhase.NoCompletion);
|
||||
}
|
||||
CompletionServiceImpl.assertPhase(CompletionPhase.NoCompletion.getClass(), CompletionPhase.CommittingDocuments.class);
|
||||
|
||||
if (invocationCount > 1 && completionType == CompletionType.BASIC) {
|
||||
if (effectiveInvocationCount > 1 && completionType == CompletionType.BASIC) {
|
||||
FeatureUsageTracker.getInstance().triggerFeatureUsed(CodeCompletionFeatures.SECOND_BASIC_COMPLETION);
|
||||
}
|
||||
|
||||
@@ -214,13 +214,13 @@ public class CodeCompletionHandlerBase {
|
||||
Runnable initCmd = () -> {
|
||||
WriteAction.run(() -> EditorUtil.fillVirtualSpaceUntilCaret(editor));
|
||||
CompletionInitializationContextImpl context = withTimeout(calcSyncTimeOut(startingTime), () -> {
|
||||
return CompletionInitializationUtil.createCompletionInitializationContext(project, editor, caret, invocationCount, completionType);
|
||||
return CompletionInitializationUtil.createCompletionInitializationContext(project, editor, caret, effectiveInvocationCount, completionType);
|
||||
});
|
||||
|
||||
boolean hasValidContext = context != null;
|
||||
if (!hasValidContext) {
|
||||
PsiFile psiFile = PsiUtilBase.getPsiFileInEditor(caret, project);
|
||||
context = new CompletionInitializationContextImpl(editor, caret, psiFile, completionType, invocationCount);
|
||||
context = new CompletionInitializationContextImpl(editor, caret, psiFile, completionType, effectiveInvocationCount);
|
||||
}
|
||||
|
||||
doComplete(context, hasModifiers, hasValidContext, startingTime);
|
||||
@@ -246,7 +246,7 @@ public class CodeCompletionHandlerBase {
|
||||
|
||||
private void invokeCompletionWithTracing(@NotNull Project project,
|
||||
@NotNull Editor editor,
|
||||
int time,
|
||||
int invocationCount,
|
||||
boolean hasModifiers,
|
||||
@NotNull Caret caret) {
|
||||
TraceKt.use(
|
||||
@@ -254,7 +254,7 @@ public class CodeCompletionHandlerBase {
|
||||
.setAttribute("project", project.getName())
|
||||
.setAttribute("caretOffset", caret.hasSelection() ? caret.getSelectionStart() : caret.getOffset()),
|
||||
span -> {
|
||||
invokeCompletion(project, editor, time, hasModifiers, caret);
|
||||
invokeCompletion(project, editor, invocationCount, hasModifiers, caret);
|
||||
return null;
|
||||
}
|
||||
);
|
||||
|
||||
@@ -76,7 +76,7 @@ sealed class CompletionPhase @ApiStatus.Internal constructor(
|
||||
val indicator: CompletionProgressIndicator?
|
||||
) : Disposable {
|
||||
|
||||
abstract fun newCompletionStarted(time: Int, repeated: Boolean): Int
|
||||
abstract fun newCompletionStarted(invocationCount: Int, repeated: Boolean): Int
|
||||
|
||||
override fun dispose() {}
|
||||
|
||||
@@ -158,8 +158,8 @@ sealed class CompletionPhase @ApiStatus.Internal constructor(
|
||||
myState = Success
|
||||
}
|
||||
|
||||
override fun newCompletionStarted(time: Int, repeated: Boolean): Int {
|
||||
return time
|
||||
override fun newCompletionStarted(invocationCount: Int, repeated: Boolean): Int {
|
||||
return invocationCount
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
@@ -313,10 +313,10 @@ sealed class CompletionPhase @ApiStatus.Internal constructor(
|
||||
LOG.trace { "Starting completion phase :: completionEditor=$completionEditor" }
|
||||
|
||||
phase.requestCompleted()
|
||||
val time = phase.indicator?.invocationCount ?: 0
|
||||
|
||||
val invocationCount = phase.indicator?.invocationCount ?: 0
|
||||
val handler = CodeCompletionHandlerBase.createHandler(completionType, false, autopopup, false)
|
||||
handler.invokeCompletion(project, completionEditor, time, false)
|
||||
handler.invokeCompletion(project, completionEditor, invocationCount, false)
|
||||
}
|
||||
|
||||
@RequiresEdt
|
||||
@@ -386,10 +386,10 @@ sealed class CompletionPhase @ApiStatus.Internal constructor(
|
||||
|
||||
/** see doc of [CompletionPhase] */
|
||||
class Synchronous internal constructor(indicator: CompletionProgressIndicator) : CompletionPhase(indicator) {
|
||||
override fun newCompletionStarted(time: Int, repeated: Boolean): Int {
|
||||
override fun newCompletionStarted(invocationCount: Int, repeated: Boolean): Int {
|
||||
assertPhase(NoCompletion.javaClass) // will fail and log valuable info
|
||||
CompletionServiceImpl.setCompletionPhase(NoCompletion)
|
||||
return time
|
||||
return invocationCount
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,17 +448,17 @@ sealed class CompletionPhase @ApiStatus.Internal constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun newCompletionStarted(time: Int, repeated: Boolean): Int {
|
||||
override fun newCompletionStarted(invocationCount: Int, repeated: Boolean): Int {
|
||||
indicator!!.closeAndFinish(false)
|
||||
return indicator.nextInvocationCount(time, repeated)
|
||||
return indicator.nextInvocationCount(invocationCount, repeated)
|
||||
}
|
||||
}
|
||||
|
||||
/** see doc of [CompletionPhase] */
|
||||
class ItemsCalculated internal constructor(indicator: CompletionProgressIndicator) : CompletionPhase(indicator) {
|
||||
override fun newCompletionStarted(time: Int, repeated: Boolean): Int {
|
||||
override fun newCompletionStarted(invocationCount: Int, repeated: Boolean): Int {
|
||||
requireNotNull(indicator) { "`ItemsCalculated#indicator` is not-null as its constructor accepts not-null `indicator`" }.closeAndFinish(false)
|
||||
return indicator.nextInvocationCount(time, repeated)
|
||||
return indicator.nextInvocationCount(invocationCount, repeated)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -492,12 +492,12 @@ sealed class CompletionPhase @ApiStatus.Internal constructor(
|
||||
expireOnAnyEditorChange(indicator.editor)
|
||||
}
|
||||
|
||||
override fun newCompletionStarted(time: Int, repeated: Boolean): Int {
|
||||
override fun newCompletionStarted(invocationCount: Int, repeated: Boolean): Int {
|
||||
CompletionServiceImpl.setCompletionPhase(NoCompletion)
|
||||
if (repeated) {
|
||||
indicator!!.restorePrefix(restorePrefix)
|
||||
}
|
||||
return indicator!!.nextInvocationCount(time, repeated)
|
||||
return indicator!!.nextInvocationCount(invocationCount, repeated)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -512,9 +512,9 @@ sealed class CompletionPhase @ApiStatus.Internal constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun newCompletionStarted(time: Int, repeated: Boolean): Int {
|
||||
override fun newCompletionStarted(invocationCount: Int, repeated: Boolean): Int {
|
||||
CompletionServiceImpl.setCompletionPhase(NoCompletion)
|
||||
return indicator!!.nextInvocationCount(time, repeated)
|
||||
return indicator!!.nextInvocationCount(invocationCount, repeated)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -534,16 +534,16 @@ sealed class CompletionPhase @ApiStatus.Internal constructor(
|
||||
return false
|
||||
}
|
||||
|
||||
override fun newCompletionStarted(time: Int, repeated: Boolean): Int {
|
||||
override fun newCompletionStarted(invocationCount: Int, repeated: Boolean): Int {
|
||||
CompletionServiceImpl.setCompletionPhase(NoCompletion)
|
||||
return time
|
||||
return invocationCount
|
||||
}
|
||||
}
|
||||
|
||||
/** see doc of [CompletionPhase] */
|
||||
private object NoCompletionImpl: CompletionPhase(null) {
|
||||
override fun newCompletionStarted(time: Int, repeated: Boolean): Int {
|
||||
return time
|
||||
override fun newCompletionStarted(invocationCount: Int, repeated: Boolean): Int {
|
||||
return invocationCount
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
|
||||
Reference in New Issue
Block a user