CoffeeChaton / vscode-autohotkey-NekoHelp-Old

my style
Other
9 stars 0 forks source link

Bugs: never used functions are actually used #17

Closed marius-sucan closed 1 year ago

marius-sucan commented 1 year ago

Hello!

I have menus that reference functions such as: Menu, OpenWithMenu, Add, &Choose external application, browseExternalApp ... and it says the function is never used. The solution is, make sure that the function is never used by a Menu command.

I also have a gLabel such as: Gui, Add, Checkbox, xs+15 y+5 Checked%uiPreferedFileStats% vuiPreferedFileStats gToggleFileStatsDating, &Generate other stats ... and it says the function is never used. The solution is: for every function name, make sure it is not used with the g prefix somewhere in the document.

It should also not consider as unused the function when i have something like this:

value := myFuncNameCall("thisSillyFunc")

myFuncNameCall(func2exec) {
  return %func2exec%()
}

thisSillyFunc() {
   Return 1
}

Both functions are used. Here, you can check for every function name, if it is passed as a string, in quotation marks, as in this code.

Thank you .

Best regards, Marius.

CoffeeChaton commented 1 year ago

https://github.com/CoffeeChaton/vscode-autohotkey-NekoHelp#find-ref-of-function

CoffeeChaton commented 1 year ago
Menu, MenuName,     Add, MenuItemName                , LabelOrSubmenu
Menu, OpenWithMenu, Add, &Choose external application, browseExternalApp

Gui, Add, Checkbox, xs+15 y+5 Checked%uiPreferedFileStats% vuiPreferedFileStats gToggleFileStatsDating, &Generate other stats

I will fix 2 case at next version.

CoffeeChaton commented 1 year ago
value := myFuncNameCall("thisSillyFunc") ;---> ref

myFuncNameCall(func2exec) {
    return %func2exec%()
}

thisSillyFunc() { ;--------------------------> def
    Return 1
}

I don't understand your question, can you provide more detailed information? For thisSillyFunc, def-ref is indexed

marius-sucan commented 1 year ago
value := myFuncNameCall("thisSillyFunc") ;---> ref

myFuncNameCall(func2exec) {
    return %func2exec%()
}

thisSillyFunc() { ;--------------------------> def
    Return 1
}

I don't understand your question, can you provide more detailed information? For thisSillyFunc, def-ref is indexed

I tested this and you are right. It seems to work. thisSillyFunc is not listed as unused.

I'm looking forward to the updated version with menus and gLabel support. I'm cleaning up my project (QPV) with the help of your extension. Thank you for your work.

Best regards, Marius.

CoffeeChaton commented 1 year ago
  1. Accidentally closed when operating github, reopened until the next version released 7 days without problems, then closed.
  2. In my test environment, except of Gui-event I still understand, the tags/function used by Menu GUI already provide syntax highlighting and jumping to definitions/references.
  3. In the previous version, it was accidentally found that the function name in ahk-v1 matched the label name exactly, I am currently fixing this problem
  4. Currently all of my functions, including syntax highlighting, formatting, and jump to references, have problems with the following, I need to think carefully.
Hotkey, KeyName
    ,Fn1 ; new line
Hotkey
     , KeyName  ; new line
    ,Fn1 ; new line

SetTimer 
   , fn1
   , 10000

fn1(){
 MsgBox, % "i am fn1"
}

codeOK

codeErr

CoffeeChaton commented 1 year ago

code Current progress (highlighted screenshot in the picture)

Jump to Definition/Reference, because we need to use mp4, the file is too big to upload.

marius-sucan commented 1 year ago

Thank you for the work you are doing.

CoffeeChaton commented 1 year ago

else

    ;NOT plan to support-----------------------
    ;https://www.autohotkey.com/docs/v1/Objects.htm#Function_References
    RetVal := %Func%(Params) ; Requires [v1.1.07+]
    RetVal := Func.Call(Params) ; Requires [v1.1.19+]
    RetVal := Func.(Params) ; Not recommended

    ;https://www.autohotkey.com/docs/v1/misc/RegExCallout.htm#callout-functions
    RegExMatch(Haystack, "i)(The) (\w+)\b(?CCallout)")
    ;                                         ^Callout

    ;https://www.autohotkey.com/docs/v1/Variables.htm#ref
    cc := fn%i%() ;
marius-sucan commented 1 year ago

It seems to be working fine in v0.0.21. Thank you <3

I closed the issue.