actboy168 / lua-debug

Lua Debug Adapter for Visual Studio Code
MIT License
435 stars 94 forks source link

How to manually launch adapter server #165

Closed yoshi1123 closed 2 years ago

yoshi1123 commented 2 years ago

How would I manually launch lua-debug to test with my own DAP client with stdin and stdout?

actboy168 commented 2 years ago

https://github.com/actboy168/lua-debug/tree/master/examples/standalone

yoshi1123 commented 2 years ago

It works, but then it stops:

DEBUG - Message received: {'command': 'attach', 'request_seq': 1, 'seq': 4, 'success': True, 'type': 'response'}
DEBUG - Message received: {'body': {'breakpoints': []}, 'command': 'setFunctionBreakpoints', 'request_seq': 2, 'seq': 5, 'success': True, 'type': 'response'}
DEBUG - Message received: {'body': {'breakpoints': [{'id': 1, 'message': 'Wait verify.', 'verified': False}, {'id': 2, 'message': 'Wait verify.', 'verified': False}]}, 'command': 'setExceptionBreakpoints', 'request_seq': 3, 'seq': 6, 'success': True, 'type': 'response'}
DEBUG - Sending Message: {"command": "configurationDone", "seq": 4, "type": "request"}
INFO - The server has terminated with status 0
DEBUG - Closing down: Aborting request {'command': 'configurationDone', 'seq': 4, 'type': 'request'}
INFO - User Msg: Request for configurationDone aborted: Closing down
DEBUG - No server exit handler

error.log:

[2022-03-27 22:15:10:011][[string "        package.path = "../../publish/script/..."]: 23][ERROR]ERROR:../../publish/script/backend/worker/variables.lua:83: attempt to index a nil value (field 'configuration')
stack traceback:
    ../../publish/script/backend/worker/variables.lua:83: in field '?'
    ../../publish/script/backend/event.lua:8: in function 'backend.event.emit'
    ../../publish/script/backend/worker.lua:115: in local 'f'
    ../../publish/script/backend/worker.lua:52: in function <../../publish/script/backend/worker.lua:48>
    [C]: in function 'xpcall'
    ../../publish/script/backend/worker.lua:48: in upvalue 'workerThreadUpdate'
    ../../publish/script/backend/worker.lua:784: in function <../../publish/script/backend/worker.lua:782>
    (...tail calls...)
    [C]: in function 'xpcall'
    ../../publish/script/backend/worker.lua:797: in function <../../publish/script/backend/worker.lua:796>
actboy168 commented 2 years ago

Your client does not provide variables https://github.com/actboy168/lua-debug/blob/master/extension/js/configurationProvider.js#L207-L209

yoshi1123 commented 2 years ago

Okay thanks. I got it to work.

hawkinchina commented 1 year ago

@yoshi1123 how to make it work with DAP client.