Add API to get surrounding text synchronously