CoffeeChaton / vscode-autohotkey-NekoHelp-Old

my style
Other
9 stars 0 forks source link

Feature request: list unused functions #11

Closed marius-sucan closed 1 year ago

marius-sucan commented 1 year ago

Hello!

It can inform users of unused variables. Could it also inform of unused /never called functions?

Best regards, Marius.

CoffeeChaton commented 1 year ago

When each input, it is necessary to re-analyze the file, but the Find Ref of Function I wrote has performance problems, at the same time some lib itself is to provide very many fn for people to use (such as GDIP+), so it is not suitable for automatic diagnosis, I intend to provide a command, and then generate an analysis report, similar to the format below, do you think there is a better way to write this format?

Translated with www.DeepL.com/Translator (free version)

Class Class_Report_fn_ref
{

    source := "exp.ahk"
    sourcePath := "D:\Dev\exp.ahk"

    __NEW() {
        ; nothing
    }

    Ref0() {
        MsgBox, 
            ( LTrim
                never user`n
                fnA()
                fnB()
                fnC()
            )
    }

    Ref1() {
        MsgBox, 
            ( LTrim
                only used in 1 place`n
                fn1A() ;ref at c:\gdip+.ahk
                fn1B() ;ref at c:ZZ.ahk 1:22
                fn1C() ;ref at c:ZZ.ahk 1:22
            )
    }

    RefMore() {
        MsgBox, 
            ( LTrim
                RefMore`n
                fnA()
                fnB()
                fnC()
            )
    }
}

MsgBox % Class_Report_fn_ref.sourcePath 

Class_Report_fn_ref.Ref0()
Class_Report_fn_ref.Ref1()
Class_Report_fn_ref.RefN()
marius-sucan commented 1 year ago

The format seems to be fine.

It does not need to be in real time, just a tool users can call/invoke.

Best regards, Marius.

CoffeeChaton commented 1 year ago

img