Auto Complete - List only specified keywords?
-
Is it possible to list only specified keywords with Auto Complete, and ignore the “document words”?. Currently, in order to be able to list the non-function keywords, I have to enable “words and functions” for auto complete.
The issue in my case, is that the “document words” are included in this and I am trying to omit those.
Just wondering if it is currently possible, or possibly a planned development already?
-
@Jeb-Dude ,
You’ll need to selectFunction completion
only in the Preferences dialog as shown in this screenshot:
In your autoCompletion file, if this is a UDL, or even the stock language, all the Keywords and Functions should be in the same file that is used to search, so setting the
Function completion
would only use that file. If you are actively creating functions as you code, then that won’t be available only…I believe. -
I had tried this. And only the items marked as
func="yes"
show up in this case.I’ve done several variations of this, and restarted NPP every time.
One thing I have noticed here is that when a keyword/function contains an underscore, that seems to be causing an issue currently, unless “words” are also enabled along with functions.
Hope that makes sense.
-
All I know, is when I asked this same question about how to stop getting all the words of the document included, that’s how it was explained to me. Function completion is the autoCompletion file, words is everything you typed in that document, and both includes both. I was trying to eliminate the words of the document, not the keywords, and that is the setting I was advised to use for that reason. Unless there is something wrong in the list, the keywords should be coming up just like the functions. I will say that occasionally, NPP acts a little weird with the UDL stuff. For instance, while trying this out on a portable version to verify the keywords coming up with the functions, my UDL wasn’t responding. I don’t know if it’s because I have a lot of other stuff open, my computer…etc, but it wasn’t coming up until about the 3rd time I’d open the document and started typing that it started to work…so if everything is working right, that’s the way it’s supposed to work.
-
Thanks for the explanation. I’ll try to make a small scale UDL and illustrate the problem more clearly. Hopefully that will result in my error, or a bug.
-
@Jeb-Dude ,
One thing I ran into, is if words had underscores, instead of the hex equivalent of a space in the file, they needed to be sorted lexicographically, and in my case, the list didn’t run at all, especially withignoreCase = no
set in the autoCompletion file. I’m not sure if that remains the same now, as @PeterJones had shown an ability to use camelHumped keywords and upper or lower case letters to retrieve the proper word capped or not recently that I couldn’t do almost a year ago or so in older versions when I made my list up, which I did for keywords in both capitals and lowercase, so the programmer could use either. Also, I used hex codes for special characters that didn’t show up normally and had to sort those in the proper order as part of the list as well.For instance, when sorting lexicographically, I had to list the special characters with the capital letters first and then the lower case letters with that same special characters first in the list, and then do the non-special characters under that in Caps first and then lowercase equivalents under that group. Here is a pic of the order I had to do where the Upper special character ends and the Lower special charater starts:
As you can see by that pic, the space character had to be repalced by
 
so the space between words would show, since a simple spacebar could’t be represented. At first I toyed with using the_
but then that was being inserted into the file and the programmer would have to remove it…which was more trouble than it was worth, until I found this solution reading the docs and asking questions here. :) -
Ah hah. Thanks for that tip. I’m fairly sure that I don’t have the proper order then. I’ll have to take a closer look at that.