mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
CPP-44970 Enable ClangFormat without creating .clangformat file doesn't change status bar
GitOrigin-RevId: 7f6aa50f8cde121c03a3b36416a08cb9ce0ce662
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5f00a0b869
commit
0d0cd711bb
@@ -4,6 +4,7 @@ package com.intellij.psi.codeStyle.modifier;
|
|||||||
import com.intellij.application.options.CodeStyle;
|
import com.intellij.application.options.CodeStyle;
|
||||||
import com.intellij.openapi.fileTypes.FileType;
|
import com.intellij.openapi.fileTypes.FileType;
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
|
import com.intellij.openapi.util.Key;
|
||||||
import com.intellij.openapi.util.ModificationTracker;
|
import com.intellij.openapi.util.ModificationTracker;
|
||||||
import com.intellij.openapi.util.TextRange;
|
import com.intellij.openapi.util.TextRange;
|
||||||
import com.intellij.openapi.vfs.VirtualFile;
|
import com.intellij.openapi.vfs.VirtualFile;
|
||||||
@@ -93,19 +94,33 @@ public final class TransientCodeStyleSettings extends CodeStyleSettings {
|
|||||||
applyIndentOptionsFromProviders(file.getProject(), file.getVirtualFile());
|
applyIndentOptionsFromProviders(file.getProject(), file.getVirtualFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final Key<Boolean> INDENT_OPTIONS_APPLY_PROGRESS = Key.create("INDENT_OPTIONS_APPLY_PROGRESS");
|
||||||
|
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
public void applyIndentOptionsFromProviders(@NotNull Project project, @NotNull VirtualFile file) {
|
public void applyIndentOptionsFromProviders(@NotNull Project project, @NotNull VirtualFile file) {
|
||||||
for (FileIndentOptionsProvider provider : FileIndentOptionsProvider.EP_NAME.getExtensionList()) {
|
if (file.getUserData(INDENT_OPTIONS_APPLY_PROGRESS) != null) {
|
||||||
if (provider.useOnFullReformat()) {
|
return;
|
||||||
IndentOptions indentOptions = provider.getIndentOptions(project, this, file);
|
}
|
||||||
if (indentOptions != null) {
|
|
||||||
IndentOptions targetOptions = getIndentOptions(file.getFileType());
|
// ClsElementImpl.getIndentSize is called inside document generation procedure,
|
||||||
if (targetOptions != indentOptions) {
|
// which can trigger code style computation based on the document => Stack Overflow.
|
||||||
targetOptions.copyFrom(indentOptions);
|
file.putUserData(INDENT_OPTIONS_APPLY_PROGRESS, Boolean.TRUE);
|
||||||
|
try {
|
||||||
|
for (FileIndentOptionsProvider provider : FileIndentOptionsProvider.EP_NAME.getExtensionList()) {
|
||||||
|
if (provider.useOnFullReformat()) {
|
||||||
|
IndentOptions indentOptions = provider.getIndentOptions(project, this, file);
|
||||||
|
if (indentOptions != null) {
|
||||||
|
IndentOptions targetOptions = getIndentOptions(file.getFileType());
|
||||||
|
if (targetOptions != indentOptions) {
|
||||||
|
targetOptions.copyFrom(indentOptions);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
file.putUserData(INDENT_OPTIONS_APPLY_PROGRESS, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDependency(@NotNull ModificationTracker dependency) {
|
public void addDependency(@NotNull ModificationTracker dependency) {
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ internal class CodeStyleCachedValueProvider(val fileSupplier: Supplier<VirtualFi
|
|||||||
LOG.debug { "Created TransientCodeStyleSettings for ${file.name}" }
|
LOG.debug { "Created TransientCodeStyleSettings for ${file.name}" }
|
||||||
for (modifier in CodeStyleSettingsModifier.EP_NAME.extensionList) {
|
for (modifier in CodeStyleSettingsModifier.EP_NAME.extensionList) {
|
||||||
LOG.debug { "Modifying ${file.name}: ${modifier.javaClass.name}" }
|
LOG.debug { "Modifying ${file.name}: ${modifier.javaClass.name}" }
|
||||||
if (modifier.modifySettingsAndUiCustomization(modifiableSettings, psiFile)) {
|
if (modifier.modifySettingsAndUiCustomization(modifiableSettings, psiFile) || modifiableSettings.modifier != null) {
|
||||||
LOG.debug { "Modified ${file.name}: ${modifier.javaClass.name}" }
|
LOG.debug { "Modified ${file.name}: ${modifier.javaClass.name}" }
|
||||||
currSettings = modifiableSettings
|
currSettings = modifiableSettings
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user