IJPL-189492 Revert "[json] IJPL-159355 Dynamically disable editor-related extensions that can not be disabled via split mode-specific API"

This reverts commit 6a65082a

Editor actions performed on frontend only break Undo manager - it cannot properly process the changes that happened only on the frontend.
Until it's supported, we need to perform editor actions on both sides, thus I'm reverting the change that doesn't allow that

GitOrigin-RevId: 3e3b29c154cb55ff62d6171ed628ba5f36172d13
This commit is contained in:
Kate Botsman
2025-06-10 17:33:01 +02:00
committed by intellij-monorepo-bot
parent 9f1ea0de0c
commit a8f82110c9
6 changed files with 5 additions and 38 deletions

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// 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.json;
import com.intellij.codeInsight.editorActions.MultiCharQuoteHandler;
@@ -18,7 +18,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import static com.intellij.json.JsonTokenSets.STRING_LITERALS;
import static com.intellij.json.split.JsonBackendExtensionSuppressorKt.shouldDoNothingInBackendMode;
/**
* @author Mikhail Golubev
@@ -30,8 +29,6 @@ public final class JsonQuoteHandler extends SimpleTokenSetQuoteHandler implement
@Override
public @Nullable CharSequence getClosingQuote(@NotNull HighlighterIterator iterator, int offset) {
if (shouldDoNothingInBackendMode()) return null;
final IElementType tokenType = iterator.getTokenType();
if (tokenType == TokenType.WHITE_SPACE) {
final int index = iterator.getStart() - 1;

View File

@@ -21,8 +21,6 @@ import com.intellij.psi.tree.IElementType;
import com.intellij.util.ObjectUtils;
import org.jetbrains.annotations.NotNull;
import static com.intellij.json.split.JsonBackendExtensionSuppressorKt.shouldDoNothingInBackendMode;
public final class JsonEnterHandler implements EnterHandlerDelegate {
@Override
public Result preprocessEnter(@NotNull PsiFile file,
@@ -31,7 +29,7 @@ public final class JsonEnterHandler implements EnterHandlerDelegate {
@NotNull Ref<Integer> caretAdvanceRef,
@NotNull DataContext dataContext,
EditorActionHandler originalHandler) {
if (shouldDoNothingInBackendMode() || !JsonEditorOptions.getInstance().COMMA_ON_ENTER) {
if (!JsonEditorOptions.getInstance().COMMA_ON_ENTER) {
return Result.Continue;
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// 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.json.editor.lineMover;
import com.intellij.codeInsight.editorActions.moveUpDown.LineMover;
@@ -16,8 +16,6 @@ import com.intellij.psi.util.PsiTreeUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import static com.intellij.json.split.JsonBackendExtensionSuppressorKt.shouldDoNothingInBackendMode;
public final class JsonLineMover extends LineMover {
private enum Direction {
Same,
@@ -29,8 +27,6 @@ public final class JsonLineMover extends LineMover {
@Override
public boolean checkAvailable(@NotNull Editor editor, @NotNull PsiFile file, @NotNull MoveInfo info, boolean down) {
if (shouldDoNothingInBackendMode()) return false;
myDirection = Direction.Same;
if (!(file instanceof JsonFile) || !super.checkAvailable(editor, file, info, down)) {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// 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.json.editor.smartEnter;
import com.intellij.json.JsonDialectUtil;
@@ -7,7 +7,6 @@ import com.intellij.lang.SmartEnterProcessorWithFixers;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
@@ -21,7 +20,6 @@ import java.util.List;
import static com.intellij.json.JsonElementTypes.COLON;
import static com.intellij.json.JsonElementTypes.COMMA;
import static com.intellij.json.split.JsonBackendExtensionSuppressorKt.shouldDoNothingInBackendMode;
/**
* This processor allows
@@ -42,12 +40,6 @@ public final class JsonSmartEnterProcessor extends SmartEnterProcessorWithFixers
addEnterProcessors(new JsonEnterProcessor());
}
@Override
public boolean process(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile psiFile) {
if (shouldDoNothingInBackendMode()) return true;
return super.process(project, editor, psiFile);
}
@Override
protected void collectAdditionalElements(@NotNull PsiElement element, @NotNull List<PsiElement> result) {
// include all parents as well

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// 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.json.formatter;
import com.intellij.formatting.*;
@@ -8,13 +8,10 @@ import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
import org.jetbrains.annotations.NotNull;
import static com.intellij.json.JsonElementTypes.*;
import static com.intellij.json.split.JsonBackendExtensionSuppressorKt.shouldDoNothingInBackendMode;
public final class JsonFormattingBuilderModel implements FormattingModelBuilder {
@Override
public @NotNull FormattingModel createModel(@NotNull FormattingContext formattingContext) {
if (shouldDoNothingInBackendMode()) return Formatter.getInstance().createDummyFormattingModel(formattingContext.getPsiElement());
CodeStyleSettings settings = formattingContext.getCodeStyleSettings();
JsonCodeStyleSettings customSettings = settings.getCustomSettings(JsonCodeStyleSettings.class);
SpacingBuilder spacingBuilder = createSpacingBuilder(settings);

View File

@@ -1,13 +0,0 @@
package com.intellij.json.split
import com.intellij.idea.AppMode
/**
* Checks whether the application is running in backend mode.
* The function is used to suppress extensions available both on the backend and frontend sides in remote development.
*
* @return true if the application is in backend mode, false otherwise.
*/
internal fun shouldDoNothingInBackendMode(): Boolean {
return AppMode.isRemoteDevHost()
}