Jump to content
Sign in to follow this  
flyingboz

Add #include functions to calltips / func popup list.

Recommended Posts

flyingboz

I have been considering the issue of how to best add my libraries to the scite function list.

Ideally, the functions that are available in all incorporated #include files would be made 'automatically' added to the function calltips and / or the function popup list.

While I am completely open to suggestions, I'm thinking of a LUA script like "Refresh Function Tips" that would add / remove function definitions from the list at file open, and also be able to be invoked manually.

Any hints , tips, suggestions for design approach, potential gotchas , and/or pseudocode would be welcome, as I am a lua dabbler at best.

On another (somewhat related) note, There are also a lot of the standard UDFs that I never use, a way to flag / disable their appearance in the function list that would be supported across upgrades would reduce clutter.


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites
Valik

If your libraries are static (for the most part), then write a script (in AutoIt) to process it and generate an API file which you of course have SciTE load. API files provide the auto-complete and Calltip information. You really don't want to try to do that in Lua at run-time because you have to implement your own custom routines from scratch. If you're nice, maybe we can talk Jos into adding a new unused keyword class to SciTE so that you can also generate a keyword list so your library functions will be colored differently (Jos, this is a feature request, I think I would use this).

Now that you bring this up, I may write a script to parse my own library files and generate stuff for my own functions. I don't know when, however.

Keep in mind, the caveats with this approach would be, the library would have to be manually updated every once in awhile if you make changes to it. Even if did generate the API file at SciTE-run-time, you would have to restart SciTE in order to see the changes.

Share this post


Link to post
Share on other sites
eltorro

Share this post


Link to post
Share on other sites
Jos

Keep in mind, the caveats with this approach would be, the library would have to be manually updated every once in awhile if you make changes to it. Even if did generate the API file at SciTE-run-time, you would have to restart SciTE in order to see the changes.

When you get to it you can use this script to reload the properties files without having to restart SciTE:

;Send SciTE Director my GUI handle so it will report info back from SciTE
SendSciTE_Command("reloadproperties:")

Func SendSciTE_Command($sCmd)
    Opt("WinSearchChildren", 1)
; Get SciTE DirectorHandle
    $SciTE_hwnd = WinGetHandle("DirectorExtension")
    Local $WM_COPYDATA = 74
    Local $CmdStruct = DllStructCreate('Char[' & StringLen($sCmd) + 1 & ']')
    DllStructSetData($CmdStruct, 1, $sCmd)
    Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr')
    DllStructSetData($COPYDATA, 1, 1)
    DllStructSetData($COPYDATA, 2, StringLen($sCmd) + 1)
    DllStructSetData($COPYDATA, 3, DllStructGetPtr($CmdStruct))
    DllCall('User32.dll', 'None', 'SendMessage', 'HWnd', $SciTE_hwnd, _
            'Int', $WM_COPYDATA, 'HWnd', 0, _
            'Ptr', DllStructGetPtr($COPYDATA))
EndFunc ;==>SendSciTE_Command
Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Valik

But does that reload the API files?

Share this post


Link to post
Share on other sites
Jos

But does that reload the API files?

ummmmm Nope, just assumed to much here, but this does (tested it this time):

SendSciTE_Command("open:c:\\program files\\autoit3\\scite\\properties\\au3.properties")
SendSciTE_Command("close:")
Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
flyingboz

Did you see the Scite User CallTips

Yes. Have examined it pretty closely. The 'trick' I'm looking for is to have it dynamically display available functions based on the #includes in a .au3 script that is displayed in

the active window. Some of my libraries are dealing with XML, or Excel, or WhatHaveYou, and they are extensive enough that having them all around at once when I'm working on scripts that don't involve / need them is cluttering my workspace.

SendScite_Command()

There's a concept I hadn't even considered...

Perhaps my script should parse my library include director[y|ies], and generate calltip files, appending them to my base, and switching between them as needed, rather than parsing them dynamically at each switch. Have to test the performance of that, though I would think it would be better than having to do recurse the #include stack each time.

Valik: If you're nice, maybe we can talk Jos into adding a new unused keyword class to SciTE so that you can also generate a keyword list so your library functions will be colored differently (Jos, this is a feature request, I think I would use this).

I'll be very, very, nice.

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites
Jos

Why not just utilize the existing UDFs setup and just add a user file free to use ?

API UserUDFs is already there and for the "Coloring" we would need to to make the following changes to allow a user keywords file:

changes:

# Import the separate au3.keywords.properties file containing AutoIt3 info (based on script by Valik)

import properties\au3.keywords

import properties\au3.UserUdfs

-snip-

# UDFS

keywords8.$(au3)=$(au3.keywords.udfs) $(au3.keywords.user.udfs)

;User UDFs

au3.keywords.user.udfs=_test _test2 _test3 \

_test4


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
roach4411

I have been considering the issue of how to best add my libraries to the scite function list.

Ideally, the functions that are available in all incorporated #include files would be made 'automatically' added to the function calltips and / or the function popup list.

While I am completely open to suggestions, I'm thinking of a LUA script like "Refresh Function Tips" that would add / remove function definitions from the list at file open, and also be able to be invoked manually.

Any hints , tips, suggestions for design approach, potential gotchas , and/or pseudocode would be welcome, as I am a lua dabbler at best.

On another (somewhat related) note, There are also a lot of the standard UDFs that I never use, a way to flag / disable their appearance in the function list that would be supported across upgrades would reduce clutter.

This would be really useful, please let me know if you make any traction on this.

Thanks,

hp

Share this post


Link to post
Share on other sites
Jos

Why not just utilize the existing UDFs setup and just add a user file free to use ?

API UserUDFs is already there and for the "Coloring" we would need to to make the following changes to allow a user keywords file:

changes:

No comment means agreement ? :D

Made the changes as I proposed and will be in the next version of SciTE4AutoIt3.

Jos


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×