fixed reference completion text ranges and unit tests