3

我正在为我的编程语言编写一个 vscode 调试适配器,但还没有弄清楚如何将配置选项传递给调试适配器。

来帮助我。你能解释一下如何做下面这个荒谬的例子吗?我只是说清楚我试图实现的目标。

我应该怎么做才能传递“css.lint.zeroUnits”、“explorer.openEditors.visible”、“workbench.editor.showTabs”等变量

对于调试适配器,以便它可以在启动时读取它们,例如这样的调试适配器:https ://github.com/Microsoft/vscode-mock-debug/blob/master/src/mockDebug.ts

我想传递少量的配置变量,它们都是由我的扩展包定义的,沿着调试适配器。

4

1 回答 1

0

如果您实施resolveDebugConfiguration,您可以将其他字段附加到args传递给launchRequest/的字段attachRequest。我们在 Dart 扩展中使用它来传递设置和事物:

    debugConfig.type = debugConfig.type || "dart";
    debugConfig.request = debugConfig.request || "launch";
    debugConfig.cwd = debugConfig.cwd || (folder && fsPath(folder.uri));
    debugConfig.args = debugConfig.args || [];
    debugConfig.vmAdditionalArgs = debugConfig.vmAdditionalArgs || conf.vmAdditionalArgs;
    debugConfig.vmServicePort = debugConfig.vmServicePort || (isChromeOS && config.useKnownChromeOSPorts ? CHROME_OS_VM_SERVICE_PORT : 0);
    debugConfig.dartPath = debugConfig.dartPath || path.join(this.sdks.dart!, dartVMPath);

这些可以args字段中读取(您可以使用接口来确保字段在两侧匹配):

protected launchRequest(response: DebugProtocol.LaunchResponse, args: DartLaunchRequestArguments): void {
    if (!args || !args.dartPath || (this.requiresProgram && !args.program)) {
于 2019-12-29T13:10:52.153 回答