mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Additional line number pattern matching for the Open File Dialog (TreeFileChooserDialog), # and ?l= are now matched covering web source code viewers such as
Chromium: https://cs.chromium.org/chromium/src/apps/app_restore_service_factory.cc?l=15 and Android: https://android.googlesource.com/device/sample/+/master/apps/LeanbackCustomizer/src/com/google/android/leanbacklauncher/partnercustomizer/PartnerReceiver.java#100 Some more context/ additional improvement on: https://youtrack.jetbrains.com/issue/IDEA-162418
This commit is contained in:
@@ -242,6 +242,7 @@ class Intf {
|
||||
assert getPopupElements(model, 'Bar at line 2') == [file]
|
||||
assert getPopupElements(model, 'Bar 2:39') == [file]
|
||||
assert getPopupElements(model, 'Bar#L2') == [file]
|
||||
assert getPopupElements(model, 'Bar?l=2') == [file]
|
||||
}
|
||||
|
||||
void "test dollar"() {
|
||||
|
||||
@@ -340,7 +340,7 @@ public class ChooseByNamePopup extends ChooseByNameBase implements ChooseByNameP
|
||||
}
|
||||
|
||||
private static final Pattern patternToDetectLinesAndColumns = Pattern.compile("(.+?)" + // name, non-greedy matching
|
||||
"(?::|@|,| |#L| on line | at line |:?\\(|:?\\[)" + // separator
|
||||
"(?::|@|,| |#|#L|\\?l=| on line | at line |:?\\(|:?\\[)" + // separator
|
||||
"(\\d+)(?:(?:\\D)(\\d+)?)?" + // line + column
|
||||
"[)\\]]?" // possible closing paren/brace
|
||||
);
|
||||
@@ -355,7 +355,7 @@ public class ChooseByNamePopup extends ChooseByNameBase implements ChooseByNameP
|
||||
|
||||
public static String getTransformedPattern(String pattern, ChooseByNameModel model) {
|
||||
Pattern regex = null;
|
||||
if (StringUtil.containsAnyChar(pattern, ":,;@[( #") || pattern.contains(" line ")) { // quick test if reg exp should be used
|
||||
if (StringUtil.containsAnyChar(pattern, ":,;@[( #") || pattern.contains(" line ") || pattern.contains("?l=")) { // quick test if reg exp should be used
|
||||
regex = patternToDetectLinesAndColumns;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user