Search in sources :

Example 1 with Location

use of meghanada.location.Location in project meghanada-server by mopemope.

the class Session method jumpDeclaration.

public synchronized Optional<Location> jumpDeclaration(final String path, final int line, final int column, final String symbol) throws ExecutionException, IOException {
    boolean b = this.changeProject(path);
    final Optional<Location> location = this.getLocationSearcher().searchDeclarationLocation(new File(path), line, column, symbol);
    location.ifPresent(a -> {
        Location backLocation = new Location(path, line, column);
        this.jumpDecHistory.addLast(backLocation);
    });
    if (!location.isPresent()) {
        log.warn("missing location path={} line={} column={} symbol={}", path, line, column, symbol);
    }
    return location;
}
Also used : File(java.io.File) Location(meghanada.location.Location)

Example 2 with Location

use of meghanada.location.Location in project meghanada-server by mopemope.

the class CommandHandler method backJump.

public void backJump(final long id) {
    final Location location = session.backDeclaration().orElseGet(() -> new Location("", -1, -1));
    try {
        final String out = outputFormatter.jumpDeclaration(id, location);
        writer.write(out);
        writer.newLine();
    } catch (Throwable t) {
        writeError(id, t);
    }
}
Also used : Location(meghanada.location.Location)

Example 3 with Location

use of meghanada.location.Location in project meghanada-server by mopemope.

the class CommandHandler method jumpDeclaration.

public void jumpDeclaration(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 Location location = session.jumpDeclaration(path, lineInt, columnInt, symbol).orElseGet(() -> new Location(path, lineInt, columnInt));
        final String out = outputFormatter.jumpDeclaration(id, location);
        writer.write(out);
        writer.newLine();
    } catch (Throwable t) {
        writeError(id, t);
    }
}
Also used : Location(meghanada.location.Location)

Aggregations

Location (meghanada.location.Location)3 File (java.io.File)1