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

Duplicate items in function and word autocomplete #13061

Closed
mpheath opened this issue Feb 6, 2023 · 8 comments
Closed

Duplicate items in function and word autocomplete #13061

mpheath opened this issue Feb 6, 2023 · 8 comments
Assignees
Labels

Comments

@mpheath
Copy link
Contributor

mpheath commented Feb 6, 2023

Description of the Issue

Autocomplete setting is function and word autocomplete so that words are also searched in the document. Some of the words can be keywords or function names and are compared with those from the xml, though the xml processing adds type separators with an ID so are different strings. This difference causes duplicates in the autocomplete.

Steps to Reproduce the Issue

  1. Type some keywords or function names to activate the autocomplete
  2. Type the same keywords or function names again to see the autocomplete with duplicates

Expected Behavior

An autocomplete list without duplicate items

Actual Behavior

An autocomplete list with duplicate items

Debug Information

Notepad++ v8.4.9   (64-bit)
Build time : Jan 27 2023 - 03:11:16
Path : C:\Notepad++\notepad++.exe
Command Line : 
Admin mode : OFF
Local Conf mode : ON
Cloud Config : OFF
OS Name : Windows 7 Professional (64-bit) 
OS Build : 7601.0
Current ANSI codepage : 1252
Plugins : 
    mimeTools (2.9)
    NppConverter (4.5)
    NppExport (0.4)
@mpheath
Copy link
Contributor Author

mpheath commented Feb 6, 2023

I have a possible working solution to this issue. As a feature of the fix, word completion inherits piximaps so it is known if the word matches a keyword or function name.

Click to view the image

autoc7

@donho
Copy link
Member

donho commented Feb 13, 2023

The duplication in list when auto-completion of word & function is enabled is not a bug to me.
That's why they have the icons (or no) in front to tell if it's word & function.

@ArkadiuszMichalski
Copy link
Contributor

From what I can see, there is no benefit to having two (or more) same entries in the list. After inserting the word, we have the same effect. It just makes the list grow unnecessarily.

If two entries are only informative (that we have something from xml and from the actual file) then why not just use one entry but with some other icon (which will somehow symbolize that a given word occurs in two ways)?

[] abc > no icon same as now, symbolize word from file
[fx] abc > fx icon same as now, symbolize function from xml
[#] abc > box icon same as now, symbolize keyword from xml

[?] abc > function from xml and word from file (maybe fx icon should look different?)
[?] abc > keyword from xml and word from file (maybe # icon should look different?)

Btw, I see that same function/keyword can appear in xml, so actually in some cases we can have even 3 of the same entries in list.

@donho
Copy link
Member

donho commented Feb 20, 2023

@ArkadiuszMichalski
Thank you for your opinion. I see your point.

@mpheath
Is it the behaviour after #13098, only the word completion is active?

image

If yes, the pixmaps shouldn't be there. The pixmap is for distiguishing functions and keywords from words.

@mpheath
Copy link
Contributor Author

mpheath commented Feb 21, 2023

@donho
The image that you display is the word completion. I find it ironic with functions, keywords and words in the image as visual evidence that I originally provided.

Is it the behaviour after #13098, only the word completion is active?
If yes, the pixmaps shouldn't be there.

The answer is No. It also affects Function and Word completion. If getWordArray() adds the word without fx/box id then duplication occurs with Function and Word completion. item is not item\x1E100[0|1] which equals duplication in showAutoComplete().

The pixmap is for distiguishing functions and keywords from words.

The Word completion can be informative with piximaps as:

  • The purple DirCopy is recognized as a function.
  • The blue Default is recognized as a keyword.
  • The black DWord is unrecognized.

I agree with your last quoted statement 100% though what you claim as piximaps shouldn't be there is based on what exactly? Perhaps the styling in the document is a mistake in your opinion and should be styled as just black coloured words? You cannot have it both ways and still claim that your right.

@sXNA
Copy link

sXNA commented Feb 22, 2023

I prefer word completion without "box" and "fx" icons

@donho
Copy link
Member

donho commented Feb 23, 2023

@mpheath

The image that you display is the word completion. I find it ironic with functions, keywords and words in the image as visual evidence that I originally provided.

I thought it was @vinsworldcom who provided this pixmap: c394a89

Anyway, even you are Vince or, Vince integrated your suggestion, I don't find it ironic: it means that these images have become the one of essential parts of Notepad++, which is difficult to change. But I do understand it's ironic from your viewpoint.

After playing around your PR, I told myself "why not" - the list is shorter (as the main point of @ArkadiuszMichalski) and it adapts to the environment (func pixmap appears only according the set language). So OK for the PR.

Thank you for your explanation and your contribution.

@vinsworldcom
Copy link

I noted this - word autocomplete and function autocomplete would create duplicates - in my original issue and my original pull request that added the icons in the first place. I couldn't find a solution then without some pretty gnarly changes and just wanted the feature to be accepted with minimal impact.

Happy to see it's improving and by eliminating the duplicates now and other changes I've seen to autocomplete (re-filtering), it's getting much better!

Thanks @mpheath and @donho for creating and accepting this new PR.

Cheers.

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

Successfully merging a pull request may close this issue.

5 participants