================ @@ -0,0 +1,193 @@ +import * as vscode from "vscode"; +import { DebugProtocol } from "@vscode/debugprotocol"; + +import { DebugSessionTracker } from "../debug-session-tracker"; +import { DisposableContext } from "../disposable-context"; + +import { DAPSymbolType } from ".."; +import { getDefaultConfigKey } from "../debug-configuration-provider"; + +export class SymbolsProvider extends DisposableContext { + constructor( + private readonly tracker: DebugSessionTracker, + private readonly extensionContext: vscode.ExtensionContext, + ) { + super(); + + this.pushSubscription(vscode.commands.registerCommand( + "lldb-dap.debug.showSymbols", + () => { + const session = vscode.debug.activeDebugSession; + if (!session) return; + + this.SelectModuleAndShowSymbols(session); + }, + )); + + this.pushSubscription(vscode.commands.registerCommand( + "lldb-dap.modules.showSymbols", + (moduleItem: DebugProtocol.Module) => { + const session = vscode.debug.activeDebugSession; + if (!session) return; + + this.showSymbolsForModule(session, moduleItem); + }, + )); + + this.tracker.onDidInitializeSession((session) => { + this.GetLLDBServerVersion(session).then((version) => { + if (version !== undefined) { + if (version[0] >= 22) { + vscode.commands.executeCommand("setContext", "lldb-dap.supportsModuleSymbolsRequest", true); + } + } + }); ---------------- walter-erquinigo wrote:
I'm almost sure that you can use `registerDebugAdapterTrackerFactory` to listen to all the dap messages. You can use `onDidSendMessage(message: any): void` and `onWillReceiveMessage(message: any): void` to check for the response of the initialization request. I'm pretty sure I've done that in the past. Another way, as you describe, is to have a new command to query capabilities. I wouldn't check the version either. If the command is not supported, it would just return an error and we can just assume it's not supported. Which approach do you want to take? https://github.com/llvm/llvm-project/pull/153836 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits