Jump to content

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

TillaGoto - Go to functions, labels & hks in your script


  • Please log in to reply
135 replies to this topic
TheGood
  • Members
  • 589 posts
  • Last active: Mar 22 2014 03:22 PM
  • Joined: 30 Jul 2007

is it just me or does the scan function not include the currently open tabs of SciTe?

i usually have a set of scripts open which represent a complete project and only the main ahk script contains the includes. so a jump to a function used within a project leads to nuffin, since it is neither in my stdLib folder nor in any includes.

probly i just overlook something...

otherwise this programm is a real ease for SciTe :)

thx so much for this one.


Hey DerRaphael,
No, it does not scan other open tabs (in any of the editors). It will only scan the current script, and any include files of that script.

Not sure what you mean by

a jump to a function used within a project leads to nuffin

If the function is listed, then TillaGoto will bring you to it when you select it.

TheGood
  • Members
  • 589 posts
  • Last active: Mar 22 2014 03:22 PM
  • Joined: 30 Jul 2007
New version released. I have to say guys, this is a huge update! I'm really happy of the ScanFile directive (partly inspired by DerRaphael's post).

Major changes:
- Added ScanFile directive
- Added ability to differentiate identically named functions/labels/hotkeys from different #Include/library files
- Aligned appended filenames to the right
- TGcache files are deleted even if last instance didn't exit properly
- Fixed bug where TillaGoto would stop showing when called
- Fixed line history not working across multiple scripts

Minor changes:
- Improved bWideView implementation (and fixed hscrollbar showing up under certain conditions)
- Improved middle click implementation
- Changed hotkey focusing behaviour
- Different symbols when appending names of include files ("#") and library files ("")
- Added bTrayIcon (default True)
- Added iControlFontSize (default 8)
- Added fControlFont (default Courier New)
- Changed default value of bCacheFiles to True
- Changed default value of iIncludeMode to 0x10100101 (scan include files for functions and append name)
- Minor fixes and improvements


About the ScanFile directive:
ScanFile allows you to force TillaGoto to always scan a file, as if it was an Include file, even though it isn't
used with the #Include directive. The directive is processed in exactly the same way as an #Include file would be.
For example, the directive ";TillaGoto.ScanFile = %A_ScriptDir%\script.ahk" will have the same effect as if
TillaGoto saw the directive "#Include %A_ScriptDir%\script.ahk". Directories to change the working directory
are also supported. The variable iIncludeMode must contain the 0x00000001 option in order to work.

  Note that the ScanFile directives are queued up and processed right after the script's actual #Include files are
scanned. Therefore, it doesn't matter where they are placed relative to the actual #Include directives, but the
order in which they are written does (in order to be able to change the working directory of subsequent ones).
The working directory is set back to %A_ScriptDir% before processing them.
  The ScanFile feature is useful when working inside a project with many satellite files. A simple ScanFile
directive to the main script in each satellite file will allow access to all the functions no matter on which
file you're working on.

About bTrayIcon:
bTrayIcon           := True     ;Set to True to show the tray icon, False to keep it hidden.

About iControlFontSize and fControlFont:
iControlFontSize    := 8        ;Specify the size of the font for the textbox and listbox.
fControlFont        := "Courier New" ;Name of the font for the textbox and listbox. Must be monospace for proper
                                ;alignment. A better font than Courier New would be Consolas.

There are also quite a lot of small and not so small changes that helps make TillaGoto more user-friendly.

derRaphael
  • Members
  • 872 posts
  • Last active: Mar 19 2013 04:42 PM
  • Joined: 23 Nov 2007
hi, since a new version of TillaGoto introduces new features, but also overrides any previously set settings, i decided to bring up this lil subroutine, which may be added to the main tillaGoto script.

it needs to be invoked after the public variables definition atm this is around line #128 with

Gosub, IniCheck

Simply add this codeblock to the tillaGoto script, so the previous mentioned gosub run will work, too

