Marcelos

SciTe folding by functions

1 post in this topic

HI

long time I was struggling with having folded the functions in scite, since I needed a way to have a tidy view of y code.

I use many files to hold functions, variables , forms views , etc. yet when in developing huge applications , I start having too much functions

so I decided to write a program to create the .scite.session file

I still refining it , but  I started the way ....

here is the code . I hope you find it useful

Dim $filesArray[20]
$k=0
$k = $k + 1
$filesArray[$k]="C:\Dropbox\Shared\RobertoI@MarceloSaied\FileGodMode\Main.au3"
$k = $k + 1
$filesArray[$k]="C:\Dropbox\Shared\RobertoI@MarceloSaied\FileGodMode\MainProd.au3"
$k = $k + 1
$filesArray[$k]="C:\Dropbox\Shared\RobertoI@MarceloSaied\FileGodMode\func_pos.au3"
$k = $k + 1
$filesArray[$k]="c:\Dropbox\Shared\RobertoI@MarceloSaied\FileGodMode\controls\controles.au3"
$k = $k + 1
$filesArray[$k]="c:\Dropbox\Shared\RobertoI@MarceloSaied\FileGodMode\controls\Functions.au3"
$k = $k + 1
$filesArray[$k]="c:\Dropbox\Shared\RobertoI@MarceloSaied\FileGodMode\controls\Func_general.au3"
$k = $k + 1
$filesArray[$k]="c:\Dropbox\Shared\RobertoI@MarceloSaied\FileGodMode\controls\Func_WM_NOTIFY.au3"
$k = $k + 1
$filesArray[$k]="C:\Dropbox\Shared\RobertoI@MarceloSaied\FileGodMode\controls\Func_WM_COMMAND.au3"
$k = $k + 1
$filesArray[$k]="c:\Dropbox\Shared\RobertoI@MarceloSaied\FileGodMode\variables.au3"
$k = $k + 1
$filesArray[$k]="C:\Dropbox\Shared\RobertoI@MarceloSaied\FileGodMode\controls\RunFunctions.au3"
$k = $k + 1
$filesArray[$k]="C:\Dropbox\Shared\RobertoI@MarceloSaied\FileGodMode\controls\Func_FGMagentconnector.au3"
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $k = ' & $k & @crlf )


$sessionFile="ms.session"
Local $fileSession = FileOpen($sessionFile, 2)

For $i=1 to UBound($filesArray)
    Local $file = FileOpen( $filesArray[$i], 0)

    ; Check if file opened for reading OK
    If $file = -1 Then
        ConsoleWrite("Unable to open file." &  $filesArray[$i])
        Exit
    EndIf
    $counter=0
    $result=""
    While 1
        $counter=$counter+1
        Local $line = FileReadLine($file)
        If @error = -1 Then ExitLoop
        If (StringInStr($line,"Func ")>0 And StringInStr($line,"EndFunc ")=0) Or StringInStr($line,"Case ")>0 Or StringInStr($line,"#region f-")>0 Or StringInStr($line,"#region f#")>0  Then
            $result=$result&","&$counter
        endif
    WEnd
    $linea='buffer.'&$i&'.path='& $filesArray[$i]
    FileWriteLine($fileSession,$linea)
    $linea='buffer.'&$i&'.folds='& StringTrimLeft($result,1)
    FileWriteLine($fileSession,$linea)
    ConsoleWrite('$result = ' & StringTrimLeft($result,1) & @crlf )
    FileClose($file)
next

FileClose($fileSession)

 

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