Search in sources :

Example 1 with LocalVariable

use of meghanada.completion.LocalVariable in project meghanada-server by mopemope.

the class Session method localVariable.

public synchronized Optional<LocalVariable> localVariable(final String path, final int line) throws ExecutionException, IOException {
    // java file only
    final File file = normalize(path);
    if (!FileUtils.isJavaFile(file)) {
        return Optional.of(new LocalVariable("void", Collections.emptyList()));
    }
    boolean b = this.changeProject(path);
    return getVariableCompletion().localVariable(file, line);
}
Also used : LocalVariable(meghanada.completion.LocalVariable) File(java.io.File)

Example 2 with LocalVariable

use of meghanada.completion.LocalVariable in project meghanada-server by mopemope.

the class CommandHandler method localVariable.

public void localVariable(final long id, final String path, final String line) {
    final int lineInt = Integer.parseInt(line);
    try {
        final Optional<LocalVariable> localVariable = session.localVariable(path, lineInt);
        if (localVariable.isPresent()) {
            final String out = outputFormatter.localVariable(id, localVariable.get());
            writer.write(out);
        } else {
            final LocalVariable lv = new LocalVariable("void", Collections.emptyList());
            final String out = outputFormatter.localVariable(id, lv);
            writer.write(out);
        }
        writer.newLine();
    } catch (Throwable t) {
        writeError(id, t);
    }
}
Also used : LocalVariable(meghanada.completion.LocalVariable)

Aggregations

LocalVariable (meghanada.completion.LocalVariable)2 File (java.io.File)1