use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class CompleteHandler method handleMsg.
private void handleMsg(Message message) {
String code = ((String) message.getContent().get(CODE));
int cursorPos = ((int) message.getContent().get(CURSOR_POS));
AutocompleteResult autocomplete = kernel.autocomplete(code, cursorPos);
Message reply = createMsg(message, cursorPos, autocomplete);
send(reply);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class SQLAutocompleteTest method shouldAutocompleteToPercentPercentbeakerD.
@Test
public void shouldAutocompleteToPercentPercentbeakerD() throws Exception {
// given
givenColorTable();
// when
String code = "%%beakerD";
AutocompleteResult autocomplete = sqlEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(0);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class SQLAutocompleteTest method shouldAutocompleteAfterSpace.
@Test
public void shouldAutocompleteAfterSpace() throws Exception {
// given
givenColorTable();
// when
String code = "%%beakerDB ";
AutocompleteResult autocomplete = sqlEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(code.length());
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method autocompleteForJavaAwtPackage.
@Test
public void autocompleteForJavaAwtPackage() throws Exception {
String code = "java.aw";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(code.length() - 2);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteTest method autocompleteStringMethod.
@Ignore
@Test
public void autocompleteStringMethod() throws Exception {
String code = "String a = \"ABC\";\n" + "a.";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(code.length());
}
Aggregations