Word completion retains deleted words
Prerequisites
- [x] I have searched open and closed issues for duplicates.
Describe the bug
I found out that word completion extension suggests some incomplete words I used, or some mistakes I made which I later corrected. I encountered this error in my JavaScript file.
To Reproduce
Steps to reproduce the behavior:
- Click on the settings icon
- Click on the extensions tab
- Check Words Completion extension
- Start writing a script greater than 50 lines.
- Deliberately make some mistakes in variable names or function names.
- Go back and correct them.
- Now check whether you get those words that contains mistakes.
Expected behavior
I expected the word completion to suggest only words that are currently in my code, not words that have been deleted or incomplete words.
Screenshots or screen recordings
Logs
Platform Information

- [ ] I'm using the latest version from git that I've manually compiled
- [ ] I'm using the latest released stable version
Additional context
I still see these sorts of errors from time to time.
I see that in: https://github.com/elementary/code/blob/master/plugins/word-completion/plugin.vala#L137 the CTRL + | key combination rebuilds the word completion list however, I think that the completion list should be managed in a more dynamic way, similar to what was done in the Find project files (Fuzzy Search) plugin
@colinkiama Is that something you have time to attempt? I agree the word completion plugin could be improved - it suggests deleted words and misses words recently added at the moment.
Yes, I can spend a few hours a week on this issue.
This is as far as I can go with this issue: https://github.com/elementary/code/tree/851-fix-word-completion-logic
Things left to implement:
- [ ] Handle text being inserted at the start of a word
- [ ] Handle
delete_rangesignal, removing unused words from the prefix tree - [ ] Allow numeric delimiters as long as they aren't at the start of a word (allows variables with numbers in them to be suggested)
@colinkiama Thanks for your work on this! I have created a draft PR and will try it out and, if possible complete it.