Closed zw963 closed 2 years ago
so maybe vscode is passing some flag or doing something lsp-dart is not, we need to debug Dart-Code/Dart-Code code and confirm that
How? i remember one friend debug my flutter app on my laptop use vscode. can you please give me some guide?
also maybe @DanTup, Dart-Code's maintainer may have any clue why debugger on lsp-dart doesn't work but it does work on vscode, ref of screen white frozen
How? i remember one friend debug my flutter app on my laptop use vscode. can you please give me some guide?
I think most debug code of vscode is here: https://github.com/Dart-Code/Dart-Code/blob/master/src/extension/providers/debug_config_provider.ts
I don't know, if following meaning debugger not work? because i saw a white background same as emacs?
Oh, so it doesn't work on vscode too?
From your screenshot, did you add a breakpoint on runApp
? if so that's why the blank screen right?
From your screenshot, did you add a breakpoint on
runApp
? if so that's why the blank screen right?
Oops, can you please confirm, if you add a break point, you device just a blank screen? i don't know ... i means it should entry home page.
After i click continue, it seem like current in a debug session.
i can saw app started by VS Code.
So, the issue still come from emacs, we never start up app like this from emacs use lsp-dart-run
, right?
yes, a black screen to me if adding a breakpoint on runApp...
runApp
is what run your flutter app, there is no reason to add a breakpoint there for your case IMO
could you test dap-debug
on emacs?
could you test
dap-debug
on emacs?
Okay, don't know why, maybe emulator used by vscode? i get the error like this
error in process filter: -map: Args out of range: 619, 1, 608 error in process filter: Args out of range: 619, 1, 608
(in fact, i meet this error like this most of time when i try to start use emacs dap-debug)
[{"event":"daemon.connected","params":{"version":"0.6.1","pid":26292}}] [{"event":"daemon.logMessage","params":{"level":"status","message":"Starting device daemon..."}}] [{"id":89635}] [{"event":"device.added","params":{"id":"chrome","name":"Chrome","platform":"web-javascript","emulator":false,"category":"web","platformType":"web","ephemeral":false,"emulatorId":null}}] [{"event":"device.added","params":{"id":"192.168.56.104:5555","name":"Xiaomi Redmi Note 7","platform":"android-x86","emulator":false,"category":"mobile","platformType":"android","ephemeral":true,"emulatorId":null}}]
hum, could be a lsp-dart bug, could you try M-x
toggle-debug-on-error
and then repro the erro again? it should print a stacktrace
I need to be off for some time now
Debugger entered--Lisp error: (args-out-of-range 619 1 608)
-map(#
dap--configure-breakpoints(#s(dap--debug-session :name "Flutter :: Debug" :last-id 7 :proc #
mapc(#f(compiled-function (m) #<bytecode 0x4f683fa56bc2ec7>) ("{\"seq\":39,\"type\":\"event\",\"event\":\"initialized\"}" "{\"seq\":40,\"type\":\"event\",\"event\":\"dart.serviceRegi..." "{\"seq\":41,\"type\":\"event\",\"event\":\"dart.serviceRegi..." "{\"seq\":42,\"type\":\"event\",\"event\":\"dart.serviceRegi..." "{\"seq\":43,\"type\":\"event\",\"event\":\"dart.serviceRegi..." "{\"seq\":44,\"type\":\"event\",\"event\":\"dart.serviceRegi..." "{\"seq\":45,\"type\":\"event\",\"event\":\"dart.serviceRegi..."))
I need to be off for some time now
Okay, current is 4:05 +0800, before dawn, i am so tired.
Debugger entered--Lisp error: (args-out-of-range 619 1 608) #((:point 619)) -map(# ((:point 619))) dap--set-breakpoints-request("/home/zw963/Stocks/marketbet_crawler/config/hot_re..." ((:point 619))) #f(compiled-function (file-name file-breakpoints) #<bytecode 0x1ca82cd411872896>)("/home/zw963/Stocks/marketbet_crawler/config/hot_re..." ((:point 619))) dap--configure-breakpoints(#s(dap--debug-session :name "Flutter :: Debug" :last-id 7 :proc # :response-handlers #<hash-table eql 4/65 0x1576b5813967> :parser #s(dap--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "") :output-buffer #
:thread-id nil :workspace nil :threads (#<hash-table equal 2/65 0x1576b154549d>) :thread-states #<hash-table eql 1/65 0x1576b5813d9b> :active-frame-id nil :active-frame nil :cursor-marker nil :state pending :breakpoints #<hash-table equal 0/65 0x1576b58149cf> :thread-stack-frames #<hash-table eql 0/65 0x1576b5814e13> :launch-args (:name "Flutter :: Debug" :type "flutter" :request "launch" :dartSdkPath "/home/zw963/flutter/bin/cache/dart-sdk/" :maxLogLineLength 2000 :cwd "/home/zw963/Dart/test_flutter_performance/" :vmAdditionalArgs "" :vmServicePort 0 :debugExternalLibraries nil :debugSdkLibraries nil :evaluateGettersInDebugViews t :evaluateToStringInDebugViews t :flutterSdkPath "/home/zw963/flutter/" :flutterTrackWidgetCreation t :useFlutterStructuredErrors t :useWriteServiceInfo t :debuggerHandlesPathsEverywhereForBreakpoints t :flutterMode "debug" :dap-server-path ("node" "/home/zw963/.emacs.d/.extension/github/Dart-Code/D..." "flutter") :output-filter-function lsp-dart-dap--output-filter-function :program "/home/zw963/Dart/test_flutter_performance/lib/main..." :deviceId "192.168.56.104:5555" :deviceName "Xiaomi Redmi Note 7" :flutterPlatform "default") :current-capabilities #<hash-table equal 10/65 0x1576b18ea4b3> :error-message nil :loaded-sources nil :program-proc nil :metadata #<hash-table eql 0/65 0x1576b18ea46d> :output-displayed t) #<hash-table equal 12/65 0x1576b18b27a7> #f(compiled-function (&rest args2) #<bytecode -0xae5b6245831045d>)) dap--on-event(#s(dap--debug-session :name "Flutter :: Debug" :last-id 7 :proc # :response-handlers #<hash-table eql 4/65 0x1576b5813967> :parser #s(dap--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "") :output-buffer # :thread-id nil :workspace nil :threads (#<hash-table equal 2/65 0x1576b154549d>) :thread-states #<hash-table eql 1/65 0x1576b5813d9b> :active-frame-id nil :active-frame nil :cursor-marker nil :state pending :breakpoints #<hash-table equal 0/65 0x1576b58149cf> :thread-stack-frames #<hash-table eql 0/65 0x1576b5814e13> :launch-args (:name "Flutter :: Debug" :type "flutter" :request "launch" :dartSdkPath "/home/zw963/flutter/bin/cache/dart-sdk/" :maxLogLineLength 2000 :cwd "/home/zw963/Dart/test_flutter_performance/" :vmAdditionalArgs "" :vmServicePort 0 :debugExternalLibraries nil :debugSdkLibraries nil :evaluateGettersInDebugViews t :evaluateToStringInDebugViews t :flutterSdkPath "/home/zw963/flutter/" :flutterTrackWidgetCreation t :useFlutterStructuredErrors t :useWriteServiceInfo t :debuggerHandlesPathsEverywhereForBreakpoints t :flutterMode "debug" :dap-server-path ("node" "/home/zw963/.emacs.d/.extension/github/Dart-Code/D..." "flutter") :output-filter-function lsp-dart-dap--output-filter-function :program "/home/zw963/Dart/test_flutterperformance/lib/main..." :deviceId "192.168.56.104:5555" :deviceName "Xiaomi Redmi Note 7" :flutterPlatform "default") :current-capabilities #<hash-table equal 10/65 0x1576b18ea4b3> :error-message nil :loaded-sources nil :program-proc nil :metadata #<hash-table eql 0/65 0x1576b18ea46d> :output-displayed t) #<hash-table equal 3/65 0x1576b3b0cd05>) #f(compiled-function (m) #<bytecode 0x4f683fa56bc2ec7>)("{"seq":39,"type":"event","event":"initialized"}") mapc(#f(compiled-function (m) #<bytecode 0x4f683fa56bc2ec7>) ("{"seq":39,"type":"event","event":"initialized"}" "{"seq":40,"type":"event","event":"dart.serviceRegi..." "{"seq":41,"type":"event","event":"dart.serviceRegi..." "{"seq":42,"type":"event","event":"dart.serviceRegi..." "{"seq":43,"type":"event","event":"dart.serviceRegi..." "{"seq":44,"type":"event","event":"dart.serviceRegi..." "{"seq":45,"type":"event","event":"dart.serviceRegi...")) #f(compiled-function ( msg) #<bytecode 0xa2d204d2092f4eb>)(# "Content-Length: 47\15\n\15\n{"seq":39,"type":"event","ev...")
If above backtrace useful? in fact, i give you several times, but, this time, maybe more useful because less noise.
Sounds like a issue here, it'd need further debugging on dap-mode side
Sounds like a issue here
Cool! if we can fix this after tomorrow wake up? i am waiting debug feature working on emacs for a long long time.
you can go off for you things, if still need more detail? if you need more context, i will send to you, and sleep ...
I upload all my package + downloaded dart client files https://zw963.github.io/package.zip, if this issue about emacs lisp code (not others), i guess you can reproduce on it, with only following config:
(require 'dart-mode) (require 'lsp-mode) (require 'lsp-dart) (require 'lsp-ui) (require 'lsp-modeline) (require 'lsp-headerline) (require 'lsp-treemacs) (require 'dap-mode) (require 'dap-ui) (require 'dap-mouse) (require 'flycheck) (require 'company)
(setq lsp-dart-flutter-widget-guides nil) (add-hook 'dart-mode-hook 'lsp) (add-to-list 'auto-mode-alist '("\.dart\'" . dart-mode))
BTW: dap-go can work on my emacs.
Hi, @ericdallo , I really found a issue which exists on my Arch Linux + following official version.
╰─ $ flutter --version
Flutter 2.8.1 • channel unknown • unknown source
Framework • revision 77d935af4d (2 weeks ago) • 2021-12-16 08:37:33 -0800
Engine • revision 890a5fca2e
Tools • Dart 2.15.1
When i want to build a flutter project the FIRST TIME for a android emulator device, i must specify my device explicitly.
flutter run -d 192.168.56.101:5555
that, is, if i am not specify it, when i run flutter run
, it told me "Launching lib/main.dart on Xiaomi Redmi Note 7 in debug mode..." That device name is right, but, it keep blocking on Running Gradle task 'assembleDebug'..
step, i am waiting for more than ten minutes, it still running, but, when if i specify device explicitly, like this:
but, if only exists one chrome device, it can build successful without specify -d.
it only need less one minutes to start run on my phone.
I don't know if this issue relative to my issue, just report here.
Okay, that maybe not this issue, because, after i reboot, and create a new project, it works when flutter run
.
i guess, we need one successful building to create the connection for flutter with genymotion, anyway, please ignore my message.
@ericdallo sorry for the delay - I scanned through the above although I'm not certain what the current state of the issue is (I'm unfamiliar with the Emacs integration). If you think it's likely something form Dart-Code's DAP (or that it may require my input to debug), please let me know!
Thanks @DanTup, I out of options here as well unfortunately
Can i help on debug? @DanTup , @ericdallo ?
@zw963 can you describe exactly what the issue is? There were a few different things mentioned above so I'm not sure exactly which issues are remaining.
If the issue only occurs from Emacs and not VS Code, then it may be useful to capture a log from VS Code:
This log will include all of the arguments passed to the debug adapter, so if they are different to Emacs it could be clear. (note: VS Code will pass -d
and the ID of the device selected in the status bar).
@DanTup , okay, wait a seconds, i write somethings now.
Sorry, it so wired, i guess i run it successful now, right? @ericdallo
I update my node to latest 16.13.1 stable version. I update my dart dap extension "3.28.0"
It starts to work now ...
yes, you can use dap-continue
, dap-step-in
, dap-step-out
and all dap-mode stuff to debug, it seems to work now :)
I should bump dap-extension to latest and do a release if we confirm this issue is "Fixed" now
I update my node to latest 16.13.1 stable version. I update my dart dap extension "3.28.0"
It starts to work now ...
I test all button, it seem like all feature works, though, i still not familiar debug use emacs, but, anyway, it works!
I am so wired why it start working now, i update to newest version nodejs version several month ago, but because dart dap not work, i downgrade to 14, still not work, then i updated to 17.X newest version, not work, then i install stable 16.13.1 today, it works with this version.
And, i do update dart dap extension use lsp-dart-dap-setup
several times yesterday, one once today, i don't know what happen, but it works now!
I intend to remove the node extension integration soon for dart sdks that already support the dap debugger, @DanTup thanks for the help! I should release a new version soon @zw963 with those other fixes
I intend to remove the node extension integration soon for dart sdks that already support the dap debugger, @DanTup thanks for the help!
Okay, happen to hear this. BTW, i test on lsp-dart-run
, it works too, i can hot reload code as expected too.
@DanTup , Thank you very much, when i come here, all issue is gone~
Released lsp-dart 1.21.0
Released lsp-dart 1.21.0
Okay, wait a second, i will test on it.
sorry, one more question, should we start lsp mode first, then start dart-mode with lsp, or reverse? which is better?
dap-mode require lsp-mode, so lsp-mode first
Hi, i updated to use 1.21,0, Dart-Code/3.32.0, it works!
Hi, i don't know why dap start work now after many research, i consider because i keep using old 3.25.1, never update to 3.28.0, but anyway, if this issue happen again, i will find the reason!
@ericdallo , sorry, need double confirm one question, if we ever support auto add import statement when a class was be checked is missing, or, it always need use click then add import statement?
I remember before lsp-dart can auto insert import statement for me? but after update, it not support anymore, need a click to confirm, or, just because i am remember wrong?
Thank you.
AFAIK only via code actions or manually, nothing automatically
FWIW, the LSP server does support automatically inserting completions (the edits should be included in the additionalTextEdits
on a completion item, although it will need resolving first). I don't know whether your LSP client supports this though.
@DanTup yes, lsp-mode does supports that and I actually use that with Clojure via clojure-lsp LSP server, it works perfectly, does Dart SDK already has this feature or we would need to add to the analysis_server?
@ericdallo it's already there. It does require that you're calling completion/resolve
for the item being completed though (the edits are computed lazily and not up-front for every item).
yes, it makes sense, via the completion/resolveItem
right? if so, I think it should work already, do you have an dart code example?
@ericdallo it should just work everywhere. For example if you open a completely blank .dart
file and begin typing File
, but select it from the completion, it should add an import for dart:io
.
If that doesn't work, could you capture a log and see if resolveItem
is being called (and if so, if the additionalTextEdits
are in the response)?
Yeah, I confirmed it works as expected with dart SDK 2.15.1!
Neat :) I would've expected there to be two entries - one that auto-imports from dart:io
and one from dart:html
I think. The difference shows up in the details
field after resolving. It's possible there's some de-duping going on in the client though? 🤔
Hum, good question, but my guess is that we have no dedupe c/c @yyoncho Anyway, thanks for the help as always @DanTup, it seems to be some issue on @zw963 config, maybe a outdated flutter/dart SDK?
Possible - though it's been in there for a while. It's also possible to disable it with the suggestFromUnimportedLibraries
setting, but it defaults to on.
Describe the bug
I am a new to dap, when i want to use dap-mode to debug a working flutter, i get following error.
Debug session process exited with status: killed
To Reproduce
Following is minimum config:
After use this config open a dart file in a flutter project.
run lsp success.
run lsp-dart-dap-setup successful
Try debug on line 4
select Flutter::Debug as template
select a device to run.
Because both of device can run successful on my local laptop with
flutter run -d linux
, orflutter run -d web
.so, i just select one of them. linux
get following error message
Processing ... Debug session process exited with status: killed
Version