TextRange () { if (myCallee == null) return null; String calleeName = myCallee.getName(); if (calleeName == null) return null; TextRange range = myCallee.getTextRange(); // For example, for the `foo().bar().baz()` call expression the callee will be `foo().bar().baz`. // The range must be adjusted in such cases to match only the last part which is `baz`. if (calleeName.length() < range.getLength()) { int diff = range.getLength() - calleeName.length(); return new TextRange(range.getStartOffset() + diff, range.getEndOffset()); } return range; }