use of org.eclipse.lsp4j.HoverParams in project eclipse.jdt.ls by eclipse.
the class SyntaxServerTest method testHoverUnresolvedType.
@Test
public void testHoverUnresolvedType() throws Exception {
URI fileURI = openFile("maven/salut4", "src/main/java/java/Foo.java");
String fileUri = ResourceUtils.fixURI(fileURI);
TextDocumentIdentifier identifier = new TextDocumentIdentifier(fileUri);
HoverParams params = new HoverParams(identifier, new Position(7, 30));
Hover result = server.hover(params).join();
assertNotNull(result);
assertNotNull(result.getContents());
assertTrue(result.getContents().isLeft());
List<Either<String, MarkedString>> list = result.getContents().getLeft();
assertNotNull(list);
assertEquals(2, list.size());
assertTrue(list.get(1).isLeft());
assertEquals("This is interface IFoo.", list.get(1).getLeft());
}
use of org.eclipse.lsp4j.HoverParams in project xtext-core by eclipse.
the class AbstractLanguageServerTest method testHover.
protected void testHover(final Procedure1<? super HoverTestConfiguration> configurator) {
try {
@Extension final HoverTestConfiguration configuration = new HoverTestConfiguration();
configuration.setFilePath(("MyModel." + this.fileExtension));
configurator.apply(configuration);
final String fileUri = this.initializeContext(configuration).getUri();
HoverParams _hoverParams = new HoverParams();
final Procedure1<HoverParams> _function = (HoverParams it) -> {
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri);
it.setTextDocument(_textDocumentIdentifier);
int _line = configuration.getLine();
int _column = configuration.getColumn();
Position _position = new Position(_line, _column);
it.setPosition(_position);
};
HoverParams _doubleArrow = ObjectExtensions.<HoverParams>operator_doubleArrow(_hoverParams, _function);
final CompletableFuture<Hover> hoverFuture = this.languageServer.hover(_doubleArrow);
final Hover hover = hoverFuture.get();
Procedure1<? super Hover> _assertHover = configuration.getAssertHover();
boolean _tripleNotEquals = (_assertHover != null);
if (_tripleNotEquals) {
configuration.getAssertHover().apply(hover);
} else {
final String actualHover = this.toExpectation(hover);
this.assertEquals(configuration.getExpectedHover(), actualHover);
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.lsp4j.HoverParams in project eclipse.jdt.ls by eclipse.
the class SyntaxServerTest method testHover.
@Test
public void testHover() throws Exception {
URI fileURI = openFile("maven/salut4", "src/main/java/java/TestJavadoc.java");
String fileUri = ResourceUtils.fixURI(fileURI);
TextDocumentIdentifier identifier = new TextDocumentIdentifier(fileUri);
HoverParams params = new HoverParams(identifier, new Position(8, 23));
Hover result = server.hover(params).join();
assertNotNull(result);
assertNotNull(result.getContents());
assertTrue(result.getContents().isLeft());
List<Either<String, MarkedString>> list = result.getContents().getLeft();
assertNotNull(list);
assertEquals(2, list.size());
assertTrue(list.get(1).isLeft());
assertEquals("Test", list.get(1).getLeft());
}
use of org.eclipse.lsp4j.HoverParams in project eclipse.jdt.ls by eclipse.
the class SyntaxServerTest method testHoverType.
@Test
public void testHoverType() throws Exception {
URI fileURI = openFile("maven/salut4", "src/main/java/java/Foo.java");
String fileUri = ResourceUtils.fixURI(fileURI);
TextDocumentIdentifier identifier = new TextDocumentIdentifier(fileUri);
HoverParams params = new HoverParams(identifier, new Position(11, 9));
Hover result = server.hover(params).join();
assertNotNull(result);
assertNotNull(result.getContents());
assertTrue(result.getContents().isLeft());
List<Either<String, MarkedString>> list = result.getContents().getLeft();
assertNotNull(list);
assertEquals(2, list.size());
assertTrue(list.get(1).isLeft());
assertEquals("This is Bar.", list.get(1).getLeft());
}
Aggregations