use of meghanada.docs.declaration.Declaration in project meghanada-server by mopemope.
the class JavaAnalyzerTest method analyze04.
@Test
public void analyze04() throws Exception {
final JavaAnalyzer analyzer = getAnalyzer();
final String cp = getClasspath();
List<File> files = new ArrayList<>();
final File file = new File("./src/test/java/meghanada/Gen4.java").getCanonicalFile();
assertTrue(file.exists());
files.add(file);
final String tmp = System.getProperty("java.io.tmpdir");
timeIt(() -> {
final CompileResult compileResult = analyzer.analyzeAndCompile(files, cp, tmp);
compileResult.getSources().values().forEach(Source::dump);
return compileResult;
});
timeIt(() -> {
return analyzer.analyzeAndCompile(files, cp, tmp);
});
final DeclarationSearcher searcher = new DeclarationSearcher(getProject());
final Optional<Declaration> declaration = searcher.searchDeclaration(file, 9, 22, "value");
assertNotNull(declaration);
}
use of meghanada.docs.declaration.Declaration in project meghanada-server by mopemope.
the class CommandHandler method showDeclaration.
public void showDeclaration(final long id, final String path, final String line, final String col, final String symbol) {
final int lineInt = Integer.parseInt(line);
final int columnInt = Integer.parseInt(col);
try {
final Declaration declaration = session.showDeclaration(path, lineInt, columnInt, symbol).orElse(new Declaration("", "", Declaration.Type.OTHER, 0));
final String out = outputFormatter.showDeclaration(id, declaration);
writer.write(out);
writer.newLine();
writer.flush();
} catch (Throwable t) {
writeError(id, t);
}
}
Aggregations