-
Notifications
You must be signed in to change notification settings - Fork 262
Suggestions are being dropped when they have the same text. #615
Comments
Any workaround for this? I'm hitting exactly the same issue (same text, different display, want to do something on insert). |
+1 I had the same problem. When I detect suggestions with the same text, I add a token after each text. if (completions.filter(completion => completion.text === proposition.text).length > 0) {
proposition.text += '#?';
}
completions.push(Object.assign({}, proposition)); Then, autocomplete-plus provides each suggestion. onDidInsertSuggestion({editor, triggerPosition, suggestion}) {
if (suggestion.text.includes('#?')) {
const line = editor.lineTextForBufferRow(triggerPosition.row);
const replacement = line.split('#?').join('');
editor.setTextInBufferRange([[triggerPosition.row, 0], [triggerPosition.row, line.length]], replacement);
}
} Maybe it will helps you... |
I tried inserting a qualifier and removing it on |
Also ran into this issue. In Java it's very common that the same class exists in a multitude of packages I'm using the |
👍 In PHP too Two classes with identical names, but different namespaces: … only one of them are shown when typing "Json" and autocompleting. |
On a related note, I'm wondering if it would be interesting to take this one step further and provide a
The problem is now that if I type All of this could also be solved by just using the full class names everywhere (as suggested above) and doing some magic after insertion to remove the "incorrect" inserted text, but this becomes a hassle to manage for multiple cursors. |
Bumping this. Any solution to the issue? As @torkiljohnsen is pointing out, autocomplete must allow multiple text to be able suggested. |
…ption to turn it back on. Fixes #615
Hello
I have a provider that supplies multiple suggestions that share the same
text
property, but that are in fact different suggestions. However, autocomplete-plus seems to be filtering them out. If I prefix them with something to ensure they are unique strings, they suddenly do show up. This behavior seems unwanted as it's the provider's responsibility to ensure the suggestions are unique when they need to be, i.e. it would be bug in my code.(More information about my specific use case:) I'm autocompleting PHP class names using their FQCN (fully qualified class name, separated by slashes) such as
Foo\Class1
andFoo\Bar\Class1
. These full names are passed asdisplayText
, but when the user selects the suggestion, I only complete the last part of the class name. A use (import) statement is then automatically added on top. Hence,Foo\Class1
andFoo\Bar\Class1
will both share the sametext
property, but a differentdisplayText
, and they will also be treated differently ononDidInsertSuggestion
.Thanks in advance
The text was updated successfully, but these errors were encountered: