Closed Pacane closed 1 year ago
yes, but that looks like a lsp-dart bug indeed, I think I can take a look this weekend, can you paste the full stacktrace? just toggle-debug-on-error
and repro the error again
Debugger entered--Lisp error: (wrong-type-argument listp lsp-treemacs-generic-root)
treemacs--find-custom-node((lsp-treemacs-generic-root nil))
treemacs-find-node((lsp-treemacs-generic-root nil))
treemacs--async-update-part-complete((lsp-treemacs-generic-root nil) (lsp-treemacs-generic-root nil) nil)
#f(compiled-function (items) #<bytecode -0x4d473a5315d0888>)(nil)
#f(compiled-function (&optional btn item callback) #<bytecode -0x21cfe47310d60a2>)(#<marker (moves after insertion) at 18 in *LSP Dart tests tree*> (:label "Running tests...") #f(compiled-function (items) #<bytecode -0x4d473a5315d0888>))
treemacs-update-async-node((lsp-treemacs-generic-root nil))
treemacs-expand-extension-node(998)
treemacs--do-expand-variadic-parent(#<marker at 1 in *LSP Dart tests tree*> #s(treemacs-extension :name lsp-treemacs-generic-root :closed-state #f(compiled-function () #<bytecode 0x1f40f136d0e94>) :open-state #f(compiled-function () #<bytecode 0x1f40f136d0254>) :closed-icon #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :open-icon #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :children #f(compiled-function (&optional btn item) #<bytecode -0xd2479e64c374828>) :key #f(compiled-function (&optional btn item) #<bytecode -0xd2479e64c87e328>) :label #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :more-properties #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :child-type #f(compiled-function () #<bytecode 0x1f40f2a2ced14>) :variadic? t :async? nil :entry-point? t) 999)
treemacs--variadic-extension-entry-render(#s(treemacs-extension :name lsp-treemacs-generic-root :closed-state #f(compiled-function () #<bytecode 0x1f40f136d0e94>) :open-state #f(compiled-function () #<bytecode 0x1f40f136d0254>) :closed-icon #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :open-icon #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :children #f(compiled-function (&optional btn item) #<bytecode -0xd2479e64c374828>) :key #f(compiled-function (&optional btn item) #<bytecode -0xd2479e64c87e328>) :label #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :more-properties #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :child-type #f(compiled-function () #<bytecode 0x1f40f2a2ced14>) :variadic? t :async? nil :entry-point? t) 999)
treemacs--render-extension(#s(treemacs-extension :name lsp-treemacs-generic-root :closed-state #f(compiled-function () #<bytecode 0x1f40f136d0e94>) :open-state #f(compiled-function () #<bytecode 0x1f40f136d0254>) :closed-icon #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :open-icon #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :children #f(compiled-function (&optional btn item) #<bytecode -0xd2479e64c374828>) :key #f(compiled-function (&optional btn item) #<bytecode -0xd2479e64c87e328>) :label #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :more-properties #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :child-type #f(compiled-function () #<bytecode 0x1f40f2a2ced14>) :variadic? t :async? nil :entry-point? t) 999)
lsp-treemacs-render(((:label "Running tests...")) "Tests" t "*LSP Dart tests tree*")
lsp-dart-test-tree--render()
lsp-dart-test-show-tree()
lsp-dart-test-tree--handle-run-started()
run-hooks(lsp-dart-test-run-started-hook)
lsp-dart-test--run((:file-name "/Users/joel/code/dart/lsp_repro_test/test/dummy_te..." :names ("test(\"dummy test\")") :kind "UNIT_TEST_TEST" :code-range (51 . 136) :element-range (51 . 55)))
lsp-dart-run-test-at-point()
funcall-interactively(lsp-dart-run-test-at-point)
command-execute(lsp-dart-run-test-at-point)
Using this repro repo https://github.com/Pacane/lsp_repro_test
Go to the dummy_test.dart file, you can either SPC m t t
or SPC m t f
to run test at point/for file, and I think the error occurs on both occasions.
Any news on this? I could give more info / try to tackle the issue myself if I'm given some basic pointers what to look for maybe?
I'd be glad to help and get my hands dirty on this project.
@Pacane sorry for the delay, I just repro the issue, let me take a look and know how big is the issue or if there is a quick fix
Unfortunately, this looks like a issue on the debugger server built-in on Dart 😔:
When a exception happens during debugging, the client do a exceptionInfo
request and as defined in the DAP protocol here, the server should respond with some details in body like the description and things like that, but it's returning the raw exception string:
{
"command": "exceptionInfo",
"arguments": {
"threadId": 1
},
"type": "request",
"seq": 11
}
Received:
{
"seq": 26,
"type": "response",
"body": "#0 BaseDebugAdapter.customRequest (package:dds/src/dap/base_debug_adapter.dart:80:5)\n#1 DartDebugAdapter.customRequest (package:dds/src/dap/adapters/dart.dart:759:21)\n#2 BaseDebugAdapter.handle (package:dds/src/dap/base_debug_adapter.dart:136:20)\n#3 BaseDebugAdapter._handleIncomingRequest (package:dds/src/dap/base_debug_adapter.dart:350:7)\n#4 BaseDebugAdapter._handleIncomingMessage (package:dds/src/dap/base_debug_adapter.dart:273:7)\n#5 ByteStreamServerChannel._readMessage (package:dds/src/dap/protocol_stream.dart:82:18)\n#6 ByteStreamServerChannel.listen.<anonymous closure> (package:dds/src/dap/protocol_stream.dart:53:24)\n#7 _rootRunUnary (dart:async/zone.dart:1399:47)\n#8 _CustomZone.runUnary (dart:async/zone.dart:1300:19)\n#9 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1209:7)\n#10 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)\n#11 _DelayedData.perform (dart:async/stream_impl.dart:515:14)\n#12 _PendingEvents.handleNext (dart:async/stream_impl.dart:620:11)\n#13 _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:591:7)\n#14 _rootRun (dart:async/zone.dart:1383:47)\n#15 _CustomZone.run (dart:async/zone.dart:1293:19)\n#16 _CustomZone.runGuarded (dart:async/zone.dart:1201:7)\n#17 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1241:23)\n#18 _rootRun (dart:async/zone.dart:1391:13)\n#19 _CustomZone.run (dart:async/zone.dart:1293:19)\n#20 _CustomZone.runGuarded (dart:async/zone.dart:1201:7)\n#21 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1241:23)\n#22 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)\n#23 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)\n#24 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:122:13)\n#25 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:193:5)\n",
"command": "exceptionInfo",
"message": "Unknown command exceptionInfo",
"request_seq": 11,
"success": null
}
The body should contain the keys: exceptionId
, breakMode
and that string should go on description
.
@DanTup WDYT?
@Pacane I debugged that enabling the variable dap-print-io
@ericdallo the error is this:
"command": "exceptionInfo",
"message": "Unknown command exceptionInfo",
The Dart DAP server doesn't support this call. The client is only allowed to call it if the server has advertised support:
Clients should only call this request if the corresponding capability
supportsExceptionInfoRequest
istrue
.
We could add support for this - please file an issue at https://github.com/dart-lang/sdk. The client should be updated not to call it when not supported though.
In the meantime, exceptions should show up in the variables list (we'll respond to the Scopes
request with a set of local variables, and it should include a synthetic local for the exception on top of the stack).
Oh, that makes sense @DanTup, thank you! I'll focus first on fix dap-mode to not request that if server doesn't support it c/c @yyoncho
Debugger entered--Lisp error: (wrong-type-argument listp lsp-treemacs-generic-root) treemacs--find-custom-node((lsp-treemacs-generic-root nil)) treemacs-find-node((lsp-treemacs-generic-root nil)) treemacs--async-update-part-complete((lsp-treemacs-generic-root nil) (lsp-treemacs-generic-root nil) nil) #f(compiled-function (items) #<bytecode -0x4d473a5315d0888>)(nil) #f(compiled-function (&optional btn item callback) #<bytecode -0x21cfe47310d60a2>)(#<marker (moves after insertion) at 18 in *LSP Dart tests tree*> (:label "Running tests...") #f(compiled-function (items) #<bytecode -0x4d473a5315d0888>)) treemacs-update-async-node((lsp-treemacs-generic-root nil)) treemacs-expand-extension-node(998) treemacs--do-expand-variadic-parent(#<marker at 1 in *LSP Dart tests tree*> #s(treemacs-extension :name lsp-treemacs-generic-root :closed-state #f(compiled-function () #<bytecode 0x1f40f136d0e94>) :open-state #f(compiled-function () #<bytecode 0x1f40f136d0254>) :closed-icon #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :open-icon #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :children #f(compiled-function (&optional btn item) #<bytecode -0xd2479e64c374828>) :key #f(compiled-function (&optional btn item) #<bytecode -0xd2479e64c87e328>) :label #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :more-properties #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :child-type #f(compiled-function () #<bytecode 0x1f40f2a2ced14>) :variadic? t :async? nil :entry-point? t) 999) treemacs--variadic-extension-entry-render(#s(treemacs-extension :name lsp-treemacs-generic-root :closed-state #f(compiled-function () #<bytecode 0x1f40f136d0e94>) :open-state #f(compiled-function () #<bytecode 0x1f40f136d0254>) :closed-icon #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :open-icon #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :children #f(compiled-function (&optional btn item) #<bytecode -0xd2479e64c374828>) :key #f(compiled-function (&optional btn item) #<bytecode -0xd2479e64c87e328>) :label #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :more-properties #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :child-type #f(compiled-function () #<bytecode 0x1f40f2a2ced14>) :variadic? t :async? nil :entry-point? t) 999) treemacs--render-extension(#s(treemacs-extension :name lsp-treemacs-generic-root :closed-state #f(compiled-function () #<bytecode 0x1f40f136d0e94>) :open-state #f(compiled-function () #<bytecode 0x1f40f136d0254>) :closed-icon #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :open-icon #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :children #f(compiled-function (&optional btn item) #<bytecode -0xd2479e64c374828>) :key #f(compiled-function (&optional btn item) #<bytecode -0xd2479e64c87e328>) :label #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :more-properties #f(compiled-function (&optional btn item) #<bytecode -0xd2479df39e58928>) :child-type #f(compiled-function () #<bytecode 0x1f40f2a2ced14>) :variadic? t :async? nil :entry-point? t) 999) lsp-treemacs-render(((:label "Running tests...")) "Tests" t "*LSP Dart tests tree*") lsp-dart-test-tree--render() lsp-dart-test-show-tree() lsp-dart-test-tree--handle-run-started() run-hooks(lsp-dart-test-run-started-hook) lsp-dart-test--run((:file-name "/Users/joel/code/dart/lsp_repro_test/test/dummy_te..." :names ("test(\"dummy test\")") :kind "UNIT_TEST_TEST" :code-range (51 . 136) :element-range (51 . 55))) lsp-dart-run-test-at-point() funcall-interactively(lsp-dart-run-test-at-point) command-execute(lsp-dart-run-test-at-point)
@Pacane this is unrelated it should go away if you do clean install after restarting emacs.
Just to make sure I understand the fix, did you remove altogether the ability to run/debug a single test at point?
Both commands don't work anymore, at they don't seem to find tests anymore?
@Pacane nope, we are now just avoiding the exception during running the test, the lens weren't changed at all
Ok I'll open a new issue then, I can't run any tests now with the new version
I think unpinning lsp-dart, lsp-mode and lsp-treemacs in doom emacs fixed the issue.
I'm trying to click on the Debug code lense in a test file and I'm getting this error:
If my test fails, am I supposed to see logs somewhere?