package com.intellij.bash.highlighting;

import com.intellij.bash.psi.BashFile;
import com.intellij.codeInsight.CodeInsightSettings;
import com.intellij.codeInsight.highlighting.HighlightUsagesHandlerBase;
import com.intellij.codeInsight.highlighting.HighlightUsagesHandlerFactoryBase;
import com.intellij.openapi.editor.Editor;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class BashOccurrencesHighlightingFactory extends HighlightUsagesHandlerFactoryBase {
  @Nullable
  @Override
  public HighlightUsagesHandlerBase createHighlightUsagesHandler(@NotNull Editor editor, @NotNull PsiFile file, @NotNull PsiElement target) {
    if (editor.isOneLineMode() ||
        !CodeInsightSettings.getInstance().HIGHLIGHT_IDENTIFIER_UNDER_CARET ||
        !(file instanceof BashFile)
    ) {
      return null;
    }
    return new BashOccurrencesHighlightUsagesHandler(editor, file);
  }
}

@@ -77,61 +77,8 @@
 le;%0A
-import com.intellij.codeInsight.CodeInsightSettings;%0A
 impo
@@ -690,12 +690,16 @@
     
-if (
+return !
 edit
@@ -721,100 +721,11 @@
 e() 
-%7C%7C%0A        !CodeInsightSettings.getInstance().HIGHLIGHT_IDENTIFIER_UNDER_CARET %7C%7C%0A        !(
+&& 
 file
@@ -748,53 +748,18 @@
 File
-)
 %0A    
-) %7B%0A      return null;%0A    %7D%0A    return
+    ?
  new
@@ -810,16 +810,31 @@
 r, file)
+%0A        : null
 ;%0A  %7D%0A%7D%0A

fix after review