mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
[func-test] new test for incremental highlighting has been added to aggregator tests
GitOrigin-RevId: c5e9663f9fe72d8c7b27358c4e04f6090f3f7d7a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
978ab4bfec
commit
1dd2a045ad
@@ -679,6 +679,11 @@ fun <T : CommandChain> T.cut(): T = apply {
|
||||
executeEditorAction("\$Cut")
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun <T : CommandChain> T.undo(): T = apply {
|
||||
executeEditorAction("\$Undo")
|
||||
}
|
||||
|
||||
fun <T : CommandChain> T.selectAll(): T = apply {
|
||||
executeEditorAction("\$SelectAll")
|
||||
}
|
||||
@@ -735,6 +740,10 @@ fun <T : CommandChain> T.collectAllFiles(extension: String, fromSources: Boolean
|
||||
addCommand("${CMD_PREFIX}collectAllFiles $extension $fromSources")
|
||||
}
|
||||
|
||||
fun <T : CommandChain> T.storeHighlightingResults(fileName: String): T = apply {
|
||||
addCommand("${CMD_PREFIX}storeHighlightingResults $fileName")
|
||||
}
|
||||
|
||||
fun <T : CommandChain> T.recompileFiles(relativeFilePaths: List<String>): T = apply {
|
||||
addCommand("${CMD_PREFIX}buildProject RECOMPILE_FILES ${relativeFilePaths.joinToString(" ")}".trim())
|
||||
}
|
||||
|
||||
@@ -107,7 +107,8 @@ public final class BaseCommandProvider implements CommandProvider {
|
||||
Map.entry(ReplaceBrowser.PREFIX, ReplaceBrowser::new),
|
||||
Map.entry(AssertModuleJdkVersionCommand.PREFIX, AssertModuleJdkVersionCommand::new),
|
||||
Map.entry(WaitForEDTQueueUnstuckCommand.PREFIX, WaitForEDTQueueUnstuckCommand::new),
|
||||
Map.entry(CreateScratchFile.PREFIX, CreateScratchFile::new)
|
||||
Map.entry(CreateScratchFile.PREFIX, CreateScratchFile::new),
|
||||
Map.entry(StoreHighlightingResultsCommand.PREFIX, StoreHighlightingResultsCommand::new)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.jetbrains.performancePlugin.commands
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl
|
||||
import com.intellij.codeInsight.daemon.impl.SeverityRegistrar
|
||||
import com.intellij.openapi.application.EDT
|
||||
import com.intellij.openapi.application.PathManager
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager
|
||||
import com.intellij.openapi.ui.playback.PlaybackContext
|
||||
import com.intellij.openapi.ui.playback.commands.PlaybackCommandCoroutineAdapter
|
||||
import com.intellij.psi.PsiDocumentManager
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import java.io.File
|
||||
import kotlin.io.path.div
|
||||
|
||||
class StoreHighlightingResultsCommand(text: String, line: Int) : PlaybackCommandCoroutineAdapter(text, line) {
|
||||
|
||||
|
||||
companion object {
|
||||
const val PREFIX: @NonNls String = CMD_PREFIX + "storeHighlightingResults"
|
||||
}
|
||||
|
||||
@Suppress("TestOnlyProblems")
|
||||
override suspend fun doExecute(context: PlaybackContext) {
|
||||
val project = context.project
|
||||
val fileNameToStoreHighlightingInfo = extractCommandArgument(PREFIX).split(" ", limit = 1)[0]
|
||||
val fileForStoringHighlights: File = (PathManager.getLogDir() / "${fileNameToStoreHighlightingInfo}.txt").toFile()
|
||||
if (!fileForStoringHighlights.exists()) {
|
||||
fileForStoringHighlights.createNewFile()
|
||||
}
|
||||
|
||||
val editor = FileEditorManager.getInstance(project).selectedTextEditor
|
||||
require(editor != null)
|
||||
withContext(Dispatchers.EDT) {
|
||||
val psiFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.document)
|
||||
require(psiFile != null)
|
||||
for (severity in SeverityRegistrar.getSeverityRegistrar(project).allSeverities) {
|
||||
val highlights = DaemonCodeAnalyzerImpl.getHighlights(editor.document, severity, project)
|
||||
highlights.forEach { highlight ->
|
||||
fileForStoringHighlights.appendText("${severity}☆${highlight.description}☆${editor.document.getLineNumber(highlight.actualStartOffset)}" + "\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user