Skip to content
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

fix for java compile/attach args #400

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions dap-java.el
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,13 @@ CONF - the startup configuration."
Populate the arguments like normal 'Launch' request but then
initiate `compile' and attach to the process."
(dap-java--populate-launch-args conf)
(-let* (((&plist :mainClass :projectName :classPaths classpaths) conf)
(-let* (((&plist :mainClass :projectName :args :classPaths classpaths) conf)
(port (dap--find-available-port "localhost" dap-java-compile-port))
(program-to-start (format "%s -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=%s,quiet=y -cp $CLASSPATH_ARGS %s"
(program-to-start (format "%s -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=%s,quiet=y -cp $CLASSPATH_ARGS %s %s"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(program-to-start (format "%s -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=%s,quiet=y -cp $CLASSPATH_ARGS %s %s"
(program-to-start (format "%s -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=%s,quiet=y -cp $CLASSPATH_ARGS %s%s"

lsp-java-java-path
port
mainClass)))
mainClass
args)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
args)))
(and args (concat " " args)))))

This will remove a trailing whitespace in the command, also handles the case of args being nil or unspecified.

(dap-java--populate-attach-args
(list :type "java"
:request "attach"
Expand Down