CPP-44970 Enable ClangFormat without creating .clangformat file doesn't change status bar

- restore indent detection on front end


(cherry picked from commit 2f63fe3ddf5e6be30baded169f43bc7bcb2ac5d2)

IJ-CR-170723

GitOrigin-RevId: 0ff44b51b185c64ad83a14dff300dc219de773d0
This commit is contained in:
Alexey Utkin
2025-06-24 22:32:09 +04:00
committed by intellij-monorepo-bot
parent 5a7dd9c1d2
commit 742bef79da
5 changed files with 15 additions and 2 deletions

View File

@@ -28,6 +28,7 @@ c:com.intellij.psi.codeStyle.PackageEntry
- *sf:ALL_MODULE_IMPORTS:com.intellij.psi.codeStyle.PackageEntry
*:com.intellij.psi.codeStyle.modifier.CodeStyleSettingsModifier
- sf:EP_NAME:com.intellij.openapi.extensions.ExtensionPointName
- acceptsFileIndentOptionsProviders():Z
- getActivatingAction(com.intellij.psi.codeStyle.modifier.CodeStyleStatusBarUIContributor,com.intellij.psi.PsiFile):com.intellij.openapi.actionSystem.AnAction
- getDisablingFunction(com.intellij.openapi.project.Project):java.util.function.Consumer
- a:getName():java.lang.String

View File

@@ -91,4 +91,9 @@ public interface CodeStyleSettingsModifier {
default @Nullable AnAction getActivatingAction(@Nullable CodeStyleStatusBarUIContributor activeUiContributor, @NotNull PsiFile file) {
return null;
}
/**
* @return {@code true} if the modifier accepts file indent providers, {@code false} otherwise.
*/
default boolean acceptsFileIndentOptionsProviders() { return false; }
}

View File

@@ -73,11 +73,15 @@ public final class TransientCodeStyleSettings extends CodeStyleSettings {
@Override
public @NotNull IndentOptions getIndentOptionsByFile(@NotNull Project project,
@Nullable VirtualFile file,
@NotNull VirtualFile file,
@Nullable TextRange formatRange,
boolean ignoreDocOptions,
@Nullable Processor<? super FileIndentOptionsProvider> providerProcessor) {
if (file != null && file.isValid()) {
if (myModifier != null && myModifier.acceptsFileIndentOptionsProviders()) {
return super.getIndentOptionsByFile(project, file, formatRange, ignoreDocOptions, providerProcessor);
}
if (file.isValid()) {
FileType fileType = file.getFileType();
return getIndentOptions(fileType);
}

View File

@@ -802,6 +802,7 @@ f:com.intellij.platform.ide.documentation.ActionsKt
*f:com.intellij.psi.codeStyle.DetectableIndentSettingsModifier
- com.intellij.psi.codeStyle.modifier.CodeStyleSettingsModifier
- <init>():V
- acceptsFileIndentOptionsProviders():Z
- getDisablingFunction(com.intellij.openapi.project.Project):java.util.function.Consumer
- getName():java.lang.String
- getStatusBarUiContributor(com.intellij.psi.codeStyle.modifier.TransientCodeStyleSettings):com.intellij.psi.codeStyle.modifier.CodeStyleStatusBarUIContributor

View File

@@ -35,4 +35,6 @@ class DetectableIndentSettingsModifier : CodeStyleSettingsModifier {
override fun getStatusBarUiContributor(transientSettings: TransientCodeStyleSettings): CodeStyleStatusBarUIContributor? = null
override fun mayOverrideSettingsOf(project: Project): Boolean = CodeStyle.getSettings(project).AUTODETECT_INDENTS
override fun acceptsFileIndentOptionsProviders(): Boolean = true
}