-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dap-python: support debugging of 3rd modules #386
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -194,7 +194,9 @@ overriden in individual `dap-python' launch configurations." | |
(plist-get conf :program) | ||
(buffer-file-name))) | ||
(module (plist-get conf :module)) | ||
(debugger (plist-get conf :debugger))) | ||
(debugger (plist-get conf :debugger)) | ||
(justmycode (plist-get conf :justMyCode)) | ||
(debug-options (plist-get conf :debugOptions))) | ||
(cl-remf conf :debugger) | ||
(pcase (or debugger dap-python-debugger) | ||
('ptvsd | ||
|
@@ -216,7 +218,12 @@ overriden in individual `dap-python' launch configurations." | |
(plist-put conf :debugServer debug-port) | ||
(plist-put conf :port debug-port) | ||
(plist-put conf :hostName host) | ||
(plist-put conf :host host))) | ||
(plist-put conf :host host) | ||
(when (and (not (null justmycode)) | ||
(equal justmycode :json-false)) | ||
(setq debug-options (cl-pushnew "DebugStdLib" debug-options :test #'equal)) | ||
(plist-put conf :debugOptions debug-options) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will create a duplicate if :debugOptions is specified, with this version being overriden (it will show up twice in the JSON communcation). '(:debugOptions ...) -> '(:debugOptions (DebugStdLib . ...) :debugOptions ...) |
||
(cl-remf conf :justMyCode)))) | ||
('debugpy | ||
;; If certain properties are nil, issues will arise, as debugpy expects | ||
;; them to unspecified instead. Some templates in this file set such | ||
|
@@ -238,7 +245,12 @@ overriden in individual `dap-python' launch configurations." | |
(cl-remf conf :module)) | ||
(unless (plist-get conf :cwd) | ||
(cl-remf conf :cwd)) | ||
|
||
(when (and debug-options | ||
(sequencep debug-options) | ||
(seq-contains debug-options "DebugStdLib") | ||
(null justmycode)) | ||
(warn "DebugStdLib is deprecated, use justMyCode, please consider to update your configuration.") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the backwards compatibility considerations here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd just drop that warning altogether. You could state in the README somewhere that :debugOptions is |
||
(plist-put conf :justMyCode :json-false)) | ||
(plist-put conf :dap-server-path | ||
(list python-executable "-m" "debugpy.adapter")))) | ||
(plist-put conf :program program) | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -95,8 +95,9 @@ settings. | |||||
|
||||||
A template named "Python :: Run Configuration" will appear, which | ||||||
will execute the currently visited module. This will fall short | ||||||
whenever you need to specify arguments, environment variables or | ||||||
execute a setuptools based script. In such case, define a template: | ||||||
whenever you need to specify arguments, environment variables, | ||||||
enable debugging of 3rd modules or execute a setuptools based script. | ||||||
In such case, define a template: | ||||||
|
||||||
``` elisp | ||||||
(dap-register-debug-template "My App" | ||||||
|
@@ -105,6 +106,7 @@ settings. | |||||
:cwd nil | ||||||
:env '(("DEBUG" . "1")) | ||||||
:target-module (expand-file-name "~/src/myapp/.env/bin/myapp") | ||||||
:justMyCode :json-false | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
:request "launch" | ||||||
:name "My App")) | ||||||
``` | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chaining
not
andnull
if only the result's truthynesss matters is redundant and non-idiomatic.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI,
not
andnull
are aliases.