Autocomplete Items Order Issue
-
Yes, what you are describing is the EXACT use case for the code snippets plugins I mentioned and NOT the intended use of the Notepad++/autoComplete/ files.
But alas, @PeterJones had a good suggestion and ASCII record separator 30 (\x1E) seems to be a good alternative that is “lower” in sort order than all visible ASCII characters so should fix the sorting problem if I can get an issue and pull request accepted.
Cheers.
-
@michael-vincent said in Autocomplete Items Order Issue:
alas …
It’s not just for the snippet-abuse of auto-complete.
if I can get an issue and pull request accepted.
If you need additional justification: Perfectly valid autocomplete word characters (
0
-9
) are sorted incorrectly because of the use of?
as the image separator character:The following three keywords are sorted in lexicographical sort order. They only have valid word characters (
\w
) in their keyword. But they still sort incorrectly in the function list:print_r print_r0 print_rand
The shorter
print_r
should always come before anything longer that starts with the same sequence.But because asc(
0
)=48=0x30 is less than asc(?
)=63=0x3F, the auto-complete will listprint_r0
beforeprint_r
. This is a bug in the current implementation.<?xml version="1.0" encoding="UTF-8" ?> <!-- @author Geoffray Warnants - http://www.geoffray.be @version 1.35.20100625 --> <NotepadPlus> <AutoComplete> <KeyWord name="print_r" func="yes"> <Overload retVal="mixed"> <Param name="mixed expression"/> <Param name="[bool return=false]"/> </Overload> </KeyWord> <KeyWord name="print_r0" func="yes"> <Overload retVal="mixed"> <Param name="argument"/> </Overload> </KeyWord> <KeyWord name="print_rand" func="yes"/> </AutoComplete> </NotepadPlus>
Feel free to use this image and minimized auto-completion file in your issue report as justification.
Notepad++ v8.3.1 (64-bit)
Build time : Feb 13 2022 - 15:41:12
Path : C:\usr\local\apps\npp\npp.8.3.1.portable.x64\notepad++.exe
Command Line :
Admin mode : OFF
Local Conf mode : ON
Cloud Config : OFF
OS Name : Windows 10 Enterprise (64-bit)
OS Version : 2009
OS Build : 19042.1526
Current ANSI codepage : 1252
Plugins : mimeTools.dll NppConverter.dll NppExport.dllBut I definitely agree, @Valery-Bogomolov should learn how to use one of the code-snippet tools (I would personally recommend Michael’s fork of the QuickText plugin, as I found that the most intuitive of the snippet-plugins for my use-case), rather than continuing to abuse the auto-complete files for things it wasn’t intended to do.
-
@michael-vincent said in Autocomplete Items Order Issue:
get an issue and pull request accepted
Done and Done. Well, submitted at least, the accepted part will need to wait a bit.
Cheers.
-
@peterjones I’m sorry for the “snippet-abuse”, I just wanted to get the most from the Npp’s auto-complete interface. I experimented with autocomplete a lot before developing the parser that generates KeyWords for my favorite language PHP. I wrote about it here
Unexpectedly, I figured out that I was able, for example, to write faster SQL queries code rather than using any other editor for that.
FingerText is not compatible with my configured Notepad++, QuickText is not convenient for me to use, but I use it. NppSnippets is a great plugin, but I have to search for a specific item in a dialog to insert a snippet and it takes some time.
Regards.
-
You can try the pull request AppVeyor build by downloading, and replacing your current
notepad++.exe
with the appropriate downloaded, renamed version. Of course, save your currentnotepad++.exe
(notepad++.exe.orig
) so you can revert back when done testing.Cheers.
-
@michael-vincent said in Autocomplete Items Order Issue:
You can try the…
More details (if you need them) on exactly how you’d do that are HERE.
-
@michael-vincent Thank you for the great work, but personally, I don’t like the new UX of the autocomplete: the
fx
icon is really distracting and I have to look down a couple of lines to see the first result. I would prefer to have the old autocomplete if it could be possible, sorry -
@valery-bogomolov said in Autocomplete Items Order Issue:
Thank you for the great work
Assuming that means is sorts as you expect now?
-
This post is deleted! -
@michael-vincent Ok, now it works. I compared it with the old autocomplete version and the results seem to be the same.
Only
fx
icon is everywhere. There is afunc="yes"
, orfunc="no"
attribute in XML that describes the KeyWord, and thefunc
attribute is not always required. There could be some language expression likereturn
, but it’s notfx
, right?Best regards.
-
The “fx” distinguishes the option comes from an autocomplete/*.xml file versus a word from the current file when both word and API autocomplete is active.
Scintilla autocomplete has a lot to be desired and Notepad++ does the best it can with it, but plugins can use autocomplete too (e.g., QuickText, TagLEET, I have PythonScripts that do it to provide Python-IDE-like features with jedi). Only you can’t merge the lists - only 1 autocomplete is active at any time. So which suggestion is coming from what source?
TagLEET global tags file:
TagLEET local tags file:
QuickText:
PythonScript custom Python IDE:
It’d be nice to see them all in the same list, but alas, each time a character is typed and a best match is found, whatever Notepad++ / Plugin matches best displays it’s abbreviated list. The Icons help determine where in the heck this suggestion is coming from.
This is no different than most other editors that offer autocomplete (VS Code example)
Cheers.
-
This post is deleted! -
Okay, to differentiate which is document words and which are autocomplete words seems to make sense, unless you factor in that if you don’t want the words from the document being introduced and only use it for the autocomplete list, the
fx
is actually redundant to that purpose. Now, if you want to show an icon for words from the document, that triggers if you switch that option on, that makes more sense. Since if the word is from an autocomplete it won’t matter, it’s a different procedure for you to autocomplete a function, and the keyword is just that, so you select it whether it has been in the document previously or not, but if it’s only from the document, that would make more sense to highlight that with a different character glyph. Just my two cents worth. :)Wow, forum is slow and double posting posts. :(
-
@michael-vincent
fx
means function of x in math… I would use something from what Notepad++ already has in its UI. For example, the cube icon from the Function List panel with light grey color, so not to distract the user and black color for the font in results, as it has right now :)The example icon from the Function List panel
and I would prefer to use unicode character instead of png, so it could be scalable and faster to load :)
P.s.: btw, I have also issue with NppGTags autocomplete as it shows me gibberish in results. It’s my favorite plugin :( Maybe, the engoding of generated tags file is wrong… no ideas how to fix
Cheers.
-
@valery-bogomolov said in Autocomplete Items Order Issue:
I would use something from what Notepad++ already has in its UI
I did:
@valery-bogomolov said in Autocomplete Items Order Issue:
and I would prefer to use unicode character instead of png, so it could be scalable and faster to load :)
No characters, it’s not a PNG. Scintilla has only 2 options.
@valery-bogomolov said in Autocomplete Items Order Issue:
P.s.: btw, I have also issue with NppGTags autocomplete as it shows me gibberish in results
I would contact the author @pnedev and open an issue. He’s been very responsive fixing the Compare Plugin.
Cheers.
-
My function list icon looks like this, not yours:
-
@alan-kilborn said in Autocomplete Items Order Issue:
My function list icon looks like this, not yours:
You’ll need to restart Notepad++.
-
This thread is becoming rather mixed-up.
Please open an issue in NppGTags repo to discuss its autocomplete problem there.At first look it seems that the parser you are using (GTags maybe) is not recognizing some symbols in your codebase. AFAIR, the parser won’t be able to parse Unicode right if you are using it.