CodeStyleSettings (@NotNull PsiFile file) { final Project project = file.getProject(); CodeStyleSettingsManager settingsManager = CodeStyleSettingsManager.getInstance(project); CodeStyleSettings localSettings = settingsManager.getLocalSettings(); if (localSettings != null) { return localSettings; } @SuppressWarnings("TestOnlyProblems") CodeStyleSettings tempSettings = settingsManager.getTemporarySettings(); if (tempSettings != null) { return tempSettings; } PsiFile settingsFile = getSettingsPsi(file); if (settingsFile == null) { return getSettings(project); } VirtualFile virtualFile = settingsFile.getVirtualFile(); if (virtualFile == null) { return getSettings(project); } CodeStyleSettings cachedSettings = CodeStyleCachingService.getInstance(project).tryGetSettings(virtualFile); return cachedSettings != null ? cachedSettings : getSettings(project); }