Fix segfault

We cannot show the code completion popup if the editor is not visible

This happens on travis-ci. This also means that we won't be able to cover 100% of code completion mode (before the previous fix 99% of this code was covered)