Skip to content

Commit

Permalink
Disabled checking for scratch files
Browse files Browse the repository at this point in the history
#CAMELCADE-1071
  • Loading branch information
hurricup committed Aug 29, 2018
1 parent 0a1d3e4 commit 50c5faf
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.perl5.lang.perl.idea.editor.notification;

import com.intellij.ide.plugins.PluginManagerConfigurableProxy;
import com.intellij.ide.scratch.ScratchUtil;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.fileTypes.FileNameMatcher;
import com.intellij.openapi.fileTypes.FileType;
Expand Down Expand Up @@ -61,20 +62,19 @@ public Key<EditorNotificationPanel> getKey() {
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
PerlLocalSettings perlLocalSettings = PerlLocalSettings.getInstance(myProject);
if (perlLocalSettings.DISABLE_ASSOCIATIONS_CHECKING) {
//return null;
if (perlLocalSettings.DISABLE_ASSOCIATIONS_CHECKING || ScratchUtil.isScratch(file)) {
return null;
}


Optional<Map.Entry<FileNameMatcher, FileType>> matchedEntry =
PERL_FILE_TYPES.entrySet().stream().filter(entry -> entry.getKey().accept(file.getName())).findFirst();
if (matchedEntry == null || !matchedEntry.isPresent()) {
//return null;
return null;
}

FileType expectedType = matchedEntry.get().getValue();
if (file.getFileType() == expectedType) {
//return null;
return null;
}

EditorNotificationPanel panel = new EditorNotificationPanel();
Expand Down

0 comments on commit 50c5faf

Please sign in to comment.