Skip to content

Commit

Permalink
optimize change of the Aptos compiler version
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurnikov committed Jun 9, 2024
1 parent 625d3e5 commit 0ac8c1c
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
package org.move.cli.settings

import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer
import com.intellij.codeInsight.daemon.impl.FileStatusMap
import com.intellij.openapi.Disposable
import com.intellij.openapi.components.BaseState
import com.intellij.openapi.components.SimplePersistentStateComponent
import com.intellij.openapi.project.Project
import com.intellij.openapi.roots.ProjectFileIndex
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiManager
import com.intellij.psi.search.FileTypeIndex
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.stubs.StubTreeLoader
import com.intellij.util.FileContentUtil
import com.intellij.util.FileContentUtilCore
import com.intellij.util.messages.Topic
import org.jetbrains.annotations.TestOnly
import org.move.cli.settings.MvProjectSettingsServiceBase.MvProjectSettingsBase
import org.move.lang.MoveFileType
import org.move.openapiext.saveAllDocuments
import kotlin.reflect.KProperty1
import kotlin.reflect.full.findAnnotation
Expand Down Expand Up @@ -82,14 +81,14 @@ abstract class MvProjectSettingsServiceBase<T: MvProjectSettingsBase<T>>(
}

if (event.affectsParseTree) {
// REFRESH EVERYTHING (didn't find any proper way to do it)
// refresh all .move files (didn't find any proper way to do it)
saveAllDocuments()
val files = mutableListOf<VirtualFile>()
ProjectFileIndex.getInstance(project).iterateContent { files.add(it) }

val moveFiles = FileTypeIndex.getFiles(MoveFileType, GlobalSearchScope.allScope(project))

PsiManager.getInstance(project).dropPsiCaches()
FileContentUtilCore.reparseFiles(files)
files.forEach { StubTreeLoader.getInstance().rebuildStubTree(it) }
FileContentUtilCore.reparseFiles(moveFiles)
moveFiles.forEach { StubTreeLoader.getInstance().rebuildStubTree(it) }
}
}

Expand Down

0 comments on commit 0ac8c1c

Please sign in to comment.