use of meghanada.analyze.Variable in project meghanada-server by mopemope.
the class LocationSearcher method getFieldLocationFromProject.
private Optional<Location> getFieldLocationFromProject(final String fqcn, final String fieldName, final File file) {
try {
final Source declaringClassSrc = getSource(project, file);
final String path = declaringClassSrc.getFile().getPath();
return declaringClassSrc.getClassScopes().stream().map(cs -> getMatchField(cs, fqcn, fieldName)).filter(Optional::isPresent).map(optional -> {
final Variable variable = optional.get();
return new Location(path, variable.range.begin.line, variable.range.begin.column);
}).findFirst();
} catch (Exception e) {
throw new UncheckedExecutionException(e);
}
}
Aggregations