Giter VIP home page Giter VIP logo

Comments (5)

jonahgraham avatar jonahgraham commented on September 28, 2024

Hi @apupier - This is handled by adding the "request": "attach" to your Launch Parameters JSON:

image

The code that does the launch or attach request is

if (isLaunchRequest) {
monitor.subTask("Launching program");
return getDebugProtocolServer().launch(dspParameters);
} else {
monitor.subTask("Attaching to running program");
return getDebugProtocolServer().attach(dspParameters);
}
with isLaunchRequest being set by
boolean isLaunchRequest = "launch".equals(dspParameters.getOrDefault("request", "launch"));

If you want to set your launch/attach based on some other UI/setting - you can intercept the creation of the debug target by overriding DSPLaunchDelegate.createDebugTarget:

/**
* For extenders/consumers of {@link DSPLaunchDelegate} who want to provide
* customization of the IDebugTarget, this method allows extenders to hook in a
* custom debug target implementation. The debug target is normally a subclass
* of {@link DSPDebugTarget}, but does not have to be. The arguments to this
* method are normally just passed to {@link DSPDebugTarget} constructor.
*/
protected IDebugTarget createDebugTarget(SubMonitor subMonitor, Runnable cleanup, InputStream inputStream,
OutputStream outputStream, ILaunch launch, Map<String, Object> dspParameters) throws CoreException {

I haven't tried this recently and I am not on a dev machine right now that allows me to quickly verify, but please let me know if this is what you were actually asking about.

from lsp4e.

jonahgraham avatar jonahgraham commented on September 28, 2024

PS. PR #56 referred to this issue, it may be updating the new docs based on the above is useful?

from lsp4e.

apupier avatar apupier commented on September 28, 2024

Ok using the "request": "attach" in the launch parameter json field is working.
is ti coming from the protocol or from the LSP4E implementation?
if from protocol, it sound sweird that there is 2 different methods if we expect this attribute.
If from LSP4E implementation, it means that we might have a collision of attributes if there is a request parameters expected.

I will update the documentation anyway to reflect current state and help other users. I spent quite some time to be able to use the launch config due to this issue so hope it will save time for others.

from lsp4e.

jonahgraham avatar jonahgraham commented on September 28, 2024

Ok using the "request": "attach" in the launch parameter json field is working.

Great :-)

is ti coming from the protocol or from the LSP4E implementation?

LSP4E implementation.

if from protocol, it sound sweird that there is 2 different methods if we expect this attribute. If from LSP4E implementation, it means that we might have a collision of attributes if there is a request parameters expected.

The request (like name and type) are attributes in the launch settings that are used by the client, not by the server. In VSCode's launch.json file format these attributes are all in the same bit of json. A debug server can't have request/name/type as attributes because of this. I don't know if vscode/dap document this limitation anywhere though - and who knows what happens if vscode decides they need a new attribute (actually I know it is likely https://github.com/weinand who makes that decision!).

Does that resolve your question(s)?

I will update the documentation anyway to reflect current state and help other users. I spent quite some time to be able to use the launch config due to this issue so hope it will save time for others.

I really appreciate you asking the question - and even more taking the time to document it for the next person!

from lsp4e.

apupier avatar apupier commented on September 28, 2024

The request (like name and type) are attributes in the launch settings that are used by the client, not by the server. In VSCode's launch.json file format these attributes are all in the same bit of json. A debug server can't have request/name/type as attributes because of this. I don't know if vscode/dap document this limitation anywhere though - and who knows what happens if vscode decides they need a new attribute (actually I know it is likely https://github.com/weinand who makes that decision!).

Does that resolve your question(s)?

yes, it does.
I think it will be useful to provide this kind of information. Maybe not only in the documentation but also directly in the UI. (maybe as a tooltip on an information icon?)

I really appreciate you asking the question - and even more taking the time to document it for the next person!

The project helps me a lot to provide a debugger for my use case. That's normal to contribute back.

from lsp4e.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.