Skip to content

Commit

Permalink
Add HTML exclusion for Erlang SDK indexing
Browse files Browse the repository at this point in the history
Implemented ErlangExcludeHtmlFileIndexContributor to exclude HTML files from Erlang SDK indexing, enhancing indexing speed and efficiency. Registered this contributor in ErlangPlugin.xml.

fix #1038, fix #1036
  • Loading branch information
ignatov committed Aug 20, 2024
1 parent 83d5e1e commit 4e3c38c
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.util.SystemInfo;
Expand All @@ -49,7 +50,6 @@

public class ErlangDialyzerExternalAnnotator extends ExternalAnnotator<ErlangDialyzerExternalAnnotator.State, ErlangDialyzerExternalAnnotator.State> {
private final static Logger LOG = Logger.getInstance(ErlangDialyzerExternalAnnotator.class);
private static final NotificationGroup NOTIFICATION_GROUP = NotificationGroup.logOnlyGroup("Dialyzer-based inspections");

@Nullable
private static Problem parseProblem(String input) {
Expand Down Expand Up @@ -82,7 +82,7 @@ public State collectInformation(@NotNull PsiFile file) {

String currentPltPath = DialyzerSettings.getInstance(file.getProject()).getCurrentPltPath();

return new State(dialyzerPath, currentPltPath, canonicalPath, workingDir);
return new State(file.getProject(), dialyzerPath, currentPltPath, canonicalPath, workingDir);
}

@Nullable
Expand All @@ -103,7 +103,9 @@ public State doAnnotate(State state) {
for (String line : output.getStdoutLines()) {
LOG.debug(line);
if (line.startsWith("dialyzer: ")) {
NOTIFICATION_GROUP.createNotification(line, NotificationType.WARNING).notify(null); // todo: get a project
NotificationGroup.logOnlyGroup("Dialyzer-based inspections")
.createNotification(line, NotificationType.WARNING)
.notify(state.myProject);
return state;
}
Problem problem = parseProblem(line);
Expand Down Expand Up @@ -166,12 +168,14 @@ public String toString() {

public static class State {
public final List<Problem> problems = new ArrayList<>();
private final Project myProject;
private final String myDialyzerPath;
private final String myCurrentPltPath;
private final String myFilePath;
private final String myWorkingDir;

public State(String dialyzerPath, String currentPltPath, String filePath, String workingDir) {
public State(Project project, String dialyzerPath, String currentPltPath, String filePath, String workingDir) {
myProject = project;
myDialyzerPath = dialyzerPath;
myCurrentPltPath = currentPltPath;
myFilePath = filePath;
Expand Down

0 comments on commit 4e3c38c

Please sign in to comment.