Open DanTup opened 4 years ago
(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:
@weinand I just found there's a checksum
field in the Source
object in the DAP, but I can't find any explanation for what it's used for (I've checked for issues and PRs both here and the DAP repo). Would that help here? Is there any info on it?
@weinand @isidorn I also don't see much about the checksums
, I assume it's something that VS uses, any idea?
@roblourens I do not know what VS uses.
I'm trying to improve the debugging experience for Flutter when using Hot Reload. There are a few places where the behaviour is currently confusing:
I thought many of these issues could be resolved by using
stackTraceRequest
in thegetStackTrace
call to give the real source code back to VS Code. This works reasonable well when the source codes are different (eg. the user modified a file and saved, but we did NOT hot reload). They end up getting a new editor window showing the source code we're executing.However, if the source files are identical, the debug experience is poor. VS Code still opens a new editor window (even though the contents are the same as what they already had open) and:
For example here, these two files are the same - the one on the left is the "real" file and the one on the right is the
sourceReference
-provided file (but with the samepath
). Notice they have different breakpoints (which cannot be distinguished in the Breakpoints list):If you toggle breakpoints in these files, the DA gets these requests:
This is confusing, because if the DA just passes the breakpoints requests on, it will flip-flop between the breakpoints depending on which file was used to set a breakpoint last.
I think VS Code could be smarter when it gets a
sourceReference
file with apath
that matches a file on disk exactly. It could open the normal editor for that file (so there is only one set of breakpoints, and the file is editable). If the user makes changes and hits step, then on the next request the contents would not match, so VS Code would open the new/different editor (which is readonly, as it represents the contents in the VM). When this new editor is opened, it should also show the breakpoints that were last sent to the DA (currently it shows nothing).I don't think this is solvable by the DA (eg. conditionally using
sourceReference
depending on whether the file is different) because the DA has no access to know whether the file is the same in the VM as the one the user sees in the editor.