use of org.eclipse.lsp4j.SymbolInformation in project eclipse.jdt.ls by eclipse.
the class WorkspaceSymbolHandlerTest method testEmptyNames.
@Test
public void testEmptyNames() throws Exception {
importProjects("maven/reactor");
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("reactor");
assertIsJavaProject(project);
String query = "Mono";
List<SymbolInformation> results = WorkspaceSymbolHandler.search(query, 0, "reactor", false, monitor);
assertNotNull(results);
assertEquals("Found ", 119, results.size());
boolean hasEmptyName = results.stream().filter(s -> (s.getName() == null || s.getName().isEmpty())).findFirst().isPresent();
assertFalse("Found empty name", hasEmptyName);
}
use of org.eclipse.lsp4j.SymbolInformation in project eclipse.jdt.ls by eclipse.
the class WorkspaceSymbolHandlerTest method testDeprecated_property.
@Test
public void testDeprecated_property() {
when(preferenceManager.getClientPreferences().isSymbolTagSupported()).thenReturn(false);
List<SymbolInformation> results = WorkspaceSymbolHandler.search("Certificate", monitor);
assertNotNull(results);
SymbolInformation deprecated = results.stream().filter(symbol -> symbol.getContainerName().equals("java.security")).findFirst().orElse(null);
assertNotNull(deprecated);
assertNotNull(deprecated.getDeprecated());
assertTrue("Should be deprecated", deprecated.getDeprecated());
}
use of org.eclipse.lsp4j.SymbolInformation in project eclipse.jdt.ls by eclipse.
the class WorkspaceSymbolHandlerTest method testDeprecated.
@Test
public void testDeprecated() {
when(preferenceManager.getClientPreferences().isSymbolTagSupported()).thenReturn(true);
List<SymbolInformation> results = WorkspaceSymbolHandler.search("Certificate", monitor);
assertNotNull(results);
SymbolInformation deprecated = results.stream().filter(symbol -> symbol.getContainerName().equals("java.security")).findFirst().orElse(null);
assertNotNull(deprecated);
assertNotNull(deprecated.getTags());
assertTrue("Should have deprecated tag", deprecated.getTags().contains(SymbolTag.Deprecated));
SymbolInformation notDeprecated = results.stream().filter(symbol -> symbol.getContainerName().equals("java.security.cert")).findFirst().orElse(null);
assertNotNull(notDeprecated);
if (notDeprecated.getTags() != null) {
assertFalse("Should not have deprecated tag", deprecated.getTags().contains(SymbolTag.Deprecated));
}
}
use of org.eclipse.lsp4j.SymbolInformation in project eclipse.jdt.ls by eclipse.
the class WorkspaceSymbolHandlerTest method testProjectSearch.
@Test
public void testProjectSearch() {
String query = "IFoo";
List<SymbolInformation> results = WorkspaceSymbolHandler.search(query, monitor);
assertNotNull(results);
assertEquals("Found " + results.size() + " results", 2, results.size());
SymbolInformation symbol = results.get(0);
assertEquals(SymbolKind.Interface, symbol.getKind());
assertEquals("java", symbol.getContainerName());
assertEquals(query, symbol.getName());
Location location = symbol.getLocation();
assertNotEquals("Range should not equal the default range", JDTUtils.newRange(), location.getRange());
assertTrue("Unexpected uri " + location.getUri(), location.getUri().endsWith("Foo.java"));
}
Aggregations