mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
corrections after review: json schema performance fix, IDEA-157546 IDEA freeze during running inspection profile
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user