Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursion error #321

Open
Tracked by #214
Descolada opened this issue Mar 29, 2024 · 3 comments
Open
Tracked by #214

Recursion error #321

Descolada opened this issue Mar 29, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Descolada
Copy link

#Requires AutoHotkey v2

F1::{
    SendMode "Event"
    Loop 
        Send("a"), Send("{BS}")
}

Esc::ExitApp

; removing this class solves the error
class SomeClass {
    ; making this non-static solves the error
    static SomeName {
        get => 1
    }
}

Run the script in debugger mode, press F1 and let it run for a while (in my setup, 5-10 seconds): causes a function recursion error. I tested the same code with other debuggers (AutoHotKey Debug by Helsmy, AutoHotkey Plus Plus by Mark Wiemer) which don't cause that error. I'm running Windows 10 + AHK v2.0.10, but replicated the same error in Windows 11 as well.
Apparently under some circumstances class static properties with a getter defined lead to the problem. For example, the following class definition causes the same issue:

class SomeClass {
    static __New() {
        this.DefineProp("SomeName", {get:(this) => 1})
    }
}

I previously posted a stack trace from Visual Studio + your extension attached to it in an AHK forums post which could perhaps give some insight.

@zero-plusplus
Copy link
Owner

Thanks for the report.
I checked and it was due to IntelliSense.

IntelliSense causes communication with the debugger when a is input. This seems to be executed repeatedly, causing the session to terminate with an error.

This issue does not occur for manual input and can be completely avoided by setting false to useIntelliSenseInDebugging in launch.json.

Therefore, I will not create a hotfix and will prioritise the development of v2.0.0 and try to improve it there.

@zero-plusplus zero-plusplus added the bug Something isn't working label Mar 30, 2024
@zero-plusplus zero-plusplus mentioned this issue Mar 30, 2024
62 tasks
@Lexikos
Copy link

Lexikos commented Apr 28, 2024

I realised that this is mainly an AutoHotkey bug, as explained on the forum. It is fixed by AutoHotkey/AutoHotkey@afb1e77c.

But autocompletion definitely shouldn't need to query the script that often to discover top-level variables, and when it does query the script, it shouldn't be evaluating sub-properties of variables (maybe it has max_depth = 1 but should have max_depth = 0).

@zero-plusplus
Copy link
Owner

Thank you.

As well as the points raised, I think the autocomplete process has a lot to improve.

As the debugger adapter's own features, including autocomplete, can have side effects, I plan to disable them by default in vscode-autohotkey-debug v2.0.0 and only provide the debugger's own features whenever possible.

This means that users will need to enable the features they want to use from the advancedFeatures attribute that will be added to launch.json.

Also, source code will be implemented in a simpler way and unique features will be isolated and implemented as far as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants