Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

autocomplete not working when prefix is more than one character #781

Open
madhusudhand opened this issue Oct 11, 2016 · 2 comments
Open

Comments

@madhusudhand
Copy link

madhusudhand commented Oct 11, 2016

Provider API
autocomplete suggestion confirm isn't working if the typed prefix is more than one character.

n
-> NgClass
-> NgFor
-> NgIf

select any of them, it replaces n and works as expected.

ng
-> NgClass
-> NgFor
-> NgIf

after typing g, no matter what you select, it doesn't replace. ng stays.

Looks like the issue is happening because replacementPrefix
It is getting set for the first time n in this case and is not changing later time because of the null condition check in the line:220 (lib/autocomplete-manager.coffee)

suggestion.replacementPrefix ?= @getDefaultReplacementPrefix(options.prefix)

which is making the condition fail in line: 404
if @editor.getTextInBufferRange([beginningPosition, endPosition]) is suggestion.replacementPrefix

Temporary fix:
Making replacementPrefix = null in completions before returning the filtered list from getSuggestions method will work.

@tofof
Copy link

tofof commented Nov 14, 2016

Can't replicate this. Not sure if it was fixed in the move from .coffee to .js or afterward.

@madhusudhand
Copy link
Author

I am able to reproduce the issue.
I selected HttpModule and other suggestions as well, it is not replacing the prefix.

autocomplete_781

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants