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

[Feature Request]: Ability to programmatically set the DAP communication port. #97

Closed
dansomething opened this issue Jan 27, 2020 · 5 comments · Fixed by #99
Closed
Labels
documentation The documents are wrong/out of date/incomplete good first issue Good for newcomers

Comments

@dansomething
Copy link

Is your feature request related to a problem? Please describe.
I'd like to be able to take the communication port number result of the vscode.java.startDebugSession command and pass it to vimspector when starting it.

#3 (comment)

Describe the solution you'd like
I think what I'm looking for is a function in the vimspector public API which takes the DAP communication port as an argument. It would be callable from viml.

Describe alternatives you've considered
I haven't considered any alternatives though I'm open to anything to streamline the process of using a random DAP communication port and getting that information seamlessly passed to vimspector.

Additional context
See this ticket #3 (comment) for additional context.

@puremourning
Copy link
Owner

Looking at it, it's possible without code changes:

  • In the adapter config, change "port": "ask" to "port": "${AdapterPort}"
  • :call vimspector#LaunchWithSettings( { "AdapterPort": the_port } )

A quick test suggests that works.

@puremourning puremourning added the documentation The documents are wrong/out of date/incomplete label Jan 27, 2020
@puremourning
Copy link
Owner

puremourning commented Jan 27, 2020

I admit, of course, that vimspector#LaunchWithSettings is entirely undocumented.

For the record, it accepts a dictionary mapping variables to values.

There's also a special key configuration which can be used to launch with a specific debug configuration, e.g. call vimspector#LaunchWithSettings( #{ configuration: 'Java Launch' } ) will skip asking you which debug config to use and use that one. I use this for running tests under the debugger and within the vimspector tests

@dansomething
Copy link
Author

Ok, I'll give it a shot. In the long term would you prefer vimspector#LaunchWithSettings not be treated as a public api?

@puremourning
Copy link
Owner

Oh it should be public/documented. That’s why I’m leaving this open.

@dansomething
Copy link
Author

I've confirmed it works exactly as described.

puremourning added a commit that referenced this issue Jan 28, 2020
This is useful enough to be made public. Closes #97.
puremourning added a commit that referenced this issue Jan 28, 2020
This is useful enough to be made public. Closes #97.
puremourning added a commit that referenced this issue Jan 28, 2020
This is useful enough to be made public. Closes #97.
@mergify mergify bot closed this as completed in #99 Jan 28, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation The documents are wrong/out of date/incomplete good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants