From 3b4071b79b7c508d34e112dfe533ae475356f630 Mon Sep 17 00:00:00 2001 From: Dennis Ushakov Date: Fri, 21 Nov 2014 20:39:25 +0300 Subject: [PATCH] reuse settings from filetype when possible #WEB-14236 fixed --- .../EditorConfigIndentOptionsProvider.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/editorconfig/src/org/editorconfig/configmanagement/EditorConfigIndentOptionsProvider.java b/plugins/editorconfig/src/org/editorconfig/configmanagement/EditorConfigIndentOptionsProvider.java index 5ec4f102ac03..273b11e223d2 100644 --- a/plugins/editorconfig/src/org/editorconfig/configmanagement/EditorConfigIndentOptionsProvider.java +++ b/plugins/editorconfig/src/org/editorconfig/configmanagement/EditorConfigIndentOptionsProvider.java @@ -38,18 +38,19 @@ public class EditorConfigIndentOptionsProvider extends FileIndentOptionsProvider final SettingsProviderComponent settingsProvider = SettingsProviderComponent.getInstance(); final List outPairs = settingsProvider.getOutPairs(project, filePath); // Apply editorconfig settings for the current editor - return applyCodeStyleSettings(project, outPairs, file); + return applyCodeStyleSettings(project, outPairs, file, settings); } private static CommonCodeStyleSettings.IndentOptions applyCodeStyleSettings(Project project, final List outPairs, - final VirtualFile file) { + final VirtualFile file, + final CodeStyleSettings settings) { // Apply indent options final String indentSize = Utils.configValueForKey(outPairs, indentSizeKey); final String continuationIndentSize = Utils.configValueForKey(outPairs, continuationSizeKey); final String tabWidth = Utils.configValueForKey(outPairs, tabWidthKey); final String indentStyle = Utils.configValueForKey(outPairs, indentStyleKey); - final CommonCodeStyleSettings.IndentOptions indentOptions = new CommonCodeStyleSettings.IndentOptions(); + final CommonCodeStyleSettings.IndentOptions indentOptions = (CommonCodeStyleSettings.IndentOptions)settings.getIndentOptions(file.getFileType()).clone(); if (applyIndentOptions(project, indentOptions, indentSize, continuationIndentSize, tabWidth, indentStyle, file.getCanonicalPath())) { return indentOptions; }