code icon indicating copy to clipboard operation
code copied to clipboard

Word completion retains deleted words

Open Victor-El opened this issue 5 years ago • 5 comments

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:

  1. Click on the settings icon
  2. Click on the extensions tab
  3. Check Words Completion extension
  4. Start writing a script greater than 50 lines.
  5. Deliberately make some mistakes in variable names or function names.
  6. Go back and correct them.
  7. 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

Screenshot from 2020-07-25 18-23-57

  • [ ] I'm using the latest version from git that I've manually compiled
  • [ ] I'm using the latest released stable version

Additional context

Victor-El avatar Jul 25 '20 17:07 Victor-El

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 avatar Sep 16 '24 13:09 colinkiama

@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.

jeremypw avatar Sep 16 '24 16:09 jeremypw

Yes, I can spend a few hours a week on this issue.

colinkiama avatar Sep 16 '24 17:09 colinkiama

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_range signal, 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 avatar Nov 24 '24 19:11 colinkiama

@colinkiama Thanks for your work on this! I have created a draft PR and will try it out and, if possible complete it.

jeremypw avatar Nov 24 '24 20:11 jeremypw