mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 11:20:44 +07:00
IJPL-159657 Fix performance issue with UrlFilter
After b77168e2 (related to KTIJ-29334), Url filter started using url filter each time, even if file url is present. That makes the performance test of this filter with only file urls slower. Here I've added some checks before using an expensive URL filter ^IJPL-159657 Fixed GitOrigin-RevId: 30651ed33375244feb9e34173c6162387241360c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
49f724bc6f
commit
0a5b243b28
@@ -59,7 +59,9 @@ public class UrlFilter implements Filter, DumbAware {
|
||||
resultList.addAll(findMatchingItems(line, URLUtil.FILE_URL_PATTERN, textStartOffset));
|
||||
}
|
||||
|
||||
resultList.addAll(findMatchingItems(line, URLUtil.URL_PATTERN, textStartOffset));
|
||||
if (isPotentialUrl(line)) {
|
||||
resultList.addAll(findMatchingItems(line, URLUtil.URL_PATTERN, textStartOffset));
|
||||
}
|
||||
|
||||
if (resultList.isEmpty()) {
|
||||
return null;
|
||||
@@ -73,6 +75,14 @@ public class UrlFilter implements Filter, DumbAware {
|
||||
return new Result(resultList);
|
||||
}
|
||||
|
||||
private static boolean isPotentialUrl(String input) {
|
||||
return input.contains("www") ||
|
||||
input.contains("http") ||
|
||||
input.contains("mailto") ||
|
||||
input.contains("ftp") ||
|
||||
input.contains("news");
|
||||
}
|
||||
|
||||
protected @NotNull HyperlinkInfo buildHyperlinkInfo(@NotNull String url) {
|
||||
HyperlinkInfo fileHyperlinkInfo = buildFileHyperlinkInfo(url);
|
||||
return fileHyperlinkInfo != null ? fileHyperlinkInfo : new OpenUrlHyperlinkInfo(url);
|
||||
|
||||
Reference in New Issue
Block a user