GitOrigin-RevId: 9131dbc5ef2e9c5c423551c771e7602c734829b4
This commit is contained in:
Alexey Kudravtsev
2023-05-19 15:59:46 +02:00
committed by intellij-monorepo-bot
parent cb745831dd
commit 819c82680c
6 changed files with 18 additions and 25 deletions

View File

@@ -8,15 +8,16 @@ import com.intellij.psi.util.PsiModificationTracker;
import org.jetbrains.annotations.NotNull;
/**
* IntentionAction which is related to some very expensive PSI computations, e.g., import java class fix.
* Usually this action instantiated in the background and performs very expensive computations in its constructor and invalidate their results on any PSI modification.
* {@link IntentionAction} which performs some very expensive PSI computations, e.g., imports java class.
* Usually this action instantiated in the background and performs very expensive computations in its constructor
* and invalidates their results on any PSI modification.
*/
public abstract class ExpensivePsiIntentionAction implements IntentionAction {
@SuppressWarnings("ActionIsNotPreviewFriendly") protected final Project myProject;
private final long myPsiModificationCount;
protected ExpensivePsiIntentionAction(@NotNull Project project) {
// there is a lot of PSI computations and resolve going on here, ensure no freezes are reported
// there are a lot of PSI computations and resolve going on here, ensure no freezes are reported
ApplicationManager.getApplication().assertIsNonDispatchThread();
ApplicationManager.getApplication().assertReadAccessAllowed();
myProject = project;

View File

@@ -2,16 +2,15 @@
package com.intellij.codeInsight.daemon.impl;
import com.intellij.platform.diagnostic.telemetry.IJTracer;
import com.intellij.platform.diagnostic.telemetry.Scope;
import com.intellij.platform.diagnostic.telemetry.TelemetryTracer;
import io.opentelemetry.api.common.AttributeKey;
import static com.intellij.codeInsight.daemon.impl.HighlightingPassesScopeKt.*;
/**
* Telemetry constants for daemon passes
*/
final class HighlightingPassTracer {
private HighlightingPassTracer() {
}
static IJTracer HIGHLIGHTING_PASS_TRACER = TelemetryTracer.getInstance().getTracer(HighlightingPasses);
static AttributeKey<String> FILE_ATTR_SPAN_KEY = AttributeKey.stringKey("file");
static AttributeKey<String> CANCELLED_ATTR_SPAN_KEY = AttributeKey.stringKey("cancelled");
static final IJTracer HIGHLIGHTING_PASS_TRACER = TelemetryTracer.getInstance().getTracer(new Scope("HighlightingPasses", null));
static final AttributeKey<String> FILE_ATTR_SPAN_KEY = AttributeKey.stringKey("file");
static final AttributeKey<String> CANCELLED_ATTR_SPAN_KEY = AttributeKey.stringKey("cancelled");
}

View File

@@ -1,7 +0,0 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.daemon.impl
import com.intellij.platform.diagnostic.telemetry.Scope
@JvmField
val HighlightingPasses = Scope("HighlightingPasses")

View File

@@ -140,7 +140,7 @@ public final class SeverityRegistrar implements Comparator<HighlightSeverity>, M
}
public @Nullable TextAttributes getCustomSeverityTextAttributes(@NotNull TextAttributesKey key) {
final SeverityBasedTextAttributes attributes = myMap.get(key.getExternalName());
SeverityBasedTextAttributes attributes = myMap.get(key.getExternalName());
return attributes != null ? attributes.getAttributes() : null;
}

View File

@@ -15,7 +15,7 @@ class ConfigureInspectionsAction : DumbAwareAction(message("popup.action.configu
event.presentation.isEnabled = event.project != null
}
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT
override fun actionPerformed(event: AnActionEvent) {
val project = event.project ?: return

View File

@@ -16,7 +16,7 @@ import com.intellij.util.ui.EmptyIcon
import org.jetbrains.annotations.ApiStatus
import javax.swing.Icon
val EP_NAME = ExtensionPointName<EmptyIntentionProvider>("com.intellij.emptyIntentionProvider")
val EP_NAME: ExtensionPointName<EmptyIntentionProvider> = ExtensionPointName<EmptyIntentionProvider>("com.intellij.emptyIntentionProvider")
@ApiStatus.Internal
interface EmptyIntentionProvider {
@@ -29,10 +29,10 @@ class EmptyIntentionGeneratorIntention(val name: @IntentionFamilyName String, va
EP_NAME.extensionList.any { it.invoke(project, editor, file, template) }
}
override fun startInWriteAction() = true
override fun getText() = name
override fun getFamilyName() = name
override fun isAvailable(project: Project, editor: Editor?, file: PsiFile?) = true
override fun startInWriteAction(): Boolean = true
override fun getText(): @IntentionFamilyName String = name
override fun getFamilyName(): @IntentionFamilyName String = name
override fun isAvailable(project: Project, editor: Editor?, file: PsiFile?): Boolean = true
override fun getIcon(@IconFlags flags: Int): Icon =
if (getBoolean("ide.experimental.ui")) EmptyIcon.ICON_0 else AllIcons.Actions.RealIntentionBulb