Search in sources :

Example 1 with DeclarationSearcher

use of meghanada.docs.declaration.DeclarationSearcher in project meghanada-server by mopemope.

the class Session method showDeclaration.

public Optional<Declaration> showDeclaration(final String path, final int line, final int column, final String symbol) throws IOException, ExecutionException {
    boolean b = this.changeProject(path);
    final DeclarationSearcher searcher = this.getDeclarationSearcher();
    return searcher.searchDeclaration(new File(path), line, column, symbol);
}
Also used : DeclarationSearcher(meghanada.docs.declaration.DeclarationSearcher) File(java.io.File)

Example 2 with DeclarationSearcher

use of meghanada.docs.declaration.DeclarationSearcher 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);
}
Also used : ArrayList(java.util.ArrayList) DeclarationSearcher(meghanada.docs.declaration.DeclarationSearcher) Declaration(meghanada.docs.declaration.Declaration) File(java.io.File) Test(org.junit.Test)

Aggregations

File (java.io.File)2 DeclarationSearcher (meghanada.docs.declaration.DeclarationSearcher)2 ArrayList (java.util.ArrayList)1 Declaration (meghanada.docs.declaration.Declaration)1 Test (org.junit.Test)1