Skip to content

Autocompletion - function autocompletion spruced up! #11087

@vinsworldcom

Description

@vinsworldcom

Description of the Issue

Scintilla allows for an icon to be displayed in the autocomplete popup that could indicate the type of suggestion the autocomplete is from. Notepad++ allows autocomplete from words in the current doc, keywords from the autoComplete/.xml files, or both. I have both turn on and it would be nice to distinguish between which autocomplete suggestions are from the current doc versus those coming from the autoComplete/.xml files. Fortunately, this is a pretty easy lift.

We just need to include an XPM icon (I used the ./PowerEditor/src/icons/functionList2.ico - converted with a free web-based file converter), register the icon ID and set the type separator, then just append the type separator and image ID to each keyword.

Potential Issues

Duplicates with word + function enabled

The only issue I've seen with my testing is that once a keyword is inserted into a file, it is picked up by the word search and then added again when the keywords are merged. Use print as an example:

print is found as a document word and merged into the word list
print is found as a keyword and merged into the keyword list as print?1000 (with the type separator and image ID)
Now, when comparing the keywords list to the word list to merge them, print != print?1001 to they are both added resulting in:

image

The second autocomplete in the picture above, typing a keyword print when it is already in the document shows twice in the autocomplete suggestions, once as a document word, once as the keyword (from autoComplete/*.xml).

Word only autocomplete

There is no "issue" with this, just that I originally tried to put an icon for word autocomplete as well and it "works", but we get the duplicate issue above in spades.

Every time they plain word print is found in the doc, it is compared to the building list which already has print?5000 added (assuming 5000 for the WORD icon image ID). print != print?5000 so it's added again. Then the next instance of print is found, compared and again, print != print?5000 already in the list, so it's added again ... and again!

SO .. I gave up on trying to find a way to add an icon for word autocomplete. Frankly, it seems better this way - simple word complete is just that, but using any form of function complete - the keywords for functions get icons.

Review

I'll submit a pull request but PLEASE someone review! I think I made use of the appropriate typing and put the XPM data in the header file rather than a global in the C++ source file.

Cheers.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions