简体   繁体   中英

How to call other extensions in a extension on vscode

Here is my demand, I want to startup a debug session with some dynamic arguments. So I need to develop a extension that collect the arguments at first and register a debugger wrapper to vscode, after that I have to find a way to call the target extension's debugger with my arguments.

vscode.extensions.getExtension can get extension's informations and be able to active it only.

I found a command named "debug.startFromConfig" in vscode's sources, so I can use vscode.commands.executeCommand to execute it with my own configuration. But unfortunately I can't use vscode's api on a debug adapter, since it's not a extension host which just a single node programe.

The follow is what I expected, I have a debugger wrapper named asd调试器说明

And I'm going to override some configurations of python debugger by my own debugger.(These codes following can't work, I explained that on above) 代码

After that I can run my custom debugger to call the python debugger结果

Why are you not using the official startDebugging extension API? Please see https://github.com/microsoft/vscode/blob/31221e62995c7040400051c2353c3c7c8b303c16/src/vs/vscode.d.ts#L8874 .

Alternatively you could register a DebugConfigurationProvider for the debug types you are interested in and intercept the "resolveDebugConfiguration" method in order to adapt the launch configuration dynamically. Please see https://github.com/microsoft/vscode/blob/31221e62995c7040400051c2353c3c7c8b303c16/src/vs/vscode.d.ts#L8544 .

Yes, vscode.d.ts is your friend...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM