From 5fe1eaea17efa14d660faa2b653425532f61967d Mon Sep 17 00:00:00 2001 From: Andrei Klunnyi Date: Tue, 7 Jul 2020 15:48:35 +0200 Subject: [PATCH] KT-32368 Rework Inline hints settings // remove outdated KotlinCodeHintsPass Some time ago platform couldn't place hints at the end of a line. This is how KotlinCodeHintsPass appeared. Class was responsible for lambda related hints. Now that platform evolved functionality was moved to KotlinLambdasHintsProvider. --- .../resources-descriptors/META-INF/plugin.xml | 1 - .../META-INF/plugin.xml.192 | 3 - .../META-INF/plugin.xml.193 | 1 - .../META-INF/plugin.xml.202 | 1 - .../META-INF/plugin.xml.as36 | 3 - .../META-INF/plugin.xml.as40 | 1 - .../META-INF/plugin.xml.as41 | 1 - idea/resources/META-INF/plugin-common.xml | 2 - .../DisableReturnLambdaHintOptionAction.kt | 44 ------ .../custom/KotlinCodeHintsModel.kt | 128 ------------------ .../custom/KotlinCodeHintsPass.kt | 109 --------------- .../custom/KotlinCodeHintsPass.kt.192 | 103 -------------- .../custom/ReturnHintLinePainter.kt | 51 ------- .../org/jetbrains/kotlin/idea/util/editors.kt | 27 ---- 14 files changed, 475 deletions(-) delete mode 100644 idea/src/org/jetbrains/kotlin/idea/parameterInfo/custom/DisableReturnLambdaHintOptionAction.kt delete mode 100644 idea/src/org/jetbrains/kotlin/idea/parameterInfo/custom/KotlinCodeHintsModel.kt delete mode 100644 idea/src/org/jetbrains/kotlin/idea/parameterInfo/custom/KotlinCodeHintsPass.kt delete mode 100644 idea/src/org/jetbrains/kotlin/idea/parameterInfo/custom/KotlinCodeHintsPass.kt.192 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/parameterInfo/custom/ReturnHintLinePainter.kt delete mode 100644 idea/src/org/jetbrains/kotlin/idea/util/editors.kt diff --git a/idea/resources-descriptors/META-INF/plugin.xml b/idea/resources-descriptors/META-INF/plugin.xml index b0db6623389..53260618036 100644 --- a/idea/resources-descriptors/META-INF/plugin.xml +++ b/idea/resources-descriptors/META-INF/plugin.xml @@ -89,7 +89,6 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. - diff --git a/idea/resources-descriptors/META-INF/plugin.xml.192 b/idea/resources-descriptors/META-INF/plugin.xml.192 index 457dca0e1d3..54a495672e6 100644 --- a/idea/resources-descriptors/META-INF/plugin.xml.192 +++ b/idea/resources-descriptors/META-INF/plugin.xml.192 @@ -78,9 +78,6 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. org.jetbrains.kotlin.idea.highlighter.KotlinBeforeResolveHighlightingPass$Factory - - org.jetbrains.kotlin.idea.parameterInfo.custom.KotlinCodeHintsPass$Companion$Factory - org.jetbrains.kotlin.idea.refactoring.cutPaste.MoveDeclarationsPassFactory diff --git a/idea/resources-descriptors/META-INF/plugin.xml.193 b/idea/resources-descriptors/META-INF/plugin.xml.193 index 7856d28346b..19c256a4353 100644 --- a/idea/resources-descriptors/META-INF/plugin.xml.193 +++ b/idea/resources-descriptors/META-INF/plugin.xml.193 @@ -95,7 +95,6 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. - diff --git a/idea/resources-descriptors/META-INF/plugin.xml.202 b/idea/resources-descriptors/META-INF/plugin.xml.202 index 91f727d1ca7..ed37fb35054 100644 --- a/idea/resources-descriptors/META-INF/plugin.xml.202 +++ b/idea/resources-descriptors/META-INF/plugin.xml.202 @@ -89,7 +89,6 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. - diff --git a/idea/resources-descriptors/META-INF/plugin.xml.as36 b/idea/resources-descriptors/META-INF/plugin.xml.as36 index 68bc12922e3..3763b046dc1 100644 --- a/idea/resources-descriptors/META-INF/plugin.xml.as36 +++ b/idea/resources-descriptors/META-INF/plugin.xml.as36 @@ -79,9 +79,6 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. org.jetbrains.kotlin.idea.highlighter.KotlinBeforeResolveHighlightingPass$Factory - - org.jetbrains.kotlin.idea.parameterInfo.custom.KotlinCodeHintsPass$Companion$Factory - org.jetbrains.kotlin.idea.refactoring.cutPaste.MoveDeclarationsPassFactory diff --git a/idea/resources-descriptors/META-INF/plugin.xml.as40 b/idea/resources-descriptors/META-INF/plugin.xml.as40 index a6a2a8cc2d7..db2d64fd6f0 100644 --- a/idea/resources-descriptors/META-INF/plugin.xml.as40 +++ b/idea/resources-descriptors/META-INF/plugin.xml.as40 @@ -94,7 +94,6 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. - diff --git a/idea/resources-descriptors/META-INF/plugin.xml.as41 b/idea/resources-descriptors/META-INF/plugin.xml.as41 index 1090d87d328..536375fddef 100644 --- a/idea/resources-descriptors/META-INF/plugin.xml.as41 +++ b/idea/resources-descriptors/META-INF/plugin.xml.as41 @@ -88,7 +88,6 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. - diff --git a/idea/resources/META-INF/plugin-common.xml b/idea/resources/META-INF/plugin-common.xml index 75c4974c285..bc646597c8b 100644 --- a/idea/resources/META-INF/plugin-common.xml +++ b/idea/resources/META-INF/plugin-common.xml @@ -228,8 +228,6 @@ - - diff --git a/idea/src/org/jetbrains/kotlin/idea/parameterInfo/custom/DisableReturnLambdaHintOptionAction.kt b/idea/src/org/jetbrains/kotlin/idea/parameterInfo/custom/DisableReturnLambdaHintOptionAction.kt deleted file mode 100644 index d4f8a54a80d..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/parameterInfo/custom/DisableReturnLambdaHintOptionAction.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.parameterInfo.custom - -import com.intellij.codeInsight.hints.InlayParameterHintsExtension -import com.intellij.codeInsight.intention.IntentionAction -import com.intellij.codeInsight.intention.LowPriorityAction -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.editor.ex.EditorSettingsExternalizable -import com.intellij.openapi.project.Project -import com.intellij.psi.PsiFile -import org.jetbrains.kotlin.idea.KotlinLanguage -import org.jetbrains.kotlin.idea.codeInsight.hints.HintType -import org.jetbrains.kotlin.idea.util.refreshAllOpenEditors - -class DisableReturnLambdaHintOptionAction : IntentionAction, LowPriorityAction { - override fun getText(): String { - return HintType.LAMBDA_RETURN_EXPRESSION.doNotShowDesc - } - - override fun getFamilyName(): String = text - - override fun isAvailable(project: Project, editor: Editor, file: PsiFile): Boolean { - if (file.language != KotlinLanguage.INSTANCE) return false - - InlayParameterHintsExtension.forLanguage(file.language) ?: return false - - if (!EditorSettingsExternalizable.getInstance().isShowParameterNameHints || !HintType.LAMBDA_RETURN_EXPRESSION.enabled) { - return false - } - - return KotlinCodeHintsModel.getInstance(project).getExtensionInfoAtOffset(editor) != null - } - - override fun invoke(project: Project, editor: Editor, file: PsiFile) { - HintType.LAMBDA_RETURN_EXPRESSION.option.set(false) - refreshAllOpenEditors() - } - - override fun startInWriteAction(): Boolean = false -} diff --git a/idea/src/org/jetbrains/kotlin/idea/parameterInfo/custom/KotlinCodeHintsModel.kt b/idea/src/org/jetbrains/kotlin/idea/parameterInfo/custom/KotlinCodeHintsModel.kt deleted file mode 100644 index 72a3a1ee61a..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/parameterInfo/custom/KotlinCodeHintsModel.kt +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.parameterInfo.custom - -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.editor.Document -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.editor.EditorFactory -import com.intellij.openapi.editor.RangeMarker -import com.intellij.openapi.editor.event.EditorFactoryEvent -import com.intellij.openapi.editor.event.EditorFactoryListener -import com.intellij.openapi.project.Project -import com.intellij.psi.PsiElement -import com.intellij.util.containers.ContainerUtil -import org.jetbrains.kotlin.idea.core.util.end -import org.jetbrains.kotlin.idea.core.util.range -import org.jetbrains.kotlin.idea.util.application.getServiceSafe -import org.jetbrains.kotlin.idea.util.application.runReadAction -import org.jetbrains.kotlin.psi.psiUtil.endOffset -import java.util.concurrent.ConcurrentHashMap - -class KotlinCodeHintsModel(val project: Project) : EditorFactoryListener { - companion object { - fun getInstance(project: Project): KotlinCodeHintsModel = project.getServiceSafe() - } - - private class DocumentExtensionInfoModel(val document: Document) { - private val lineEndMarkers = ConcurrentHashMap() - - fun markEndOfLine(lineEndOffset: Int, hint: String) { - val endLineMarker = document.createRangeMarker(lineEndOffset, lineEndOffset) - endLineMarker.isGreedyToRight = true - - lineEndMarkers[endLineMarker] = hint - } - - fun getExtensionAtOffset(offset: Int): String? { - return runReadAction { - // Protect operations working with the document offsets - - lineEndMarkers - .entries - .firstOrNull { (marker, _) -> - val textRange = marker.range - if (textRange == null || !(textRange.startOffset <= offset && offset <= textRange.endOffset)) { - return@firstOrNull false - } - if (textRange.end > document.textLength) { - return@firstOrNull false - } - - val document = marker.document - val hasNewLine = document.getText(textRange).contains('\n') - if (!hasNewLine) { - textRange.endOffset == offset - } else { - // New line may appear after session of fast typing with one or several enter hitting. - // We can't believe startOffset too because typing session may had started with - // typing adding several chars at the original line. - val originalLineNumber = document.getLineNumber(textRange.startOffset) - val currentOriginalLineEnd = document.getLineEndOffset(originalLineNumber) - - currentOriginalLineEnd == offset - } - } - ?.value - } - } - - fun dispose() { - val keys = lineEndMarkers.keys() - ApplicationManager.getApplication().invokeLater { - for (marker in keys) { - marker.dispose() - } - } - } - } - - private val documentModels = - ContainerUtil.createConcurrentSoftMap() - - init { - val editorFactory = EditorFactory.getInstance() - editorFactory.addEditorFactoryListener(this, project) - } - - override fun editorReleased(event: EditorFactoryEvent) { - // Pass for other editor with the same document if present should re-add needed hints - removeAll(event.editor.document) - } - - fun getExtensionInfoAtOffset(editor: Editor): String? { - return getExtensionInfo(editor.document, editor.caretModel.offset) - } - - fun getExtensionInfo(document: Document, offset: Int): String? { - return documentModels[document]?.getExtensionAtOffset(offset) - } - - fun removeAll(document: Document) { - documentModels.remove(document)?.dispose() - } - - fun update(document: Document, actualHints: Map) { - if (actualHints.isEmpty()) { - removeAll(document) - return - } - - val updatedModel = runReadAction { - val model = DocumentExtensionInfoModel(document) - for ((element, hint) in actualHints) { - val lineNumber = document.getLineNumber(element.endOffset) - val lineEndOffset = document.getLineEndOffset(lineNumber) - - model.markEndOfLine(lineEndOffset, hint) - } - - model - } - - documentModels.put(document, updatedModel)?.dispose() - } -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/parameterInfo/custom/KotlinCodeHintsPass.kt b/idea/src/org/jetbrains/kotlin/idea/parameterInfo/custom/KotlinCodeHintsPass.kt deleted file mode 100644 index 36728c0b0eb..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/parameterInfo/custom/KotlinCodeHintsPass.kt +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.parameterInfo.custom - -import com.intellij.codeHighlighting.* -import com.intellij.codeInsight.hints.InlayParameterHintsExtension -import com.intellij.diff.util.DiffUtil -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.editor.ex.EditorSettingsExternalizable -import com.intellij.openapi.progress.ProgressIndicator -import com.intellij.openapi.project.Project -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiFile -import com.intellij.psi.SyntaxTraverser -import org.jetbrains.kotlin.idea.KotlinLanguage -import org.jetbrains.kotlin.idea.codeInsight.hints.HintType -import org.jetbrains.kotlin.idea.parameterInfo.TYPE_INFO_PREFIX -import org.jetbrains.kotlin.idea.parameterInfo.provideLambdaReturnValueHints -import org.jetbrains.kotlin.psi.KtExpression -import java.util.* - -class KotlinCodeHintsPass(private val myRootElement: PsiElement, editor: Editor) : - EditorBoundHighlightingPass(editor, myRootElement.containingFile, true) { - - private val myTraverser: SyntaxTraverser = SyntaxTraverser.psiTraverser(myRootElement) - - override fun doCollectInformation(progress: ProgressIndicator) { - if (myFile.language != KotlinLanguage.INSTANCE) return - if (myDocument == null) return - - val kotlinCodeHintsModel = KotlinCodeHintsModel.getInstance(myRootElement.project) - - val provider = InlayParameterHintsExtension.forLanguage(KotlinLanguage.INSTANCE) - if (provider == null || !provider.canShowHintsWhenDisabled() && !isEnabled || DiffUtil.isDiffEditor(myEditor)) { - kotlinCodeHintsModel.removeAll(myDocument) - return - } - - if (HintType.LAMBDA_RETURN_EXPRESSION.enabled) { - val actualHints = HashMap() - myTraverser.forEach { element -> processLambdaReturnHints(element, actualHints) } - - kotlinCodeHintsModel.update(myDocument, actualHints) - } else { - kotlinCodeHintsModel.removeAll(myDocument) - } - } - - private fun processLambdaReturnHints(element: PsiElement, actualElements: MutableMap) { - if (element !is KtExpression) return - - for (returnHint in provideLambdaReturnValueHints(element)) { - val offset = returnHint.offset - - if (!canShowHintsAtOffset(offset)) continue - - actualElements[element] = returnHint.text.substringAfter(TYPE_INFO_PREFIX) - } - } - - override fun doApplyInformationToEditor() { - // Information will be painted with org.jetbrains.kotlin.idea.parameterInfo.custom.ReturnHintLinePainter - } - - /** - * Adding hints on the borders of root element (at startOffset or endOffset) - * is allowed only in the case when root element is a document - * - * @return true iff a given offset can be used for hint rendering - */ - private fun canShowHintsAtOffset(offset: Int): Boolean { - val rootRange = myRootElement.textRange - - if (rootRange.startOffset < offset && offset < rootRange.endOffset) { - return true - } - - return myDocument != null && myDocument.textLength == rootRange.length - } - - - class Registrar : TextEditorHighlightingPassFactoryRegistrar { - override fun registerHighlightingPassFactory(registrar: TextEditorHighlightingPassRegistrar, project: Project) { - registrar.registerTextEditorHighlightingPass( - Factory(), - null, - null, - false, - -1 - ) - } - } - - class Factory : TextEditorHighlightingPassFactory { - override fun createHighlightingPass(file: PsiFile, editor: Editor): TextEditorHighlightingPass? { - if (file.language != KotlinLanguage.INSTANCE) return null - return KotlinCodeHintsPass(file, editor) - } - } - - companion object { - private val isEnabled: Boolean - get() = - EditorSettingsExternalizable.getInstance().isShowParameterNameHints - } -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/parameterInfo/custom/KotlinCodeHintsPass.kt.192 b/idea/src/org/jetbrains/kotlin/idea/parameterInfo/custom/KotlinCodeHintsPass.kt.192 deleted file mode 100644 index cfe735d2004..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/parameterInfo/custom/KotlinCodeHintsPass.kt.192 +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.parameterInfo.custom - -import com.intellij.codeHighlighting.EditorBoundHighlightingPass -import com.intellij.codeHighlighting.TextEditorHighlightingPass -import com.intellij.codeHighlighting.TextEditorHighlightingPassFactory -import com.intellij.codeHighlighting.TextEditorHighlightingPassRegistrar -import com.intellij.codeInsight.hints.InlayParameterHintsExtension -import com.intellij.diff.util.DiffUtil -import com.intellij.openapi.components.ProjectComponent -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.editor.ex.EditorSettingsExternalizable -import com.intellij.openapi.progress.ProgressIndicator -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiFile -import com.intellij.psi.SyntaxTraverser -import org.jetbrains.kotlin.idea.KotlinLanguage -import org.jetbrains.kotlin.idea.codeInsight.hints.HintType -import org.jetbrains.kotlin.idea.parameterInfo.TYPE_INFO_PREFIX -import org.jetbrains.kotlin.idea.parameterInfo.provideLambdaReturnValueHints -import org.jetbrains.kotlin.psi.KtExpression -import java.util.* - -class KotlinCodeHintsPass(private val myRootElement: PsiElement, editor: Editor) : - EditorBoundHighlightingPass(editor, myRootElement.containingFile, true) { - - private val myTraverser: SyntaxTraverser = SyntaxTraverser.psiTraverser(myRootElement) - - override fun doCollectInformation(progress: ProgressIndicator) { - if (myFile.language != KotlinLanguage.INSTANCE) return - if (myDocument == null) return - - val kotlinCodeHintsModel = KotlinCodeHintsModel.getInstance(myRootElement.project) - - val provider = InlayParameterHintsExtension.forLanguage(KotlinLanguage.INSTANCE) - if (provider == null || !provider.canShowHintsWhenDisabled() && !isEnabled || DiffUtil.isDiffEditor(myEditor)) { - kotlinCodeHintsModel.removeAll(myDocument) - return - } - - if (HintType.LAMBDA_RETURN_EXPRESSION.enabled) { - val actualHints = HashMap() - myTraverser.forEach { element -> processLambdaReturnHints(element, actualHints) } - - kotlinCodeHintsModel.update(myDocument, actualHints) - } else { - kotlinCodeHintsModel.removeAll(myDocument) - } - } - - private fun processLambdaReturnHints(element: PsiElement, actualElements: MutableMap) { - if (element !is KtExpression) return - - for (returnHint in provideLambdaReturnValueHints(element)) { - val offset = returnHint.offset - - if (!canShowHintsAtOffset(offset)) continue - - actualElements[element] = returnHint.text.substringAfter(TYPE_INFO_PREFIX) - } - } - - override fun doApplyInformationToEditor() { - // Information will be painted with org.jetbrains.kotlin.idea.parameterInfo.custom.ReturnHintLinePainter - } - - /** - * Adding hints on the borders of root element (at startOffset or endOffset) - * is allowed only in the case when root element is a document - * - * @return true iff a given offset can be used for hint rendering - */ - private fun canShowHintsAtOffset(offset: Int): Boolean { - val rootRange = myRootElement.textRange - - if (rootRange.startOffset < offset && offset < rootRange.endOffset) { - return true - } - - return myDocument != null && myDocument.textLength == rootRange.length - } - - companion object { - class Factory(registrar: TextEditorHighlightingPassRegistrar) : ProjectComponent, TextEditorHighlightingPassFactory { - init { - registrar.registerTextEditorHighlightingPass(this, null, null, false, -1) - } - - override fun createHighlightingPass(file: PsiFile, editor: Editor): TextEditorHighlightingPass? { - if (file.language != KotlinLanguage.INSTANCE) return null - return KotlinCodeHintsPass(file, editor) - } - } - - private val isEnabled: Boolean - get() = - EditorSettingsExternalizable.getInstance().isShowParameterNameHints - } -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/parameterInfo/custom/ReturnHintLinePainter.kt b/idea/src/org/jetbrains/kotlin/idea/parameterInfo/custom/ReturnHintLinePainter.kt deleted file mode 100644 index 215e3d63883..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/parameterInfo/custom/ReturnHintLinePainter.kt +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.parameterInfo.custom - -import com.intellij.openapi.editor.DefaultLanguageHighlighterColors -import com.intellij.openapi.editor.EditorLinePainter -import com.intellij.openapi.editor.LineExtensionInfo -import com.intellij.openapi.editor.colors.EditorColorsManager -import com.intellij.openapi.editor.markup.TextAttributes -import com.intellij.openapi.fileEditor.FileDocumentManager -import com.intellij.openapi.project.Project -import com.intellij.openapi.vfs.VirtualFile -import com.intellij.psi.PsiManager -import org.jetbrains.kotlin.idea.KotlinLanguage - -class ReturnHintLinePainter : EditorLinePainter() { - companion object { - val SPACE_LINE_EXTENSION_INFO = LineExtensionInfo(" ", TextAttributes()) - } - - override fun getLineExtensions(project: Project, file: VirtualFile, lineNumber: Int): List? { - if (!file.isValid) return null - - val psiFile = PsiManager.getInstance(project).findFile(file) ?: return null - if (psiFile.language != KotlinLanguage.INSTANCE) { - return null - } - - val hint = getLineHint(project, file, lineNumber) - ?: return null - - val textAttributes = - EditorColorsManager.getInstance().globalScheme.getAttributes(DefaultLanguageHighlighterColors.INLINE_PARAMETER_HINT) - val hintLineInfo = LineExtensionInfo(hint, textAttributes) - - return listOf(SPACE_LINE_EXTENSION_INFO, hintLineInfo) - } - - private fun getLineHint(project: Project, file: VirtualFile, lineNumber: Int): String? { - val doc = FileDocumentManager.getInstance().getDocument(file) ?: return null - if (lineNumber >= doc.lineCount) { - return null - } - val lineEndOffset = doc.getLineEndOffset(lineNumber) - - return KotlinCodeHintsModel.getInstance(project).getExtensionInfo(doc, lineEndOffset) - } -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/util/editors.kt b/idea/src/org/jetbrains/kotlin/idea/util/editors.kt deleted file mode 100644 index 526e25a9fdf..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/util/editors.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.util - -import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer -import com.intellij.codeInsight.hints.ParameterHintsPassFactory -import com.intellij.openapi.fileEditor.FileEditorManager -import com.intellij.openapi.project.ProjectManager -import com.intellij.psi.PsiManager - -fun refreshAllOpenEditors() { - ParameterHintsPassFactory.forceHintsUpdateOnNextPass(); - ProjectManager.getInstance().openProjects.forEach { project -> - val psiManager = PsiManager.getInstance(project) - val daemonCodeAnalyzer = DaemonCodeAnalyzer.getInstance(project) - val fileEditorManager = FileEditorManager.getInstance(project) - - DaemonCodeAnalyzer.getInstance(project).restart() - - fileEditorManager.selectedFiles.forEach { - psiManager.findFile(it)?.let { daemonCodeAnalyzer.restart(it) } - } - } -}