use of com.intellij.psi.PsiFile in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoCompletionTest method testImportsPriority.
public void testImportsPriority() {
myFixture.addFileToProject("package/long/but/similar/path/test.go", "package pack");
myFixture.addFileToProject("package/very/long/path/test.go", "package pack");
myFixture.addFileToProject("package/middle/path/test.go", "package pack");
myFixture.addFileToProject("package/short/test.go", "package pack");
PsiFile testFile = myFixture.addFileToProject("package/long/but/similar/test.go", "package pack; import `package/<caret>`");
myFixture.configureFromExistingVirtualFile(testFile.getVirtualFile());
myFixture.completeBasic();
myFixture.assertPreferredCompletionItems(0, "package/long/but/similar/path", "package/short", "package/middle/path", "package/very/long/path");
}
use of com.intellij.psi.PsiFile in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoHighlightingTest method testMethodOnNonLocalTypeInTheSameDirectory.
public void testMethodOnNonLocalTypeInTheSameDirectory() {
myFixture.addFileToProject("method/foo.go", "package a; type H struct {}");
PsiFile psiFile = myFixture.addFileToProject("method/foo_test.go", "package a_test;\n" + "func (<error descr=\"Unresolved type 'H'\">H</error>) Hello() {}");
myFixture.configureFromExistingVirtualFile(psiFile.getVirtualFile());
myFixture.checkHighlighting();
}
use of com.intellij.psi.PsiFile in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoHighlightingTest method testDuplicatePackageImport.
public void testDuplicatePackageImport() {
myFixture.addFileToProject("pack/pack1.go", "package pack; func Foo() {}");
PsiFile file = myFixture.addFileToProject("pack3/pack3.go", "package main; import \"pack\"; import <error>\"pack\"</error>; func main() { pack.Foo() }");
myFixture.configureFromExistingVirtualFile(file.getVirtualFile());
myFixture.checkHighlighting();
}
use of com.intellij.psi.PsiFile in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoHighlightingTest method testDuplicatePackageAlias.
public void testDuplicatePackageAlias() {
myFixture.addFileToProject("pack1/pack1.go", "package pack1; func Foo() {}");
myFixture.addFileToProject("pack2/pack2.go", "package pack2");
PsiFile file = myFixture.addFileToProject("pack3/pack3.go", "package main; import p \"pack1\"; import <error>p \"pack2\"</error>; func main() { p.Foo() }");
myFixture.configureFromExistingVirtualFile(file.getVirtualFile());
myFixture.checkHighlighting();
}
use of com.intellij.psi.PsiFile in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoInvalidPackageImportInspectionTest method testImportPackageWithoutBuildableSource.
public void testImportPackageWithoutBuildableSource() {
PsiFile file = myFixture.addFileToProject("withSources/a.go", "package withSources");
myFixture.addFileToProject("withIgnoredFiles/a.go", "package documentation");
myFixture.addFileToProject("withIgnoredFiles/.b.go", "package withIgnoredFiles");
myFixture.addFileToProject("withIgnoredFiles/_b.go", "package withIgnoredFiles");
WriteCommandAction.runWriteCommandAction(myFixture.getProject(), () -> {
//noinspection ConstantConditions
file.getParent().getParent().createSubdirectory("withoutSources");
});
myFixture.configureByText("a.go", "package pack\n" + "import `withSources`\n" + "import <error descr=\"'/src/withIgnoredFiles' has no buildable Go source files\">`withIgnoredFiles`</error>\n" + "import <error descr=\"'/src/withoutSources' has no buildable Go source files\">`withoutSources`</error>\n" + "import <error descr=\"'/src/withoutSources' has no buildable Go source files\">_ `without<caret>Sources`</error>\n" + "import `unresolved`\n");
myFixture.checkHighlighting();
applySingleQuickFix(GoDeleteImportQuickFix.QUICK_FIX_NAME);
myFixture.checkResult("package pack\n" + "import `withSources`\n" + "import `withIgnoredFiles`\n" + "import `withoutSources`\n" + "import `unresolved`\n");
}
Aggregations