; TillaGoto IniSaver
; (w) Feb 2010 by derRaphael / Licensed under EUPL 1.1 or later
; see http://ec.europa.eu/idabc/eupl for a version in your language

IniCheck:

	SplitPath, A_ScriptName,,,, OutNameNoExt
	IniFileName := OutNameNoExt ".ini"
	 
	tg_matchWindows := "sActiveWindow,sScintillaClass,sPathMatching"
	tg_appearance   := "bTrayIcon,iGUIWidth,iGUIHeight,iMargin,iTransparency,"
					 . "bPosLeft,bWideView,cGUIBG,cControlBG,cControlFG,iControlFontSize,fControlFont"
	tg_hotkeys      := "uSummonGUI,uGoBack,uGoForward,uGotoDef"
	tg_behvaiour    := "bFilterComments,bQuickMode,bMatchEverywhere,bUseMButton,iCancelWait,"
					 . "iIncludeMode,bCacheFiles,bDirectives"

	tg_sections     := "matchWIndows,appearance,hotkeys,behaviour"
    
	tg_readIni      := ( FileExist( IniFileName ) )

	Loop, Parse, tg_sections, @,
	{
		tg_currentSection := A_LoopField
		Loop, Parse, tg_%tg_currentSection%, @,
		{
			tg_currentName  := A_LoopField
			tg_currentValue := %tg_currentName%
			
			If ( tg_readIni )
			{
				IniRead, %tg_currentName%, %IniFileName%, %tg_currentSection%, %tg_currentName%, %tg_currentValue%
			}
			Else
			{
				IniWrite, %tg_currentValue%, %IniFileName%, %tg_currentSection%, %tg_currentName%
			}
		}
	}

Return

the code is meant to do two things: on 1st run it creates an ini file and dumps all set public variables into it. on each run afterwards, it overrides the public default variables by the values found in the ini. so ... if a future version of tillaGoto is to be published, it will keep your previously set values.

greets
dR

All scripts, unless otherwise noted, are hereby released under CC-BY

wiseley
  • Members
  • 29 posts
  • Last active: Sep 30 2011 11:12 PM
  • Joined: 22 Apr 2009
It seems like your script doesn't work with AutoHotkeyU and getting text from Scintilla with the function below doesn't work either. Do you know what the problem is? :(
Sci_GetText(hSci) 
{   
    ;Used constants
    SCI_GETLENGTH := 2006
    SCI_GETTEXT := 2182
    ;Retrieve text length
    SendMessage SCI_GETLENGTH, 0, 0,, ahk_id %hSci%
    iLength := ErrorLevel   
    ;Open remote buffer (add 1 for 0 at the end of the string)
    RemoteBuf_Open(hBuf, hSci, iLength + 1)  
    ;Fill buffer with text
    SendMessage SCI_GETTEXT, iLength + 1, RemoteBuf_Get(hBuf),, ahk_id %hSci%   
    ;Read buffer
    VarSetCapacity(sText, iLength)
    RemoteBuf_Read(hBuf, sText, iLength + 1)   
    ;We're done with the remote buffer
    RemoteBuf_Close(hBuf)   
    Return sText
}


fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007
Scintilla uses either the system codepage or UTF-8.

noise
  • Members
  • 57 posts
  • Last active: Aug 31 2018 10:16 AM
  • Joined: 14 May 2009
I have found that TillaGoto will error if there is #include on the last line of the script. Not sure if it's been mentioned previously.

TheGood
  • Members
  • 589 posts
  • Last active: Mar 22 2014 03:22 PM
  • Joined: 30 Jul 2007

I have found that TillaGoto will error if there is #include on the last line of the script. Not sure if it's been mentioned previously.

Yes, I'm aware of that bug, and already fixed it for the next release.
Thanks!

TheGood
  • Members
  • 589 posts
  • Last active: Mar 22 2014 03:22 PM
  • Joined: 30 Jul 2007
New release. Mostly fixes and improvements to increase stability.

- Added sMustExist and bQuitWithEditor
- Added bAlignFilenames

- Fixed include directive scanning not following working directory changes
- Fixed #Include lines at the end of the script causing TillaGoto to stick in a loop
- Improved Include regex to support IncludeAgain and the *i option
- Improved label and hotkey scanning to include all valid labels and hotkeys

- Improved main loop and hotkey implementation
- Improved accuracy of various regexes
- Improved configuration documentation
- Improved bQuickMode implementation
- Improved filename alignment implementation
- Minor fixes and improvements
- Changed symbols when appending names of include files ("") and library files ("|") because the previous symbol was too common in hotkeys


About sMustExist and bQuitWithEditor:
bQuitWithEditor     := False    ;Set to True to make TillaGoto terminate when the editor is also terminated. If
                                ;set to True, please also see sMustExist.
sMustExist          := "ahk_class (Notepad(\+\+|2)|SciTEWindow)" ;Needed if bQuitWithEditor is True. This regex
                                ;will make TillaGoto quit if a matching window does not exist. It is currently set
                                ;to match the editors' classes, but it may be set to match anything else.


bsmagic
  • Members
  • 13 posts
  • Last active: Apr 07 2012 05:51 AM
  • Joined: 12 Aug 2010
Great work!
But there is a little bug on"Regular expression which should match the window of the editor containing the Scintilla control", if there were more than two tabs, tillaGoto would not be activated. Some fixes maybe necessary, like below:


sActiveWindow       := "\.ahk (-|\*) (Notepad(\+\+|2)|SciTE(4AutoHotkey)?( \[.*?\])?)$" ;Regular expression which


TheGood
  • Members
  • 589 posts
  • Last active: Mar 22 2014 03:22 PM
  • Joined: 30 Jul 2007
Thanks for reporting it! Which editor are you using?

guest3456
  • Guests
  • Last active:
  • Joined: --
request, make Middle Click hotkey configurable as well :)

fragman
  • Members
  • 1591 posts
  • Last active: Nov 12 2012 08:51 PM
  • Joined: 13 Oct 2009
Another suggestion, it would be nice to specify a default "main" file which contains all the includes so that no include statements for this script are needed in each file. This is useful for larger projects with lots of includes.

TheGood
  • Members
  • 589 posts
  • Last active: Mar 22 2014 03:22 PM
  • Joined: 30 Jul 2007

request, make Middle Click hotkey configurable as well :)

You mean, be able to choose the mouse button? The keyboard hotkey is configurable through uGotoDef.

Another suggestion, it would be nice to specify a default "main" file which contains all the includes so that no include statements for this script are needed in each file. This is useful for larger projects with lots of includes.

I think the ScanFile directive is what you want (check the comment block at line 113). Or I might have misunderstood what you meant.

fragman
  • Members
  • 1591 posts
  • Last active: Nov 12 2012 08:51 PM
  • Joined: 13 Oct 2009
No, I think it is not. I'm talking about a global ScanFile directive, instead of having to place that directive into every script file of a project. Or am I misunderstanding something here and it is possible to define this globally?

Edit: I tried adding
ScanScriptFile("C:\Program Files\AutoHotkey\7plus.ahk", iIncludeMode & 0x01000000, False, True)
after line 809, but it makes ahk_l (ANSI 32 bit) crash when I middle click on a function. This only happens when the recurse bit is set. I suppose it might be an infinite loop, but it's hard to tell for me without having understood the complete code.

Adding
Loop, C:\Program Files\AutoHotkey\*.ahk, 1, 1
  ScanScriptFile(A_LoopFileLongPath, 0, False, False)
at this place is not working either, even when I disable recurse and lib folder scanning.

TheGood
  • Members
  • 589 posts
  • Last active: Mar 22 2014 03:22 PM
  • Joined: 30 Jul 2007
Ah OK, I see what you mean.
Hmm... I'll consider it.

Edit: I tried adding [code=auto:0]

Definitely not the right place for it. If you want to hard hack it, put that ScanScriptFile() call at 831 instead.