From cd2402244383013ee31faaeafbfba88214578660 Mon Sep 17 00:00:00 2001 From: Vojtech Balik Date: Tue, 30 Jun 2026 12:45:16 +0200 Subject: [PATCH] IJPL-196854 [editorconfig, remdev] move typing assist to common module Since FrontendOnly is now not used for these actions, the backend must agree to confirm frontend results. (cherry picked from commit 849056a994ec945a4d934daf44da52442104ac71) IJ-CR-218117 GitOrigin-RevId: fc525c8ae990678939226dc82aab2b444a90850d --- plugins/editorconfig/common/BUILD.bazel | 10 ++++++++++ .../common/intellij.editorconfig.common.iml | 5 +++++ .../common/resources/intellij.editorconfig.common.xml | 8 ++++++++ .../editor/EditorConfigMoveElementLeftRightHandler.kt | 2 +- .../src/editor/EditorConfigStatementUpDownMover.kt | 2 +- .../src/editor/EditorConfigTypedHandlerDelegate.kt | 2 +- .../src/editor/EnterInEditorConfigFileHandler.kt | 2 +- .../src/highlighting/EditorConfigSyntaxHighlighter.kt | 4 ++-- .../EditorConfigSyntaxHighlighterFactory.kt | 2 +- plugins/editorconfig/frontend/BUILD.bazel | 6 ++---- .../frontend/intellij.editorconfig.frontend.iml | 3 +-- .../resources/intellij.editorconfig.frontend.xml | 7 ------- .../src/highlighting/EditorConfigAnnotatorVisitor.kt | 7 +++++-- .../src/settings/EditorConfigColorSettingsPage.kt | 2 +- 14 files changed, 39 insertions(+), 23 deletions(-) rename plugins/editorconfig/{frontend => common}/src/editor/EditorConfigMoveElementLeftRightHandler.kt (94%) rename plugins/editorconfig/{frontend => common}/src/editor/EditorConfigStatementUpDownMover.kt (98%) rename plugins/editorconfig/{frontend => common}/src/editor/EditorConfigTypedHandlerDelegate.kt (98%) rename plugins/editorconfig/{frontend => common}/src/editor/EnterInEditorConfigFileHandler.kt (97%) rename plugins/editorconfig/{frontend => common}/src/highlighting/EditorConfigSyntaxHighlighter.kt (96%) rename plugins/editorconfig/{frontend => common}/src/highlighting/EditorConfigSyntaxHighlighterFactory.kt (91%) diff --git a/plugins/editorconfig/common/BUILD.bazel b/plugins/editorconfig/common/BUILD.bazel index f9d843f38289..372950dae620 100644 --- a/plugins/editorconfig/common/BUILD.bazel +++ b/plugins/editorconfig/common/BUILD.bazel @@ -22,6 +22,7 @@ jvm_library( visibility = ["//visibility:public"], deps = [ # do not sort, + "//platform/util-ex", "@lib//:kotlin-stdlib", "//platform/analysis-api:analysis", "//platform/core-api:core", @@ -32,6 +33,10 @@ jvm_library( "//platform/editor-ui-api:editor-ui", "//platform/code-style-api:codeStyle", "//platform/code-style-impl:codeStyle-impl", + "//platform/lang-api:lang", + "//platform/platform-impl:ide-impl", + "//platform/lang-impl", + "//platform/core-ui", ], ) @@ -47,6 +52,7 @@ jvm_library( runtime_deps = [ # do not sort, ":common", + "//platform/util-ex:util-ex_test_lib", "//platform/analysis-api:analysis_test_lib", "//platform/core-api:core_test_lib", "//platform/util:util_test_lib", @@ -56,6 +62,10 @@ jvm_library( "//platform/editor-ui-api:editor-ui_test_lib", "//platform/code-style-api:codeStyle_test_lib", "//platform/code-style-impl:codeStyle-impl_test_lib", + "//platform/lang-api:lang_test_lib", + "//platform/platform-impl:ide-impl_test_lib", + "//platform/lang-impl:lang-impl_test_lib", + "//platform/core-ui:core-ui_test_lib", ], ) ### auto-generated section `build intellij.editorconfig.common` end diff --git a/plugins/editorconfig/common/intellij.editorconfig.common.iml b/plugins/editorconfig/common/intellij.editorconfig.common.iml index c1b3171f9cc2..def6bcc7a0ee 100644 --- a/plugins/editorconfig/common/intellij.editorconfig.common.iml +++ b/plugins/editorconfig/common/intellij.editorconfig.common.iml @@ -8,6 +8,7 @@ + @@ -19,5 +20,9 @@ + + + + \ No newline at end of file diff --git a/plugins/editorconfig/common/resources/intellij.editorconfig.common.xml b/plugins/editorconfig/common/resources/intellij.editorconfig.common.xml index 1767bb9f7119..ac83db22b5ea 100644 --- a/plugins/editorconfig/common/resources/intellij.editorconfig.common.xml +++ b/plugins/editorconfig/common/resources/intellij.editorconfig.common.xml @@ -12,5 +12,13 @@ + + + + + + diff --git a/plugins/editorconfig/frontend/src/editor/EditorConfigMoveElementLeftRightHandler.kt b/plugins/editorconfig/common/src/editor/EditorConfigMoveElementLeftRightHandler.kt similarity index 94% rename from plugins/editorconfig/frontend/src/editor/EditorConfigMoveElementLeftRightHandler.kt rename to plugins/editorconfig/common/src/editor/EditorConfigMoveElementLeftRightHandler.kt index ba3386b20dfb..ec538efe8166 100644 --- a/plugins/editorconfig/frontend/src/editor/EditorConfigMoveElementLeftRightHandler.kt +++ b/plugins/editorconfig/common/src/editor/EditorConfigMoveElementLeftRightHandler.kt @@ -1,5 +1,5 @@ // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.editorconfig.frontend.editor +package com.intellij.editorconfig.common.editor import com.intellij.codeInsight.editorActions.moveLeftRight.MoveElementLeftRightHandler import com.intellij.editorconfig.common.syntax.psi.EditorConfigEnumerationPattern diff --git a/plugins/editorconfig/frontend/src/editor/EditorConfigStatementUpDownMover.kt b/plugins/editorconfig/common/src/editor/EditorConfigStatementUpDownMover.kt similarity index 98% rename from plugins/editorconfig/frontend/src/editor/EditorConfigStatementUpDownMover.kt rename to plugins/editorconfig/common/src/editor/EditorConfigStatementUpDownMover.kt index 32a86307d285..b7b3f642b009 100644 --- a/plugins/editorconfig/frontend/src/editor/EditorConfigStatementUpDownMover.kt +++ b/plugins/editorconfig/common/src/editor/EditorConfigStatementUpDownMover.kt @@ -1,5 +1,5 @@ // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.editorconfig.frontend.editor +package com.intellij.editorconfig.common.editor import com.intellij.codeInsight.editorActions.moveUpDown.LineMover import com.intellij.codeInsight.editorActions.moveUpDown.LineRange diff --git a/plugins/editorconfig/frontend/src/editor/EditorConfigTypedHandlerDelegate.kt b/plugins/editorconfig/common/src/editor/EditorConfigTypedHandlerDelegate.kt similarity index 98% rename from plugins/editorconfig/frontend/src/editor/EditorConfigTypedHandlerDelegate.kt rename to plugins/editorconfig/common/src/editor/EditorConfigTypedHandlerDelegate.kt index 71365c1f2144..c7821a3005c2 100644 --- a/plugins/editorconfig/frontend/src/editor/EditorConfigTypedHandlerDelegate.kt +++ b/plugins/editorconfig/common/src/editor/EditorConfigTypedHandlerDelegate.kt @@ -1,5 +1,5 @@ // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.editorconfig.frontend.editor +package com.intellij.editorconfig.common.editor import com.intellij.codeInsight.AutoPopupController import com.intellij.codeInsight.editorActions.TypedHandlerDelegate diff --git a/plugins/editorconfig/frontend/src/editor/EnterInEditorConfigFileHandler.kt b/plugins/editorconfig/common/src/editor/EnterInEditorConfigFileHandler.kt similarity index 97% rename from plugins/editorconfig/frontend/src/editor/EnterInEditorConfigFileHandler.kt rename to plugins/editorconfig/common/src/editor/EnterInEditorConfigFileHandler.kt index 645b872c9839..946c892a09e3 100644 --- a/plugins/editorconfig/frontend/src/editor/EnterInEditorConfigFileHandler.kt +++ b/plugins/editorconfig/common/src/editor/EnterInEditorConfigFileHandler.kt @@ -1,5 +1,5 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package com.intellij.editorconfig.frontend.editor +package com.intellij.editorconfig.common.editor import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate import com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate.Result diff --git a/plugins/editorconfig/frontend/src/highlighting/EditorConfigSyntaxHighlighter.kt b/plugins/editorconfig/common/src/highlighting/EditorConfigSyntaxHighlighter.kt similarity index 96% rename from plugins/editorconfig/frontend/src/highlighting/EditorConfigSyntaxHighlighter.kt rename to plugins/editorconfig/common/src/highlighting/EditorConfigSyntaxHighlighter.kt index 778ab548687e..12989079cdc5 100644 --- a/plugins/editorconfig/frontend/src/highlighting/EditorConfigSyntaxHighlighter.kt +++ b/plugins/editorconfig/common/src/highlighting/EditorConfigSyntaxHighlighter.kt @@ -1,5 +1,5 @@ // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.editorconfig.frontend.highlighting +package com.intellij.editorconfig.common.highlighting import com.intellij.editorconfig.common.plugin.EditorConfigLexerFactory import com.intellij.editorconfig.common.syntax.psi.EditorConfigElementTypes @@ -12,7 +12,7 @@ import com.intellij.openapi.fileTypes.SyntaxHighlighterBase import com.intellij.psi.TokenType import com.intellij.psi.tree.IElementType -internal object EditorConfigSyntaxHighlighter : SyntaxHighlighterBase() { +object EditorConfigSyntaxHighlighter : SyntaxHighlighterBase() { val SEPARATOR: TextAttributesKey = createTextAttributesKey("EDITORCONFIG_SEPARATOR", DefaultLanguageHighlighterColors.OPERATION_SIGN) val BRACE: TextAttributesKey = createTextAttributesKey("EDITORCONFIG_BRACE", DefaultLanguageHighlighterColors.BRACES) diff --git a/plugins/editorconfig/frontend/src/highlighting/EditorConfigSyntaxHighlighterFactory.kt b/plugins/editorconfig/common/src/highlighting/EditorConfigSyntaxHighlighterFactory.kt similarity index 91% rename from plugins/editorconfig/frontend/src/highlighting/EditorConfigSyntaxHighlighterFactory.kt rename to plugins/editorconfig/common/src/highlighting/EditorConfigSyntaxHighlighterFactory.kt index 2395453b9044..278d8897319c 100644 --- a/plugins/editorconfig/frontend/src/highlighting/EditorConfigSyntaxHighlighterFactory.kt +++ b/plugins/editorconfig/common/src/highlighting/EditorConfigSyntaxHighlighterFactory.kt @@ -1,5 +1,5 @@ // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.editorconfig.frontend.highlighting +package com.intellij.editorconfig.common.highlighting import com.intellij.openapi.fileTypes.SyntaxHighlighter import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory diff --git a/plugins/editorconfig/frontend/BUILD.bazel b/plugins/editorconfig/frontend/BUILD.bazel index a76264cadbea..ce9539c7aaed 100644 --- a/plugins/editorconfig/frontend/BUILD.bazel +++ b/plugins/editorconfig/frontend/BUILD.bazel @@ -27,12 +27,11 @@ jvm_library( "//platform/lang-api:lang", "//plugins/editorconfig/common", "//platform/util:util-ui", - "//platform/util-ex", "//platform/analysis-impl", - "//platform/platform-impl:ide-impl", "//platform/lang-impl", "//platform/core-ui", "//platform/platform-frontend:frontend", + "//platform/platform-api:ide", ], ) @@ -55,12 +54,11 @@ jvm_library( "//platform/lang-api:lang_test_lib", "//plugins/editorconfig/common:common_test_lib", "//platform/util:util-ui_test_lib", - "//platform/util-ex:util-ex_test_lib", "//platform/analysis-impl:analysis-impl_test_lib", - "//platform/platform-impl:ide-impl_test_lib", "//platform/lang-impl:lang-impl_test_lib", "//platform/core-ui:core-ui_test_lib", "//platform/platform-frontend:frontend_test_lib", + "//platform/platform-api:ide_test_lib", ], ) ### auto-generated section `build intellij.editorconfig.frontend` end diff --git a/plugins/editorconfig/frontend/intellij.editorconfig.frontend.iml b/plugins/editorconfig/frontend/intellij.editorconfig.frontend.iml index 718a3f067784..d163ef7003f8 100644 --- a/plugins/editorconfig/frontend/intellij.editorconfig.frontend.iml +++ b/plugins/editorconfig/frontend/intellij.editorconfig.frontend.iml @@ -15,11 +15,10 @@ - - + \ No newline at end of file diff --git a/plugins/editorconfig/frontend/resources/intellij.editorconfig.frontend.xml b/plugins/editorconfig/frontend/resources/intellij.editorconfig.frontend.xml index 32ada15160c8..d5987b19a385 100644 --- a/plugins/editorconfig/frontend/resources/intellij.editorconfig.frontend.xml +++ b/plugins/editorconfig/frontend/resources/intellij.editorconfig.frontend.xml @@ -4,16 +4,9 @@ - - - - - diff --git a/plugins/editorconfig/frontend/src/highlighting/EditorConfigAnnotatorVisitor.kt b/plugins/editorconfig/frontend/src/highlighting/EditorConfigAnnotatorVisitor.kt index ad6be9f777f7..d1fff79d0cd3 100644 --- a/plugins/editorconfig/frontend/src/highlighting/EditorConfigAnnotatorVisitor.kt +++ b/plugins/editorconfig/frontend/src/highlighting/EditorConfigAnnotatorVisitor.kt @@ -2,6 +2,7 @@ package com.intellij.editorconfig.frontend.highlighting import com.intellij.editorconfig.common.EditorConfigBundle +import com.intellij.editorconfig.common.highlighting.EditorConfigSyntaxHighlighter import com.intellij.editorconfig.common.syntax.psi.EditorConfigAsteriskPattern import com.intellij.editorconfig.common.syntax.psi.EditorConfigCharClassExclamation import com.intellij.editorconfig.common.syntax.psi.EditorConfigCharClassLetter @@ -139,8 +140,10 @@ internal class EditorConfigAnnotatorVisitor(private val holder: AnnotationHolder override fun visitCharClassLetter(letter: EditorConfigCharClassLetter): Unit = when { !letter.isEscape -> holder.newSilentAnnotation(HighlightSeverity.INFORMATION).range(letter).textAttributes(EditorConfigSyntaxHighlighter.PATTERN).create() - letter.isValidEscape -> holder.newSilentAnnotation(HighlightSeverity.INFORMATION).range(letter).textAttributes(EditorConfigSyntaxHighlighter.VALID_CHAR_ESCAPE).create() - else -> holder.newAnnotation(HighlightSeverity.INFORMATION, EditorConfigBundle["annotator.error.illegal.char.escape"]).range(letter).textAttributes(EditorConfigSyntaxHighlighter.INVALID_CHAR_ESCAPE).create() + letter.isValidEscape -> holder.newSilentAnnotation(HighlightSeverity.INFORMATION).range(letter).textAttributes( + EditorConfigSyntaxHighlighter.VALID_CHAR_ESCAPE).create() + else -> holder.newAnnotation(HighlightSeverity.INFORMATION, EditorConfigBundle["annotator.error.illegal.char.escape"]).range(letter).textAttributes( + EditorConfigSyntaxHighlighter.INVALID_CHAR_ESCAPE).create() } override fun visitRootDeclarationKey(key: EditorConfigRootDeclarationKey) { diff --git a/plugins/editorconfig/frontend/src/settings/EditorConfigColorSettingsPage.kt b/plugins/editorconfig/frontend/src/settings/EditorConfigColorSettingsPage.kt index c8e897abbdeb..915fc4ca76bc 100644 --- a/plugins/editorconfig/frontend/src/settings/EditorConfigColorSettingsPage.kt +++ b/plugins/editorconfig/frontend/src/settings/EditorConfigColorSettingsPage.kt @@ -3,7 +3,7 @@ package com.intellij.editorconfig.frontend.settings import com.intellij.editorconfig.common.EditorConfigBundle.get import com.intellij.editorconfig.common.plugin.EditorConfigFileType -import com.intellij.editorconfig.frontend.highlighting.EditorConfigSyntaxHighlighter +import com.intellij.editorconfig.common.highlighting.EditorConfigSyntaxHighlighter import com.intellij.icons.AllIcons import com.intellij.openapi.editor.colors.TextAttributesKey import com.intellij.openapi.fileTypes.SyntaxHighlighter