Peekmo / atom-autocomplete-php

Autocomplete for PHP in atom editor
MIT License
136 stars 34 forks source link

Autocompletion of class names does not play nice with multiple cursors. #188

Open ghost opened 9 years ago

ghost commented 9 years ago

Hello

The autocompletion of class names where an automatic use statement is added does not play nice with multiple cursors. The culprit is the onDidInsertSuggestion method in class-provider because it does not deal with all the current cursors. It should probably try to replace all the cursors, but it must be taken into account that not all cursors may have the same prefix.

PS: It may be possible that solving this is easier if the namespace prefix isn't removed from the insertion after the use statement is added, but instead the text of the autocompletion suggestion doesn't contain the namespace prefix to begin with. This way only the use statement needs to be added in onDidInsertSuggestion and autocomplete-plus can handle the rest. The downside to this is that you can no longer 'undo' the removal of the namespace prefix, but only the addition of the use statement and the autocompletion itself.

Thanks in advance

Peekmo commented 9 years ago

I'm not sure that multicursors should be a 1.0.0 task, or only with the same prefix. Different prefix is a hell to manage (and not only for class names). I even think that multi cursor with different prefix will never be managed properly.