use of com.google.idea.blaze.base.lang.buildfile.psi.BuildFile in project intellij by bazelbuild.
the class BuiltInFunctionAttributeCompletionContributorTest method testNoCompletionInComment.
@Test
public void testNoCompletionInComment() {
setRuleAndAttributes("sh_binary", "name", "deps", "srcs", "data");
BuildFile file = createBuildFile(new WorkspacePath("BUILD"), "sh_binary(#");
Editor editor = editorTest.openFileInEditor(file.getVirtualFile());
editorTest.setCaretPosition(editor, 0, "sh_binary(#".length());
assertThat(editorTest.getCompletionItemsAsStrings()).isEmpty();
}
use of com.google.idea.blaze.base.lang.buildfile.psi.BuildFile in project intellij by bazelbuild.
the class BuiltInFunctionAttributeCompletionContributorTest method testNoCompletionAfterInteger.
@Test
public void testNoCompletionAfterInteger() {
setRuleAndAttributes("sh_binary", "name", "deps", "srcs", "data");
BuildFile file = createBuildFile(new WorkspacePath("BUILD"), "sh_binary(testonly = 1,");
Editor editor = editorTest.openFileInEditor(file.getVirtualFile());
editorTest.setCaretPosition(editor, 0, "sh_binary(testonly = 1".length());
assertThat(editorTest.getCompletionItemsAsStrings()).isEmpty();
}
use of com.google.idea.blaze.base.lang.buildfile.psi.BuildFile in project intellij by bazelbuild.
the class BuiltInFunctionAttributeCompletionContributorTest method testNoCompletionInUnknownRule.
@Test
public void testNoCompletionInUnknownRule() {
ServiceHelper.unregisterLanguageExtensionPoint("com.intellij.completion.contributor", BuiltInSymbolCompletionContributor.class, getTestRootDisposable());
ServiceHelper.unregisterLanguageExtensionPoint("com.intellij.completion.contributor", BuiltInFunctionCompletionContributor.class, getTestRootDisposable());
setRuleAndAttributes("sh_binary", "name", "deps", "srcs", "data");
BuildFile file = createBuildFile(new WorkspacePath("BUILD"), "java_binary(");
Editor editor = editorTest.openFileInEditor(file.getVirtualFile());
editorTest.setCaretPosition(editor, 0, "java_binary(".length());
LookupElement[] completionItems = testFixture.completeBasic();
assertThat(completionItems).isEmpty();
}
use of com.google.idea.blaze.base.lang.buildfile.psi.BuildFile in project intellij by bazelbuild.
the class BuiltInFunctionAttributeCompletionContributorTest method testDoNotShowExistingAttributesInAutocompleteSuggestions.
@Test
public void testDoNotShowExistingAttributesInAutocompleteSuggestions() {
setRuleAndAttributes("sh_binary", "name", "deps", "srcs", "data");
BuildFile file = createBuildFile(new WorkspacePath("BUILD"), "sh_binary(name = 'bin', )");
Editor editor = editorTest.openFileInEditor(file.getVirtualFile());
editorTest.setCaretPosition(editor, 0, "sh_binary(name = 'bin', ".length());
String[] completionItems = editorTest.getCompletionItemsAsStrings();
assertThat(completionItems).asList().containsAllOf("deps", "srcs", "data");
assertThat(completionItems).asList().doesNotContain("name");
}
use of com.google.idea.blaze.base.lang.buildfile.psi.BuildFile in project intellij by bazelbuild.
the class BuiltInFunctionAttributeCompletionContributorTest method testSimpleCompletion.
@Test
public void testSimpleCompletion() {
setRuleAndAttributes("sh_binary", "name", "deps", "srcs", "data");
BuildFile file = createBuildFile(new WorkspacePath("BUILD"), "sh_binary(");
Editor editor = editorTest.openFileInEditor(file.getVirtualFile());
editorTest.setCaretPosition(editor, 0, "sh_binary(".length());
String[] completionItems = editorTest.getCompletionItemsAsStrings();
assertThat(completionItems).asList().containsAllOf("name", "deps", "srcs", "data");
}
Aggregations