cleanup and bugfixes for [[]] in doc completions