use of com.google.idea.blaze.base.lang.buildfile.psi.BuildFile in project intellij by bazelbuild.
the class BuiltInFunctionCompletionContributorTest method testSkylarkNativeCompletion.
@Test
public void testSkylarkNativeCompletion() {
setRules("java_library", "android_binary");
BuildFile file = createBuildFile(new WorkspacePath("build_defs.bzl"), "def function():", " native.java_libra");
Editor editor = editorTest.openFileInEditor(file.getVirtualFile());
editorTest.setCaretPosition(editor, 1, " native.java_libra".length());
LookupElement[] completionItems = testFixture.completeBasic();
assertThat(completionItems).isNull();
assertFileContents(file, "def function():", " native.java_library()");
editorTest.assertCaretPosition(editor, 1, " native.java_library(".length());
}
use of com.google.idea.blaze.base.lang.buildfile.psi.BuildFile in project intellij by bazelbuild.
the class BuiltInFunctionCompletionContributorTest method testSimpleTopLevelCompletion.
@Test
public void testSimpleTopLevelCompletion() {
setRules("java_library", "android_binary");
BuildFile file = createBuildFile(new WorkspacePath("BUILD"), "");
Editor editor = editorTest.openFileInEditor(file.getVirtualFile());
editorTest.setCaretPosition(editor, 0, 0);
String[] completionItems = editorTest.getCompletionItemsAsStrings();
assertThat(completionItems).asList().containsAllOf("android_binary", "java_library");
assertFileContents(file, "");
}
use of com.google.idea.blaze.base.lang.buildfile.psi.BuildFile in project intellij by bazelbuild.
the class BuiltInFunctionCompletionContributorTest method testNoCompletionInsideRule.
@Test
public void testNoCompletionInsideRule() {
ServiceHelper.unregisterLanguageExtensionPoint("com.intellij.completion.contributor", BuiltInSymbolCompletionContributor.class, getTestRootDisposable());
setRules("java_library", "android_binary");
String[] contents = { "java_library(", " name = \"lib\"", "" };
BuildFile file = createBuildFile(new WorkspacePath("BUILD"), contents);
Editor editor = editorTest.openFileInEditor(file.getVirtualFile());
editorTest.setCaretPosition(editor, 2, 0);
LookupElement[] completionItems = testFixture.completeBasic();
assertThat(completionItems).isEmpty();
assertFileContents(file, contents);
}
use of com.google.idea.blaze.base.lang.buildfile.psi.BuildFile in project intellij by bazelbuild.
the class BuiltInFunctionCompletionContributorTest method testNoCompletionInComment.
@Test
public void testNoCompletionInComment() {
setRules("java_library", "android_binary");
BuildFile file = createBuildFile(new WorkspacePath("BUILD"), "#java");
Editor editor = editorTest.openFileInEditor(file.getVirtualFile());
editorTest.setCaretPosition(editor, 0, "#java".length());
assertThat(editorTest.getCompletionItemsAsStrings()).isEmpty();
}
use of com.google.idea.blaze.base.lang.buildfile.psi.BuildFile in project intellij by bazelbuild.
the class BuiltInSymbolCompletionContributorTest method testUniqueTopLevelCompletion.
@Test
public void testUniqueTopLevelCompletion() {
BuildFile file = createBuildFile(new WorkspacePath("BUILD"), "PACKAGE_N");
Editor editor = editorTest.openFileInEditor(file.getVirtualFile());
editorTest.setCaretPosition(editor, 0, "PACKAGE_N".length());
LookupElement[] completionItems = testFixture.completeBasic();
assertThat(completionItems).isNull();
assertFileContents(file, "PACKAGE_NAME");
editorTest.assertCaretPosition(editor, 0, "PACKAGE_NAME".length());
}
Aggregations