Search in sources :

Example 36 with BuildFile

use of com.google.idea.blaze.base.lang.buildfile.psi.BuildFile in project intellij by bazelbuild.

the class LoadStatementAnnotatorTest method testNoWarningsInExternalLoad.

@Test
public void testNoWarningsInExternalLoad() {
    BuildFile file = createBuildFile(new WorkspacePath("java/com/google/BUILD"), "load('@tools//ide:build_test.bzl', 'build_test')");
    assertNoAnnotations(file);
}
Also used : BuildFile(com.google.idea.blaze.base.lang.buildfile.psi.BuildFile) WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) Test(org.junit.Test)

Example 37 with BuildFile

use of com.google.idea.blaze.base.lang.buildfile.psi.BuildFile in project intellij by bazelbuild.

the class LoadStatementAnnotatorTest method testNoWarningsInNormalLoad.

@Test
public void testNoWarningsInNormalLoad() {
    BuildFile file = createBuildFile(new WorkspacePath("java/com/google/BUILD"), "load('//tools/ide/build_test.bzl', 'build_test')", "load(':local_file.bzl', 'symbol')");
    assertNoAnnotations(file);
}
Also used : BuildFile(com.google.idea.blaze.base.lang.buildfile.psi.BuildFile) WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) Test(org.junit.Test)

Example 38 with BuildFile

use of com.google.idea.blaze.base.lang.buildfile.psi.BuildFile in project intellij by bazelbuild.

the class DeprecatedLoadQuickFixTest method testRelativeLoadStatementUntouched.

@Test
public void testRelativeLoadStatementUntouched() {
    workspace.createPsiFile(new WorkspacePath("foo/bar/build_defs.bzl"));
    BuildFile file = createBuildFile(new WorkspacePath("foo/bar/BUILD"), "load(':build_defs.bzl', 'symbol')");
    StringLiteral string = PsiUtils.findFirstChildOfClassRecursive(file, StringLiteral.class);
    String prevString = string.getStringContents();
    applyQuickFix(string);
    assertThat(string.getStringContents()).isEqualTo(prevString);
}
Also used : WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) BuildFile(com.google.idea.blaze.base.lang.buildfile.psi.BuildFile) StringLiteral(com.google.idea.blaze.base.lang.buildfile.psi.StringLiteral) Test(org.junit.Test)

Example 39 with BuildFile

use of com.google.idea.blaze.base.lang.buildfile.psi.BuildFile in project intellij by bazelbuild.

the class DeprecatedLoadQuickFixTest method testNormalLoadStatementUntouched.

@Test
public void testNormalLoadStatementUntouched() {
    workspace.createPsiFile(new WorkspacePath("foo/bar/BUILD"));
    workspace.createPsiFile(new WorkspacePath("foo/bar/build_defs.bzl"));
    BuildFile file = createBuildFile(new WorkspacePath("java/com/google/BUILD"), "load('//foo/bar:build_defs.bzl', 'symbol')");
    StringLiteral string = PsiUtils.findFirstChildOfClassRecursive(file, StringLiteral.class);
    String prevString = string.getStringContents();
    applyQuickFix(string);
    assertThat(string.getStringContents()).isEqualTo(prevString);
}
Also used : WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) BuildFile(com.google.idea.blaze.base.lang.buildfile.psi.BuildFile) StringLiteral(com.google.idea.blaze.base.lang.buildfile.psi.StringLiteral) Test(org.junit.Test)

Example 40 with BuildFile

use of com.google.idea.blaze.base.lang.buildfile.psi.BuildFile in project intellij by bazelbuild.

the class RenameRefactoringTest method testRenameSuggestionForBuildFile.

@Test
public void testRenameSuggestionForBuildFile() {
    BuildFile buildFile = createBuildFile(new WorkspacePath("java/com/google/BUILD"));
    RenamePsiElementProcessor processor = RenamePsiElementProcessor.forElement(buildFile);
    RenameDialog dialog = processor.createRenameDialog(getProject(), buildFile, buildFile, null);
    String[] suggestions = dialog.getSuggestedNames();
    assertThat(suggestions[0]).isEqualTo("BUILD");
}
Also used : BuildFile(com.google.idea.blaze.base.lang.buildfile.psi.BuildFile) WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) RenamePsiElementProcessor(com.intellij.refactoring.rename.RenamePsiElementProcessor) RenameDialog(com.intellij.refactoring.rename.RenameDialog) Test(org.junit.Test)

Aggregations

BuildFile (com.google.idea.blaze.base.lang.buildfile.psi.BuildFile)216 WorkspacePath (com.google.idea.blaze.base.model.primitives.WorkspacePath)197 Test (org.junit.Test)196 Editor (com.intellij.openapi.editor.Editor)46 FuncallExpression (com.google.idea.blaze.base.lang.buildfile.psi.FuncallExpression)37 PsiReference (com.intellij.psi.PsiReference)32 PsiElement (com.intellij.psi.PsiElement)27 PsiFile (com.intellij.psi.PsiFile)27 StringLiteral (com.google.idea.blaze.base.lang.buildfile.psi.StringLiteral)18 FunctionStatement (com.google.idea.blaze.base.lang.buildfile.psi.FunctionStatement)17 GlobExpression (com.google.idea.blaze.base.lang.buildfile.psi.GlobExpression)16 LookupElement (com.intellij.codeInsight.lookup.LookupElement)13 Argument (com.google.idea.blaze.base.lang.buildfile.psi.Argument)10 TargetExpression (com.google.idea.blaze.base.lang.buildfile.psi.TargetExpression)8 Nullable (javax.annotation.Nullable)8 ReferenceExpression (com.google.idea.blaze.base.lang.buildfile.psi.ReferenceExpression)7 AssignmentStatement (com.google.idea.blaze.base.lang.buildfile.psi.AssignmentStatement)6 LoadStatement (com.google.idea.blaze.base.lang.buildfile.psi.LoadStatement)6 PsiDirectory (com.intellij.psi.PsiDirectory)6 Label (com.google.idea.blaze.base.model.primitives.Label)5