thqby / vscode-autohotkey2-lsp

Autohotkey v2 Language Support using vscode-lsp.
https://marketplace.visualstudio.com/items?itemName=thqby.vscode-autohotkey2-lsp
GNU Lesser General Public License v3.0
211 stars 21 forks source link

Debug Script Button ignores selected debug configuration from launch.json #533

Closed RaptorX closed 1 month ago

RaptorX commented 3 months ago

Type: Bug

when having the followin configuration:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Auto-Unsub",
            "type": "autohotkey",
            "request": "launch",
            "program": "${workspaceFolder}/Auto-Unsub.ahk",
            "args": [],
            "port": "9002-9100",
            "variableCategories": "recommend",
            "useDebugDirective": true,
            "useAutoJumpToError": true,
            "useOutputDebug": {
                "useTrailingLinebreak": true
            }
        },
        {
            "name": "Bonus",
            "type": "autohotkey",
            "request": "launch",
            "program": "${workspaceFolder}/Bonus.ahk",
            "args": [],
            "port": "9002-9100",
            "variableCategories": "recommend",
            "useDebugDirective": true,
            "useAutoJumpToError": true,
            "useOutputDebug": {
                "useTrailingLinebreak": true
            }
        }
    ]
}

Pressing the debug script button always launches the first configuration regardless of what is selected on the status bar.

Pressing the status bar and selecting Bonus correctly launches it, and now is selected. Now that is selected pressing on the Debug Script button on the UI launches Auto-Unsub instead, ignoring the previous selection.

Extension version: 2.4.5 VS Code version: Code 1.89.1 (dc96b837cf6bb4af9cd736aa3af08cf8279f7685, 2024-05-07T05:13:33.891Z) OS version: Windows_NT x64 10.0.22621 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-4460 CPU @ 3.20GHz (4 x 3198)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|31.88GB (21.65GB free)| |Process Argv|--crash-reporter-id 3e042e59-cb22-4371-968a-6f3e35abe666| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscorecescf:30445987 vscod805:30301674 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pythonmypyd1:30879173 pythoncet0:30885854 h48ei257:31000450 pythontbext0:30879054 accentitlementsc:30995553 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 jchc7451:31067544 showvideot:31016892 chatpanelt:31048053 dsvsc021:30996838 jg8ic977:31013176 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 pythonprt:31056678 dwnewjupytercf:31046870 26j00206:31048877 ```
thqby commented 3 months ago

https://github.com/thqby/vscode-autohotkey2-lsp/issues/504#issuecomment-2054109750

The debug session started from the extension does not know which configuration is selected.

RaptorX commented 3 months ago

I thought that was going to apply mainly to the F5 Shortcut.

My current use case is:

If I press F5 I use VSCode's Run and Debug because it can read my launch.json and run the chosen configuration. I will do that until the extension can do it by itself, probably with one of the suggestions lexikos mentioned... im just not very fond of little pop-ups.

If I press the UI button I expect it to run the opened file though.

I think my expectation was broken because I thought your conversation with lexikos was mainly about the F5 Shortcut which he was suggesting should behave similarly to VSCode's Run and Debug function.

thqby commented 3 months ago

It may be possible to submit a feature request to vscode to get the currently selected debugging configuration in the extension, but if the number of people who like it is less than 20, they will not consider the request.

RaptorX commented 3 months ago

the funny thing, is that the extension behaved the way I described a while back.

I think the only change that happened is that the UI debug button, now tries to read the launch.json file and as you mentioned it can only read the first configuration and cant really tell which configuration is selected.

It was not doing that before.