Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Troubles writing an IDE debugger plugin #1502

Open
lloiser opened this issue Apr 21, 2018 · 4 comments · Fixed by atom-community/atom-ide-debugger#4
Open

Troubles writing an IDE debugger plugin #1502

lloiser opened this issue Apr 21, 2018 · 4 comments · Fixed by atom-community/atom-ide-debugger#4

Comments

@lloiser
Copy link

lloiser commented Apr 21, 2018

I'm currently trying to write a atom-ide-ui debugger.
As mentioned in the README of atom-ide-ui

Debugger integrations should be modeled after atom-ide-debugger-node.

Which uses nuclide-debugger-common/AutoGenLaunchAttachProvider.

So I started a new project and added flow-bin (0.70.0) and nuclide-debugger-common (0.7.0) to my dependencies.

Now flow status reports 52 errors when I import nuclide-debugger-common/AutoGenLaunchAttachProvider.
Here is the flow status output: errors-52.txt

Once I added https://github.com/facebook/nuclide/blob/master/flow-libs/atom.js.flow to my flow-libs folder (and add it in the flowconfig too) the number dropped to 38: errors-38.txt

After adding

type IDisposable = {
  dispose(): mixed
};

to atom.js.flow the number of errors dropped to 29: errors-29.txt

I just want to build a new debugger... 😭

Here is a minimal project to reproduce it
my-debugger.zip

Am I missing something?
Or is the npm package nuclide-debugger-common faulty (and maybe others too)?

@lloiser
Copy link
Author

lloiser commented Apr 22, 2018

Beside these dependencies errors in nuclide-debugger-common, there are also some issues with the types:

https://github.com/facebook/nuclide/blob/6046ad2ab91b9f77d14470dedd7a1d3b8ef965b0/modules/atom-ide-debugger-node/main.js#L42

In getNodeConfig in the node debugger atom-ide-debugger-node a AutoGenConfig is returned.
Unfortunately the returned value is actually incompatible with the type...
e.g. the property args has a defaultValue: [] but the AutoGenProperty only allows defaultValue?: string | number | boolean

https://github.com/facebook/nuclide/blob/6046ad2ab91b9f77d14470dedd7a1d3b8ef965b0/modules/nuclide-debugger-common/types.js#L114

Pls note that I have to use the published npm package nuclide-debugger-common (currently v0.7.0).
Compared to the current master commit this has already changed. Nice, but unfortunate that it has not been published to npm...

https://github.com/facebook/nuclide/blob/17dbd6ef9dda4c9afa31af601422cb1d0a9b18bc/modules/nuclide-debugger-common/types.js#L115

I have a feeling that the whole ecosystem around developing a debugger plugin for atom-ide-ui is not ready yet...

@lloiser
Copy link
Author

lloiser commented Apr 22, 2018

Also leaving aside these problem, I now have another problem.

As suggested I tried to model my debugger based on the atom-ide-debugger-node. It uses the AutoGenLaunchAttachProvider to create the config UI and start the debugger.

Unfortunately there is no way to provide my own adaperExecutable. Which (I assume) is the actual debug adapter.

https://github.com/facebook/nuclide/blob/5aa45d09ea3caa0cd88215bbdd2e1fbe92c0ab27/modules/nuclide-debugger-common/AutoGenLaunchAttachUiComponent.js#L445

So I cannot use the AutoGen stuff and in the end have to create my own UI and start the debugger myself.

TBH this does not seem right...

https://github.com/facebook/nuclide/blob/5aa45d09ea3caa0cd88215bbdd2e1fbe92c0ab27/modules/nuclide-debugger-common/AutoGenLaunchAttachUiComponent.js#L441-L452

IMO options like adapterExecutable, capabilities and threadsComponentTitle should be configurable from the outside (and maybe have a meaningful default if none is provided).

@lloiser lloiser changed the title missing dependencies in nuclide-debugger-common? Troubles writing a ide debugger plugin Apr 22, 2018
@lloiser lloiser changed the title Troubles writing a ide debugger plugin Troubles writing an IDE debugger plugin Apr 22, 2018
@pelmers
Copy link
Contributor

pelmers commented Apr 23, 2018

@Goom11 sounds reasonable to add a way to provide an adapterExecutable.

it looks like currently the only supported ones are hardcoded in debugger-registry.js

@pelmers pelmers assigned pelmers and Goom11 and unassigned pelmers Apr 23, 2018
@vertexclique
Copy link

@pelmers yes, moreover it checks against the existing keys which are not visible from the point of debugger plugin developer. also if there is a way to supply type information to existing adapters like NATIVE_LLDB and NATIVE_GDB would be cool for other languages. So we can override them and use lldb scripting for example.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants