From 31a170f34209fd42d5471f286c4a0ee775f22155 Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Wed, 20 Mar 2019 15:52:34 +0300 Subject: [PATCH] IDEA-207230 Tab width in Definition window differs from tab width in editor --- .../codeInsight/hint/ImplementationViewComponent.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hint/ImplementationViewComponent.java b/platform/lang-impl/src/com/intellij/codeInsight/hint/ImplementationViewComponent.java index 05819d966cbd..bb9f5e039cb9 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/hint/ImplementationViewComponent.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/hint/ImplementationViewComponent.java @@ -1,6 +1,7 @@ // 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.codeInsight.hint; +import com.intellij.application.options.CodeStyle; import com.intellij.codeInsight.CodeInsightBundle; import com.intellij.find.FindUtil; import com.intellij.icons.AllIcons; @@ -346,6 +347,12 @@ public class ImplementationViewComponent extends JPanel { fragmentDoc.replaceString(0, fragmentDoc.getTextLength(), newText); fragmentDoc.setReadOnly(true); + + PsiElement element = elt.getElementForShowUsages(); + PsiFile file = element == null ? null : element.getContainingFile(); + myEditor.getSettings().setTabSize(file != null ? CodeStyle.getIndentOptions(file).TAB_SIZE + : CodeStyle.getSettings(elt.getProject()).getTabSize(null)); + myEditor.getCaretModel().moveToOffset(0); myEditor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE); });