IDEA-89222 Navigate file shall accept files names/path starting with ./

This commit is contained in:
peter
2016-05-02 08:58:55 +02:00
parent bec69e85bc
commit 2f486ed36c
2 changed files with 12 additions and 0 deletions
@@ -15,6 +15,7 @@
*/
package com.intellij.navigation
import com.intellij.ide.actions.GotoFileItemProvider
import com.intellij.ide.util.gotoByName.*
import com.intellij.lang.java.JavaLanguage
import com.intellij.openapi.Disposable
@@ -166,6 +167,13 @@ class Intf {
}
public void "test accept file paths starting with a dot"() {
def file = myFixture.addFileToProject("foo/index.html", "foo")
def model = new GotoFileModel(project)
def popup = ChooseByNamePopup.createPopup(project, model, new GotoFileItemProvider(project, null, model))
assert calcPopupElements(popup, "./foo/in") == [file]
}
public void "test goto file can go to dir"() {
PsiFile fooIndex = myFixture.addFileToProject("foo/index.html", "foo")
PsiFile barIndex = myFixture.addFileToProject("bar.txt/bar.txt", "foo")
@@ -67,6 +67,10 @@ public class GotoFileItemProvider extends DefaultChooseByNameItemProvider {
}
}
if (pattern.startsWith("./") || pattern.startsWith(".\\")) {
pattern = pattern.substring(1);
}
return super.filterElements(base, pattern, everywhere, indicator, consumer);
}
}