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

Rewrite word completion to play nice with other completion providers. #1125

Merged
merged 20 commits into from
Dec 15, 2021

Conversation

igordsm
Copy link
Sponsor Contributor

@igordsm igordsm commented Nov 13, 2021

Fixes #1147
This makes word completion work with Snippets from #1113 . It's an extensive rewrite of the plugin, so there are probably lots of possible improvements. I've been using it without much problem in the last hours, so I'm sending for review.

Copy link
Collaborator

@jeremypw jeremypw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I'll merge it together with the snippets branch into my "merge-dev-fixes" branch and dogfood it for a day or two.

There are a couple of other things that could be improved in the original but they are not related to this issue so I'll submit separate PRs for those.

plugins/word-completion/engine.vala Outdated Show resolved Hide resolved
Copy link
Collaborator

@jeremypw jeremypw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One issue I noticed that this PR introduces is that in some cases a prefix matches both a word and the same word followed by a space.

On a blank line type a (new) word
On the next line type the same word followed by a space
On the next line start typing the same word again - the completion shows two entries that are visually the same but one contains an extra space

@igordsm
Copy link
Sponsor Contributor Author

igordsm commented Nov 18, 2021

Just pushed changes that should address this problem, @jeremypw . Thank you for the instructions to reproduce it.

@jeremypw
Copy link
Collaborator

I can confirm that the above issue with spaces is fixed. I'll dogfood for a day or two to see if anything else arises.

public bool is_delimiter (unichar c) {
private Scratch.Plugins.PrefixTree prefix_tree;

public const string DELIMITERS = " .,;:?{}[]()0123456789+-=&|-<>*\\/\r\n\t\'\"`";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not consider hyphen and underscore as delimiters (see my separate PR on this issue). If you agree, could you change it here?

@jeremypw jeremypw mentioned this pull request Dec 8, 2021
@jeremypw
Copy link
Collaborator

jeremypw commented Dec 13, 2021

@igordsm I'd like to merge this as soon as possible - are you able to address the underscore/hyphen issue?

@jeremypw jeremypw merged commit 3f2e705 into elementary:master Dec 15, 2021
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.

Word completion plugin does not handle underscores and hyphens as expected
3 participants