Do not detect indent for non-writable files (IDEA-135799)
authorYaroslav Lepenkin <yaroslav.lepenkin@jetbrains.com>
Fri, 30 Jan 2015 11:30:11 +0000 (14:30 +0300)
committerYaroslav Lepenkin <yaroslav.lepenkin@jetbrains.com>
Fri, 30 Jan 2015 11:31:15 +0000 (14:31 +0300)
platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java

index 5500558bcec2d796c90849f857f0acff14b48465..aebd6c663f66c74a8b24a91fa397c46bfc34d2fd 100644 (file)
@@ -694,7 +694,7 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea
   @NotNull
   public IndentOptions getIndentOptionsByFile(@Nullable PsiFile file, @Nullable TextRange formatRange, boolean ignoreDocOptions,
                                               @Nullable Processor<FileIndentOptionsProvider> providerProcessor) {
-    if (file != null && file.isValid()) {
+    if (file != null && file.isValid() && file.isWritable()) {
       boolean isFullReformat = isFileFullyCoveredByRange(file, formatRange);
       if (!ignoreDocOptions && !isFullReformat) {
         IndentOptions docOptions = IndentOptions.retrieveFromAssociatedDocument(file);