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;
}
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);
}
}
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);
}
}