// Check position of identifier name
// The positions are shifted by 1 because identifier positions
// are 1-based, while Document positions are 0-based.
SourceRange identifierOffsetRange = identifier.getOffsetRange();
int column = identifierOffsetRange.getStartColumn() - 1;
int identifierEndLine = identifierOffsetRange.getEndLine() - 1;
if ((identifierEndLine == indexLine) &&
(column < mouseColumn) &&
(mouseColumn <= column + identifier.getName().length() + 1)) {
return identifier;
}
// Check position of identifier module name
// This is done separately because an identifier name
// may be separated from its module name (eg: "Prelude . not")
if (identifier.hasRawModuleSourceRange()) {
SourceRange identifierOffsetModuleNameRange = identifier.getOffsetModuleNameRange();
int startLine = identifierOffsetModuleNameRange.getStartLine() - 1;
int startColumn = identifierOffsetModuleNameRange.getStartColumn() - 1;
int endLine = identifierOffsetModuleNameRange.getEndLine() - 1;
int endColumn = identifierOffsetModuleNameRange.getEndColumn() - 1;
if ((startLine <= indexLine) && (indexLine <= endLine) &&
(startColumn < mouseColumn) && (mouseColumn <= endColumn)) {
return identifier;