Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically update word completions #1491

Draft
wants to merge 54 commits into
base: master
Choose a base branch
from

Conversation

jeremypw
Copy link
Collaborator

@jeremypw jeremypw commented Dec 4, 2024

Based on #1487

  • Plugin: Handle 'insert-text' and 'delete-range' signals to update prefix-tree before buffer changes
  • Engine: Only use split-set with custom delimiters to identify words (do not use textiter functions)
  • PrefixNode: Split out into separate file
  • PrefixNode: Add functionality to record multiple occurrences of word.
  • PrefixNode: Add link to parent node
  • PrefixNode: Move code to insert, find, remove and list completions here
  • PrefixTree: Manage reaping of unused words, interface with engine.
  • CompletionProvider: Off-load some functions to parser for consistency
  • CompletionProvider: Completion overwrites remainder of word when inserting in middle
  • Discontinue key press handling (no need to force tree update?)
  • General: Update code style and headers. Add extra comments and debug output.
  • General: Adjust minimum length of word and minimum length of prefix
  • General: Introduce maximum length of word stored
  • Show completions after deleting with backspace

For simplicity, insertions and deletions are all handled the same way rather than separate functions depending on where the insertion/deletion occurred. This results in some temporary "words" being added and removed in quick succession while typing but on current average hardware (i5 processor, SSD) and modest sized files (3000 lines) no performance issues were noticed. However, more efficiency could be achieved at the cost of greater complexity by queueing the changes (like Files) and ignoring those that cancel out.

To be decided:

  • Best order for completions
  • Best values for min prefix and min word
  • Best value for interactive delay
  • Whether forced update should still be availabe

colinkiama and others added 30 commits November 2, 2024 12:33
… completion plugin

The 'insert_text' signal gives more detail about how the document contents have changed, giving us a way to more accurately update the prefix tree used for word completion
* Detect when cursor moves off insertion line
@jeremypw
Copy link
Collaborator Author

jeremypw commented Dec 4, 2024

Flatpak CI failing due to Gnome Gitlab outage.

@jeremypw
Copy link
Collaborator Author

jeremypw commented Dec 4, 2024

I'm going to dog-food this for a while before asking for reviews.

@jeremypw jeremypw marked this pull request as ready for review December 6, 2024 13:13
@jeremypw jeremypw requested a review from colinkiama December 6, 2024 13:13
@jeremypw
Copy link
Collaborator Author

jeremypw commented Dec 6, 2024

@colinkiama If you have time to try and break this I would be grateful! The logic is quite involved so it is hard to be sure it copes with all circumstances.

@jeremypw
Copy link
Collaborator Author

jeremypw commented Dec 8, 2024

At the moment this only works reliably in OS7.1. There are some weird bugs when running it on OS8 inside a Gnome Boxes VM. Not sure why - maybe a timing thing? Converting back to draft while investigating.

@jeremypw jeremypw marked this pull request as draft December 8, 2024 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants