Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Improved auto-complete for SciTE


  • Please log in to reply
43 replies to this topic
stevenp
  • Members
  • 197 posts
  • Last active: Sep 23 2014 05:47 PM
  • Joined: 28 Aug 2006
Lexikos, why AutoComplete.lua is not named initially as UserLuaScript.lua
"Simplifying complexity is not simple"

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
Why should it be? It's an auto-complete script.

If you want to put other code in your user lua script, you can:
local autoc = props['SciteUserHome'].."/AutoComplete.lua"
if FileExists(autoc) then
	dofile(autoc)
end


stevenp
  • Members
  • 197 posts
  • Last active: Sep 23 2014 05:47 PM
  • Joined: 28 Aug 2006
Thanks, that is useful
"Simplifying complexity is not simple"

HowToUse
  • Guests
  • Last active:
  • Joined: --

To use it with SciTE4AutoHotkey, save the file as UserLuaScript.lua in your SciTE user home directory (i.e. %A_MyDocuments%\AutoHotkey\SciTE).


I must be an idiot because I did exactly that, then edited local MIN_PREFIX_LEN = 2 to local MIN_PREFIX_LEN = 5 just to see if it is working.

It still brings up the auto complete on the 1st character I type or 2nd depending on the word I am typing.

I am using Version 3.0 - Based on SciTE 3.0.2

Do I need to update my SciTE?

I read a post where the "Save" floppy icon does not grey out after a script is saved and I wanted to wait on updating SciTE4AutoHotkey until that has been fixed.

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
Try adding the following to your user properties file:
autocomplete.ahk1.start.characters=


HowToUse
  • Guests
  • Last active:
  • Joined: --

Try adding the following to your user properties file:

autocomplete.ahk1.start.characters=

That completely disables my autocomplete.

Just in case I am missing something, here is exactly what I have done.

1. Download AutoComplete.lua
2. Rename AutoComplete.lua to UserLuaScript.lua and placed it in my SciTE user home directory %A_MyDocuments%\AutoHotkey\SciTE (I renamed the original UserLuascript.lua to xold.lua)
3. Edited UserLuaScript.lua by changing local MIN_PREFIX_LEN = 2 to local MIN_PREFIX_LEN = 3
4. Adding autocomplete.ahk1.start.characters= to my user properties file (SciTEUser.properties) which is located in the same folder I put UserLuaScript.lua in. (%A_MyDocuments%\AutoHotkey\SciTE)

Close and reopen Scite4AutoHotkey. Still my autocomplete looks like it has not changed and definently pops up when I press 1 key.

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006

That completely disables my autocomplete.

That's not what it does. Even with that property and without my script, you can press Ctrl+Space to trigger autocomplete.

4. Adding autocomplete.ahk1.start.characters=
...
Still my autocomplete looks like it has not changed and definently pops up when I press 1 key.

That seems to contradict what you wrote above.

I did the following with a fresh installation of SciTE4AutoHotkey:

[*:3cbftzdb]Copy the contents of AutoComplete.lua to the clipboard (directly from IE).
[*:3cbftzdb]Right click on the AutoHotkey part of the toolbar and click Edit User Lua script. UserLuaScript.lua opens.
[*:3cbftzdb]Paste and Save.
(I am lazy, and these three steps are easier than downloading and renaming the file.)
(Edit: I have now confirmed that downloading and renaming the file works.)
[*:3cbftzdb]Restart SciTE4AutoHotkey.
[*:3cbftzdb]Open a script and start typing a variable name from that script. The list appears immediately upon typing the first character. The variable name appears in the list. This only happens if the Lua script is working. The list narrows down as I type. This also only happens if the Lua script is working.
[*:3cbftzdb]Open the user properties, add autocomplete.ahk1.start.characters= and save. As this is a fresh installation, the SciTEUser.properties contains nothing else other than comments and the two import statements that are there by default.
[*:3cbftzdb]Switch back to the script and start typing. The list now only appears on the second keypress.
All this with SciTE4AutoHotkey 3.0.

To confirm the Lua script is running, you can add the following to the top of the file. A message should appear in the SciTE output pane.
print("AutoComplete starting up")


Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006

I am using Version 3.0 - Based on SciTE 3.0.2

Do I need to update my SciTE?

That would be a good idea. You are probably using a beta or release candidate. The version 3.0 that I have is based on SciTE 3.2.1.

HowToUse
  • Guests
  • Last active:
  • Joined: --

That completely disables my autocomplete.

That's not what it does. Even with that property and without my script, you can press Ctrl+Space to trigger autocomplete.

4. Adding autocomplete.ahk1.start.characters=
...
Still my autocomplete looks like it has not changed and definently pops up when I press 1 key.

That seems to contradict what you wrote above.


Sorry, I forgot to include that after adding "autocomplete.ahk1.start.characters=" to my User Properties and finding out that the autocomplete did not work at all, I went back and removed that line.

After reading your post, I went back and tried it again. And you are right the Ctrl Space still works with that line added to my User Properties but nothing happens when I type commands. The pop up never pops up no matter how many I characters I type. I remove the line and it pops up on the 1st character typed.

I will try your suggestions and update my Scite4AutoHotkey and see if that works.

thanks

HowToUse
  • Guests
  • Last active:
  • Joined: --

I am using Version 3.0 - Based on SciTE 3.0.2

Do I need to update my SciTE?

That would be a good idea. You are probably using a beta or release candidate. The version 3.0 that I have is based on SciTE 3.2.1.


I updated to the latest and works perfectly. But just as I mentioned, the little Save floppy icon does not gray out when the script has been saved.

Hopefully that will be fixed soon. For now I will retrain my eyes to look for the asterisk.

thanks for your help and your AutoComplete script.

mark76uk
  • Members
  • 16 posts
  • Last active: Jan 15 2014 05:40 AM
  • Joined: 01 Jun 2007

Hello,

 

I love this script.  But am wondering if the command documentation tooltip can be made to hover longer while I get autocomplete hints too?

 

For example, when I type    InStr(   a pop-up displays      InStr ( Haystack, Needle [,casesensitive?     ...etc...

 

As soon as I begin typing the first variable (the 'Haystack' in this example), the command documentation tooltip is destroyed and the variable name suggestions appear.

 

At this point, I would love to have both the suggestions and the command documentation tooltip available at the same time.

 

I have played around with various options and scripts in SciTE, but cannot get it working as I wish.

 

Thanks for reading!



MindCaged
  • Members
  • 191 posts
  • Last active: Jul 22 2014 06:17 PM
  • Joined: 26 Aug 2012

This is pretty good, is there any easy way I could add calltips for my user functions? Like special comments or something? I'd rather not have to edit .api files. Although from what I've seen it's not /too/ hard, just extra work. It'd be nice if it could just read the function definitions and just display them in the calltip. Like "helpFunction(p_Val1, p_Val2)" would display, and if the parameter names were descriptive enough it'd help to remember what order the arguments go.

 

I also notice there's still a few quirks. I renamed a helper function in one of my #Include files and it would not register as updated until I restarted the editor. I can understand why I suppose as it's not monitoring for changes in external files, but is there any trick to force it to update without reloading? I'd rather not have to save session, close the editor, open the editor, and load session.

 

Alternatively are there any other Autohotkey editors that have good dynamic autocomplete and calltips?



Dougal
  • Members
  • 18 posts
  • Last active: Oct 09 2015 10:31 PM
  • Joined: 21 Nov 2013

Thanks, great improvement - but we always want more. :)

 

Any chance of getting the objects methods and properties autocomplete eg GetCapacity(), SetCapacity, etc? After creating an object when I start typing "oMyObj.setca" the only autocomplete suggestion I get is SetCapsLockState, which is a command, not a method/property.

 

I found the .SetCapacity, .GetCapacity entries in ahk.api, so they seem to be present, but not being picked up by your lua script?]

 

I use the usr.lexikos.autocomplete extension, and perusing the AutoComplete.lua script seems to indicate that you are parsing the ahk.api file included with SciTE4AHK for autocomplete entries.

 

Perusing the ahk.api in the SciTE4AHK installation folder file I found the

.SetCapacity(Key, ByteSize) \nAdjusts the capacity of an object field

entry, however when typing it in SciTE4AHK the autocomplete extension doesn't autocomplete it.

 

Is there a user api where I can add extra autocomplete words? I added SetCapacity without the . to ahk.api but that didn't make any difference, and I don't want to mess with the installation files anyway  - even though ahk.api doesn't have the dramatic "DO NOT EDIT" warning in it, I still doubt editing it directly is a "good idea". :)

 

Cheers



evilc
  • Members
  • 340 posts
  • Last active: Oct 27 2015 11:07 PM
  • Joined: 17 Nov 2005

I really like this, but I have one niggle.

 

If I have a word already in my text such as MYVAR (in capitals)....

 

If I type lowercase m,y,v,a - then as soon as I hit r, it converts myvar to MYVAR, and you cannot easily change it (you have to put something at the start, then put in your lower case, then delete the letter at the start. Hitting ESC does not stop it converting the text)

 

Would it be possible to set a rule such that it only changes the text if you complete with TAB or ENTER?