corrections after review: json schema performance fix, IDEA-157546 IDEA freeze during running inspection profile

This commit is contained in:
irengrig
2016-06-19 15:26:43 +02:00
parent 6cb4719710
commit bac90f20ff
2 changed files with 4 additions and 36 deletions
@@ -3,6 +3,7 @@ package com.jetbrains.jsonSchema;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VfsUtilCore;
@@ -137,8 +138,8 @@ public class JsonSchemaMappingsConfigurationBase implements PersistentStateCompo
private Matcher matcher = PatternUtil.fromMask(pattern.getPath()).matcher("");
@Override
public boolean process(VirtualFile file13) {
matcher.reset(file13.getName());
public boolean process(VirtualFile file) {
matcher.reset(file.getName());
return matcher.matches();
}
});
@@ -147,7 +148,7 @@ public class JsonSchemaMappingsConfigurationBase implements PersistentStateCompo
continue;
}
String path = pattern.getPath().replace('\\', '/');
final String path = FileUtilRt.toSystemIndependentName(pattern.getPath());
final List<String> parts = ContainerUtil.filter(path.split("/"), s -> !".".equals(s));
final VirtualFile relativeFile;
if (parts.isEmpty()) {
@@ -57,39 +57,6 @@ public class JsonSchemaImportedProviderFactory implements JsonSchemaProviderFact
myName = name;
myFile = file;
myPatterns = patterns;
/*for (final JsonSchemaMappingsConfigurationBase.Item pattern : patterns) {
if (pattern.isPattern()) {
myPatterns.add(new Processor<VirtualFile>() {
private Matcher matcher = PatternUtil.fromMask(pattern.getPath()).matcher("");
@Override
public boolean process(VirtualFile file) {
matcher.reset(file.getName());
return matcher.matches();
}
});
} else {
if (project == null || project.getBasePath() == null) {
continue;
}
String path = pattern.getPath().replace('\\', '/');
final List<String> parts = ContainerUtil.filter(path.split("/"), s -> !".".equals(s));
final VirtualFile relativeFile;
if (parts.isEmpty()) {
relativeFile = project.getBaseDir();
} else {
relativeFile = VfsUtil.findRelativeFile(project.getBaseDir(), ArrayUtil.toStringArray(parts));
if (relativeFile == null) continue;
}
if (pattern.isDirectory()) {
myPatterns.add(file12 -> VfsUtil.isAncestor(relativeFile, file12, true));
} else {
myPatterns.add(file1 -> relativeFile.equals(file1));
}
}
}*/
}
@Override