diff --git a/build.gradle.kts b/build.gradle.kts index 769d6b293..c16213b50 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,13 +7,13 @@ import org.jetbrains.intellij.tasks.PatchPluginXmlTask val projectArend = gradle.includedBuild("Arend") group = "org.arend.lang" -version = "1.9.0.2" +version = "1.9.0.4" plugins { idea - kotlin("jvm") version "1.8.21" - id("org.jetbrains.intellij") version "1.13.3" - id("org.jetbrains.grammarkit") version "2022.3.1" + kotlin("jvm") version "1.9.21" + id("org.jetbrains.intellij") version "1.16.1" + id("org.jetbrains.grammarkit") version "2022.3.2" } repositories { @@ -63,11 +63,11 @@ tasks { } intellij { - version.set("2023.1") + version.set("2023.3") pluginName.set("Arend") updateSinceUntilBuild.set(true) instrumentCode.set(true) - plugins.set(listOf("yaml", "java", "IdeaVIM:2.1.0")) + plugins.set(listOf("yaml", "java", "IdeaVIM:2.7.5")) } tasks.named("runIde") { @@ -112,8 +112,8 @@ val generateArendDocLexer = tasks.register("genArendDocLexer" tasks.withType().configureEach { kotlinOptions { jvmTarget = "17" - languageVersion = "1.7" - apiVersion = "1.7" + languageVersion = "1.9" + apiVersion = "1.9" freeCompilerArgs = listOf("-Xjvm-default=all") } dependsOn(generateArendLexer, generateArendParser, generateArendDocLexer) @@ -137,7 +137,7 @@ tasks.register("prelude") { } tasks.withType { - gradleVersion = "7.6" + gradleVersion = "8.5" } // Utils diff --git a/src/main/kotlin/org/arend/ArendStartupActivity.kt b/src/main/kotlin/org/arend/ArendStartupActivity.kt index 372adff83..85a496b77 100644 --- a/src/main/kotlin/org/arend/ArendStartupActivity.kt +++ b/src/main/kotlin/org/arend/ArendStartupActivity.kt @@ -1,6 +1,5 @@ package org.arend -import com.intellij.ProjectTopics import com.intellij.openapi.application.runReadAction import com.intellij.openapi.components.service import com.intellij.openapi.module.Module @@ -22,7 +21,7 @@ class ArendStartupActivity : StartupActivity.RequiredForSmartMode { override fun runActivity(project: Project) { val libraryManager = project.service().libraryManager - project.messageBus.connect(project).subscribe(ProjectTopics.MODULES, object : ModuleListener { + project.messageBus.connect(project).subscribe(ModuleListener.TOPIC, object : ModuleListener { override fun modulesAdded(project: Project, modules: List) { for (module in modules) { if (ArendModuleType.has(module)) { @@ -57,7 +56,7 @@ class ArendStartupActivity : StartupActivity.RequiredForSmartMode { val progressFraction = 1.0 / modules.size.toDouble() for (module in modules) { module.register() - indicator.fraction = indicator.fraction + progressFraction + indicator.fraction += progressFraction } } }) diff --git a/src/main/kotlin/org/arend/highlight/BasePassFactory.kt b/src/main/kotlin/org/arend/highlight/BasePassFactory.kt index c0833067b..5bd4fc3bf 100644 --- a/src/main/kotlin/org/arend/highlight/BasePassFactory.kt +++ b/src/main/kotlin/org/arend/highlight/BasePassFactory.kt @@ -20,7 +20,7 @@ abstract class BasePassFactory(private val clazz: Class) : Dirty return null } - val textRange = FileStatusMap.getDirtyTextRange(editor, passId) + val textRange = FileStatusMap.getDirtyTextRange(editor.document, file, passId) return if (textRange == null) { EmptyHighlightingPass(file.project, editor.document) } else { diff --git a/src/main/kotlin/org/arend/intention/generating/LetWrappingOptionEditorRenderer.kt b/src/main/kotlin/org/arend/intention/generating/LetWrappingOptionEditorRenderer.kt index b90020010..b53799646 100644 --- a/src/main/kotlin/org/arend/intention/generating/LetWrappingOptionEditorRenderer.kt +++ b/src/main/kotlin/org/arend/intention/generating/LetWrappingOptionEditorRenderer.kt @@ -28,7 +28,7 @@ internal class LetWrappingOptionEditorRenderer( private val insertedRangeReference: AtomicReference = AtomicReference(null) private val highlighterReference: AtomicReference = AtomicReference(ScopeHighlighter(editor)) - private inline fun executeWriteCommand(noinline action: () -> Unit) { + private fun executeWriteCommand(action: () -> Unit) { executeCommand(project, null, commandGroupId) { runWriteAction(action) } } diff --git a/src/main/kotlin/org/arend/module/ArendModuleBuilder.kt b/src/main/kotlin/org/arend/module/ArendModuleBuilder.kt index 811ad6200..3b591c10a 100644 --- a/src/main/kotlin/org/arend/module/ArendModuleBuilder.kt +++ b/src/main/kotlin/org/arend/module/ArendModuleBuilder.kt @@ -36,7 +36,7 @@ class ArendModuleBuilder : ModuleBuilder() { } catch (e: ConfigurationException) { //IDEA-98382 We should allow Next step if user has wrong SDK if (Messages.showDialog( - JavaUiBundle.message("dialog.message.0.do.you.want.to.proceed", e.message), + JavaUiBundle.message("dialog.message.0.do.you.want.to.proceed", e.messageHtml), e.title, arrayOf(CommonBundle.getYesButtonText(), CommonBundle.getNoButtonText()), 1, diff --git a/src/main/kotlin/org/arend/module/ModuleSynchronizer.kt b/src/main/kotlin/org/arend/module/ModuleSynchronizer.kt index ee994175b..e8e587718 100644 --- a/src/main/kotlin/org/arend/module/ModuleSynchronizer.kt +++ b/src/main/kotlin/org/arend/module/ModuleSynchronizer.kt @@ -1,6 +1,5 @@ package org.arend.module -import com.intellij.ProjectTopics import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.application.runReadAction import com.intellij.openapi.application.runWriteAction @@ -24,7 +23,7 @@ import kotlin.Pair class ModuleSynchronizer(private val project: Project) : ModuleRootListener { fun install() { - project.messageBus.connect().subscribe(ProjectTopics.PROJECT_ROOTS, this) + project.messageBus.connect().subscribe(ModuleRootListener.TOPIC, this) synchronizeModules() } diff --git a/src/main/kotlin/org/arend/module/config/ArendModuleConfigurationUpdater.kt b/src/main/kotlin/org/arend/module/config/ArendModuleConfigurationUpdater.kt index 0cebf96ce..a189f2d3e 100644 --- a/src/main/kotlin/org/arend/module/config/ArendModuleConfigurationUpdater.kt +++ b/src/main/kotlin/org/arend/module/config/ArendModuleConfigurationUpdater.kt @@ -1,6 +1,7 @@ package org.arend.module.config import com.intellij.ide.util.projectWizard.ModuleBuilder +import com.intellij.openapi.application.runReadAction import com.intellij.openapi.module.Module import com.intellij.openapi.roots.ModifiableRootModel import com.intellij.openapi.util.io.FileUtil @@ -44,23 +45,32 @@ class ArendModuleConfigurationUpdater(private val isNewModule: Boolean) : Module }) configService.copyFrom(this) } else { - val yaml = moduleRoot.findChild(FileUtils.LIBRARY_CONFIG_FILE)?.let { - PsiManager.getInstance(rootModel.project).findFile(it) as? YAMLFile - } ?: return + if (!runReadAction { + val yaml = moduleRoot.findChild(FileUtils.LIBRARY_CONFIG_FILE)?.let { + PsiManager.getInstance(rootModel.project).findFile(it) as? YAMLFile + } ?: return@runReadAction false - configService.copyFromYAML(yaml, false) - copyFrom(configService) + configService.copyFromYAML(yaml, false) + copyFrom(configService) + return@runReadAction true + }) { + return + } } val rootPath = FileUtil.toSystemDependentName(moduleRoot.path) val srcDir = toAbsolute(rootPath, sourcesDir) - VfsUtil.createDirectories(srcDir) + if (isNewModule) { + VfsUtil.createDirectories(srcDir) + } contentEntry.addSourceFolder(VfsUtil.pathToUrl(srcDir), false) if (testsDir != "") { val testDir = toAbsolute(rootPath, testsDir) - VfsUtil.createDirectories(testDir) + if (isNewModule) { + VfsUtil.createDirectories(testDir) + } contentEntry.addSourceFolder(VfsUtil.pathToUrl(toAbsolute(rootPath, testDir)), true) } diff --git a/src/main/kotlin/org/arend/module/editor/ArendModuleConfigurationView.kt b/src/main/kotlin/org/arend/module/editor/ArendModuleConfigurationView.kt index 746a621d3..445c15549 100644 --- a/src/main/kotlin/org/arend/module/editor/ArendModuleConfigurationView.kt +++ b/src/main/kotlin/org/arend/module/editor/ArendModuleConfigurationView.kt @@ -8,9 +8,9 @@ import com.intellij.openapi.util.io.FileUtil import com.intellij.openapi.vfs.VfsUtil import com.intellij.ui.ScrollPaneFactory import com.intellij.ui.components.JBCheckBox +import com.intellij.ui.dsl.builder.AlignX import com.intellij.ui.dsl.builder.RowLayout import com.intellij.ui.dsl.builder.panel -import com.intellij.ui.dsl.gridLayout.HorizontalAlign import com.intellij.ui.layout.selected import org.arend.ArendIcons import org.arend.library.LibraryDependency @@ -160,7 +160,7 @@ class ArendModuleConfigurationView(project: Project?, root: String?, name: Strin aligned("Library version: ", versionField) aligned("Sources directory: ", sourcesTextField) aligned("Tests directory: ", testsTextField) - checked(binariesSwitch, binariesTextField) { horizontalAlign(HorizontalAlign.FILL) } + checked(binariesSwitch, binariesTextField) { align(AlignX.FILL) } .layout(RowLayout.LABEL_ALIGNED) group("Extensions") { diff --git a/src/main/kotlin/org/arend/project/ArendProjectImportBuilder.kt b/src/main/kotlin/org/arend/project/ArendProjectImportBuilder.kt index a9e8efae6..8a21dcd9d 100644 --- a/src/main/kotlin/org/arend/project/ArendProjectImportBuilder.kt +++ b/src/main/kotlin/org/arend/project/ArendProjectImportBuilder.kt @@ -31,7 +31,7 @@ class ArendProjectImportBuilder : ProjectImportBuilder() { override fun commit(project: Project, model: ModifiableModuleModel?, modulesProvider: ModulesProvider?, artifactModel: ModifiableArtifactModel?): List? { val rootPath = fileToImport ?: return null val detector = ProjectStructureDetector.EP_NAME.findExtensionOrFail(ArendProjectStructureDetector::class.java) - val builder = ProjectFromSourcesBuilderImpl(WizardContext(project, project), ModulesProvider.EMPTY_MODULES_PROVIDER) + val builder = ProjectFromSourcesBuilderImpl(WizardContext(project, project), modulesProvider ?: ModulesProvider.EMPTY_MODULES_PROVIDER) builder.baseProjectPath = rootPath detector.setupProjectStructure(listOf(File(rootPath)), builder.getProjectDescriptor(detector)) return builder.commit(project, model, modulesProvider, artifactModel) diff --git a/src/main/kotlin/org/arend/quickfix/referenceResolve/ArendImportHintAction.kt b/src/main/kotlin/org/arend/quickfix/referenceResolve/ArendImportHintAction.kt index 3031f1ff2..e344dc8b7 100644 --- a/src/main/kotlin/org/arend/quickfix/referenceResolve/ArendImportHintAction.kt +++ b/src/main/kotlin/org/arend/quickfix/referenceResolve/ArendImportHintAction.kt @@ -20,6 +20,7 @@ import com.intellij.psi.util.CachedValuesManager import com.intellij.psi.util.PsiModificationTracker import com.intellij.psi.util.parentOfType import com.intellij.util.SlowOperations +import com.intellij.util.ThreeState import org.arend.settings.ArendSettings import org.arend.naming.scope.ScopeFactory import org.arend.psi.ArendFile @@ -90,7 +91,7 @@ class ArendImportHintAction(private val referenceElement: ArendReferenceElement) if (availability == ImportHintActionAvailability.AVAILABLE_FOR_SILENT_FIX && service().autoImportOnTheFly && !refElementUnderCaret /* prevent on-the-fly autoimport of element under caret */ && - (ApplicationManager.getApplication().isUnitTestMode || DaemonListeners.canChangeFileSilently(psiFile)) && + (ApplicationManager.getApplication().isUnitTestMode || DaemonListeners.canChangeFileSilently(psiFile, true, ThreeState.UNSURE)) && isInModlessContext) { val action = ArendAddImportAction(project, editor, referenceElement, referenceResolveActions.toList(), true) CommandProcessor.getInstance().runUndoTransparentAction { action.execute() } diff --git a/src/main/kotlin/org/arend/refactoring/ArendRenamePsiElementProcessor.kt b/src/main/kotlin/org/arend/refactoring/ArendRenamePsiElementProcessor.kt index 42e0b86bf..08e5b18a4 100644 --- a/src/main/kotlin/org/arend/refactoring/ArendRenamePsiElementProcessor.kt +++ b/src/main/kotlin/org/arend/refactoring/ArendRenamePsiElementProcessor.kt @@ -32,9 +32,7 @@ class ArendRenamePsiElementProcessor: RenamePsiElementProcessor() { try { super.canRun() } catch (e: ConfigurationException) { - if (e.message != null) { - throw ConfigurationException("'" + patchedGetNewName() + "'" + "is not a valid Arend module name") - } + throw ConfigurationException("'" + patchedGetNewName() + "'" + "is not a valid Arend module name") } } diff --git a/src/main/kotlin/org/arend/refactoring/move/ArendMoveMembersDialog.kt b/src/main/kotlin/org/arend/refactoring/move/ArendMoveMembersDialog.kt index d0285de64..16bf7ac0e 100644 --- a/src/main/kotlin/org/arend/refactoring/move/ArendMoveMembersDialog.kt +++ b/src/main/kotlin/org/arend/refactoring/move/ArendMoveMembersDialog.kt @@ -20,10 +20,9 @@ import com.intellij.refactoring.util.CommonRefactoringUtil import com.intellij.ui.RowIcon import com.intellij.ui.ScrollPaneFactory import com.intellij.ui.SeparatorFactory +import com.intellij.ui.dsl.builder.Align import com.intellij.ui.dsl.builder.Row import com.intellij.ui.dsl.builder.panel -import com.intellij.ui.dsl.gridLayout.HorizontalAlign -import com.intellij.ui.dsl.gridLayout.VerticalAlign import org.arend.ext.module.ModulePath import org.arend.module.config.ArendModuleConfigService import org.arend.psi.ext.ArendClassStat @@ -72,9 +71,7 @@ class ArendMoveMembersDialog(project: Project, dynamicGroup = JRadioButton("Dynamic") lateinit var classPartRow: Row centerPanel = panel { - row { cell(ScrollPaneFactory.createScrollPane(memberSelectionPanel, true)) - .horizontalAlign(HorizontalAlign.FILL) - .verticalAlign(VerticalAlign.FILL) + row { cell(ScrollPaneFactory.createScrollPane(memberSelectionPanel, true)).align(Align.FILL) }.resizableRow() aligned("Target file: ", targetFileTextField) aligned("Target module: ", targetModuleTextField) diff --git a/src/main/kotlin/org/arend/search/proof/GearActionGroup.kt b/src/main/kotlin/org/arend/search/proof/GearActionGroup.kt index bfab94b49..1cfd619d9 100644 --- a/src/main/kotlin/org/arend/search/proof/GearActionGroup.kt +++ b/src/main/kotlin/org/arend/search/proof/GearActionGroup.kt @@ -24,7 +24,7 @@ class GearActionGroup(private val searchUI: ProofSearchUI, val project: Project) if (myPopupState.isRecentlyHidden) return // do not show new popup val popup = ActionManager.getInstance() .createActionPopupMenu(ActionPlaces.TOOLWINDOW_POPUP, ActualGearActionGroup(searchUI, project)) - val inputEvent = e.inputEvent + val inputEvent = e.inputEvent ?: return val x = if (inputEvent is MouseEvent) inputEvent.x else 0 val y = if (inputEvent is MouseEvent) inputEvent.y else 0 myPopupState.prepareToShow(popup.component) diff --git a/src/main/kotlin/org/arend/search/proof/ProofSearchUI.kt b/src/main/kotlin/org/arend/search/proof/ProofSearchUI.kt index 5ac9b19a9..2cded34b1 100644 --- a/src/main/kotlin/org/arend/search/proof/ProofSearchUI.kt +++ b/src/main/kotlin/org/arend/search/proof/ProofSearchUI.kt @@ -138,11 +138,8 @@ class ProofSearchUI(private val project: Project, private val caret: Caret?) : B val title = JBLabel(ArendBundle.message("arend.proof.search.title")) val topPanel = JPanel(MigLayout("flowx, ins 0, gap 0, fillx, filly")) val foregroundColor = when { - StartupUiUtil.isUnderDarcula() -> when { - UIUtil.isUnderWin10LookAndFeel() -> JBColor.WHITE - else -> JBColor(Gray._240, Gray._200) - } - else -> UIUtil.getLabelForeground() + JBColor.isBright() -> UIUtil.getLabelForeground() + else -> JBColor(Gray._240, Gray._200) } title.foreground = foregroundColor title.border = BorderFactory.createEmptyBorder(3, 5, 5, 0) diff --git a/src/main/kotlin/org/arend/toolWindow/errors/ArendMessagesService.kt b/src/main/kotlin/org/arend/toolWindow/errors/ArendMessagesService.kt index 537ff9f44..fe770a016 100644 --- a/src/main/kotlin/org/arend/toolWindow/errors/ArendMessagesService.kt +++ b/src/main/kotlin/org/arend/toolWindow/errors/ArendMessagesService.kt @@ -3,7 +3,7 @@ package org.arend.toolWindow.errors import com.intellij.openapi.application.runInEdt import com.intellij.openapi.components.service import com.intellij.openapi.observable.properties.AtomicBooleanProperty -import com.intellij.openapi.observable.properties.BooleanProperty +import com.intellij.openapi.observable.properties.MutableBooleanProperty import com.intellij.openapi.project.Project import com.intellij.openapi.wm.ToolWindow import com.intellij.openapi.wm.ToolWindowManager @@ -17,16 +17,16 @@ class ArendMessagesService(private val project: Project) { var isGoalTextPinned: Boolean = false var isErrorTextPinned: Boolean = false - var isShowImplicitGoals: BooleanProperty = + var isShowImplicitGoals: MutableBooleanProperty = AtomicBooleanProperty(project.service().data.isShowImplicitGoals).apply { afterChange { project.service().data.isShowImplicitGoals = it } } - var isShowErrorsPanel: BooleanProperty = + var isShowErrorsPanel: MutableBooleanProperty = AtomicBooleanProperty(project.service().data.isShowErrorsPanel).apply { afterChange { project.service().data.isShowErrorsPanel = it } } - var isShowGoalsInErrorsPanel: BooleanProperty = + var isShowGoalsInErrorsPanel: MutableBooleanProperty = AtomicBooleanProperty(project.service().data.isShowGoalsInErrorsPanel).apply { afterChange { project.service().data.isShowGoalsInErrorsPanel = it } } diff --git a/src/main/kotlin/org/arend/toolWindow/errors/ArendMessagesView.kt b/src/main/kotlin/org/arend/toolWindow/errors/ArendMessagesView.kt index 2146b162b..338fcad24 100644 --- a/src/main/kotlin/org/arend/toolWindow/errors/ArendMessagesView.kt +++ b/src/main/kotlin/org/arend/toolWindow/errors/ArendMessagesView.kt @@ -303,40 +303,43 @@ class ArendMessagesView(private val project: Project, toolWindow: ToolWindow) : } fun update() { - val expandedPaths = TreeUtil.collectExpandedPaths(tree) - val selectedPath = tree.selectionPath - - val filterSet = project.service().messagesFilterSet - val errorsMap = project.service().errors - val map = HashMap>() - tree.update(root) { node -> - if (node == root) errorsMap.entries.filter { entry -> entry.value.any { it.error.satisfies(filterSet) } }.map { it.key } - else when (val obj = node.userObject) { - is ArendFile -> { - val arendErrors = errorsMap[obj] - val children = LinkedHashSet() - for (arendError in arendErrors ?: emptyList()) { - if (!arendError.error.satisfies(filterSet)) { - continue - } + runInEdt { + val expandedPaths = TreeUtil.collectExpandedPaths(tree) + val selectedPath = tree.selectionPath + + val filterSet = project.service().messagesFilterSet + val errorsMap = project.service().errors + val map = HashMap>() + tree.update(root) { node -> + if (node == root) errorsMap.entries.filter { entry -> entry.value.any { it.error.satisfies(filterSet) } }.map { it.key } + else when (val obj = node.userObject) { + is ArendFile -> { + val arendErrors = errorsMap[obj] + val children = LinkedHashSet() + for (arendError in arendErrors ?: emptyList()) { + if (!arendError.error.satisfies(filterSet)) { + continue + } - val def = arendError.definition - if (def == null) { - children.add(ArendErrorTreeElement(arendError)) - } else { - children.add(def) - map.computeIfAbsent(def) { LinkedHashMap() }.computeIfAbsent(arendError.cause) { ArendErrorTreeElement() }.add(arendError) + val def = arendError.definition + if (def == null) { + children.add(ArendErrorTreeElement(arendError)) + } else { + children.add(def) + map.computeIfAbsent(def) { LinkedHashMap() }.computeIfAbsent(arendError.cause) { ArendErrorTreeElement() }.add(arendError) + } } + children } - children + + is PsiConcreteReferable -> map[obj]?.values ?: emptySet() + else -> emptySet() } - is PsiConcreteReferable -> map[obj]?.values ?: emptySet() - else -> emptySet() } - } - treeModel.reload() - TreeUtil.restoreExpandedPaths(tree, expandedPaths) - tree.selectionPath = tree.getExistingPrefix(selectedPath) + treeModel.reload() + TreeUtil.restoreExpandedPaths(tree, expandedPaths) + tree.selectionPath = tree.getExistingPrefix(selectedPath) + } } } \ No newline at end of file diff --git a/src/main/kotlin/org/arend/toolWindow/errors/tree/ArendErrorTree.kt b/src/main/kotlin/org/arend/toolWindow/errors/tree/ArendErrorTree.kt index 6e3e6af94..a1b860788 100644 --- a/src/main/kotlin/org/arend/toolWindow/errors/tree/ArendErrorTree.kt +++ b/src/main/kotlin/org/arend/toolWindow/errors/tree/ArendErrorTree.kt @@ -2,6 +2,7 @@ package org.arend.toolWindow.errors.tree import com.intellij.codeInsight.hints.presentation.MouseButton import com.intellij.codeInsight.hints.presentation.mouseButton +import com.intellij.openapi.application.runReadAction import com.intellij.psi.PsiElement import com.intellij.ui.treeStructure.Tree import com.intellij.util.ui.tree.TreeUtil @@ -93,7 +94,7 @@ class ArendErrorTree(treeModel: DefaultTreeModel, private val listener: ArendErr override fun convertValueToText(value: Any?, selected: Boolean, expanded: Boolean, leaf: Boolean, row: Int, hasFocus: Boolean): String = when (val obj = ((value as? DefaultMutableTreeNode)?.userObject)) { - is ArendFile -> obj.moduleLocation?.toString() ?: obj.name + is ArendFile -> obj.fullName is ArendErrorTreeElement -> { val messages = LinkedHashSet() for (arendError in obj.errors) { @@ -101,7 +102,9 @@ class ArendErrorTree(treeModel: DefaultTreeModel, private val listener: ArendErr } messages.joinToString("; ") } - is Referable -> if ((obj as? PsiElement)?.isValid == false) "" else obj.textRepresentation() + is Referable -> runReadAction { + if ((obj as? PsiElement)?.isValid == false) "" else obj.textRepresentation() + } else -> obj?.toString() ?: "" } diff --git a/src/main/kotlin/org/arend/toolWindow/errors/tree/ArendErrorTreeAutoScrollFromSource.kt b/src/main/kotlin/org/arend/toolWindow/errors/tree/ArendErrorTreeAutoScrollFromSource.kt index 7cde3a72f..7ae350ded 100644 --- a/src/main/kotlin/org/arend/toolWindow/errors/tree/ArendErrorTreeAutoScrollFromSource.kt +++ b/src/main/kotlin/org/arend/toolWindow/errors/tree/ArendErrorTreeAutoScrollFromSource.kt @@ -62,7 +62,7 @@ class ArendErrorTreeAutoScrollFromSource(private val project: Project, private v fun updateCurrentSelection() { val selectedEditor = (FileEditorManager.getInstance(myProject).selectedEditor as? TextEditor)?.editor if (selectedEditor != null) { - runInEdt(ModalityState.NON_MODAL) { + runInEdt(ModalityState.nonModal()) { selectInAlarm(selectedEditor) } } @@ -111,14 +111,14 @@ class ArendErrorTreeAutoScrollFromSource(private val project: Project, private v fun createActionGroup() = DefaultActionGroup(UIBundle.message("autoscroll.from.source.action.description"), true).apply { templatePresentation.icon = AllIcons.General.AutoscrollFromSource - for (type in MessageType.values()) { + for (type in MessageType.entries) { val action = MyAction(type) add(action) actionMap[type] = action } val settings = project.service() - for (type in MessageType.values()) { + for (type in MessageType.entries) { val enabled = settings.messagesFilterSet.contains(type) && (!(type == MessageType.RESOLVING || type == MessageType.PARSING) || settings.autoScrollFromSource.contains(MessageType.SHORT) && settings.messagesFilterSet.contains(MessageType.SHORT)) diff --git a/src/main/kotlin/org/arend/ui/impl/session/ArendToolWindowSession.kt b/src/main/kotlin/org/arend/ui/impl/session/ArendToolWindowSession.kt index 69cc23de7..b0279da48 100644 --- a/src/main/kotlin/org/arend/ui/impl/session/ArendToolWindowSession.kt +++ b/src/main/kotlin/org/arend/ui/impl/session/ArendToolWindowSession.kt @@ -4,6 +4,7 @@ import com.intellij.CommonBundle import com.intellij.openapi.components.service import com.intellij.openapi.project.Project import com.intellij.openapi.util.SystemInfo +import com.intellij.ui.JBColor import com.intellij.ui.components.panels.NonOpaquePanel import com.intellij.ui.content.Content import com.intellij.ui.scale.JBUIScale @@ -49,7 +50,7 @@ class ArendToolWindowSession(project: Project) : ComponentSession() { val insets = button.insets buttonsPanel.add(button) if (i < buttons.size - 1) { - val gap = if (StartupUiUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) JBUIScale.scale(if (UIUtil.isUnderWin10LookAndFeel()) 8 else 12) - insets.left - insets.right else JBUIScale.scale(8) + val gap = if (!JBColor.isBright() || UIUtil.isUnderIntelliJLaF()) JBUIScale.scale(12) - insets.left - insets.right else JBUIScale.scale(8) buttonsPanel.add(Box.createRigidArea(Dimension(gap, 0))) } } diff --git a/src/main/kotlin/org/arend/util/KotlinUtils.kt b/src/main/kotlin/org/arend/util/KotlinUtils.kt index 989ab45cf..b265a861f 100644 --- a/src/main/kotlin/org/arend/util/KotlinUtils.kt +++ b/src/main/kotlin/org/arend/util/KotlinUtils.kt @@ -1,8 +1,8 @@ package org.arend.util +import com.intellij.ui.dsl.builder.AlignX import com.intellij.ui.dsl.builder.Cell import com.intellij.ui.dsl.builder.Panel -import com.intellij.ui.dsl.gridLayout.HorizontalAlign import com.intellij.ui.layout.selected import javax.swing.AbstractButton import javax.swing.JComponent @@ -40,7 +40,7 @@ fun Panel.labeled(text: String, component: JComponent) = row { } fun Panel.aligned(text: String, component: T, init: Cell.() -> Unit = {}) = row(text) { - cell(component).horizontalAlign(HorizontalAlign.FILL).init() + cell(component).align(AlignX.FILL).init() } fun Panel.checked(checkBox: AbstractButton, component: T, init: Cell.() -> Unit = {}) = row { diff --git a/src/main/kotlin/org/arend/util/ProjectUtils.kt b/src/main/kotlin/org/arend/util/ProjectUtils.kt index 77b33fc6b..8cb162057 100644 --- a/src/main/kotlin/org/arend/util/ProjectUtils.kt +++ b/src/main/kotlin/org/arend/util/ProjectUtils.kt @@ -1,7 +1,7 @@ package org.arend.util import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer -import com.intellij.codeInsight.hints.InlayHintsPassFactory +import com.intellij.codeInsight.hints.InlayHintsFactory import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.application.runReadAction import com.intellij.openapi.components.service @@ -69,7 +69,7 @@ fun Editor.isDetailedViewEditor() : Boolean = getUserData(InjectedArendEditor.AR fun Project.afterTypechecking(files: Collection) { for (editor in EditorFactory.getInstance().allEditors) { - InlayHintsPassFactory.clearModificationStamp(editor) + InlayHintsFactory.clearModificationStamp(editor) // editor.putUserData(PSI_MODIFICATION_STAMP, null) } runReadAction { for (file in files) { diff --git a/src/main/kotlin/org/arend/yaml/YAMLFileListener.kt b/src/main/kotlin/org/arend/yaml/YAMLFileListener.kt index 5c5217173..12ab79a73 100644 --- a/src/main/kotlin/org/arend/yaml/YAMLFileListener.kt +++ b/src/main/kotlin/org/arend/yaml/YAMLFileListener.kt @@ -1,6 +1,5 @@ package org.arend.yaml -import com.intellij.AppTopics import com.intellij.openapi.editor.Document import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.fileEditor.FileDocumentManagerListener @@ -17,7 +16,7 @@ class YAMLFileListener(private val project: Project) : BulkFileListener, FileDoc fun register() { val connection = project.messageBus.connect() connection.subscribe(VirtualFileManager.VFS_CHANGES, this) - connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, this) + connection.subscribe(FileDocumentManagerListener.TOPIC, this) } override fun beforeDocumentSaving(document: Document) { diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index e5dc4106b..b9255a36d 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -3,7 +3,7 @@ JetBrains - +