Skip to content

Proposal: Support attaching multiple process #372

@ikhsan

Description

@ikhsan

Thanks for making this awesome debugger extension! Launching tests work out of the box, which is cool, although attaching to our servers don't have a ideal developer experience.

Problem

The default behaviour of the VSCode extension is to list all process and pick only one. Our setup uses 12 puma process to ensure a good developer experience. What happens now is that to debug properly, we needed to manually click and attach them 1-by-1 🥲

Screenshot 2023-10-26 at 17 20 11

Proposal

In this fork, I send custom events attachSingleSocket and the listener will start the debug just for the socket paths
4441cbc

I wonder if this capability interest other folks? If yes, we can add env variable or config (eg. SUPPORT_ATTACH_MULTI_SOCKETS or supportAttachMultiSockets) where when multiple sockets are detected, we use the multi session instead

// extension.ts; attach() method

...
const list = await this.getSockList(config);
outputChannel.appendLine(JSON.stringify(list));
switch (list.length) {
    case 0:
        vscode.window.showErrorMessage("Can not find attachable Ruby process.");
	return new DebugAdapterInlineImplementation(new StopDebugAdapter);
    case 1:
	sockPath = list[0];
	break;
    default:
        // The new behaviour controller by the new config
        // --start
	if (this.supportAttachMultiSockets) {
            const adapter = new MultiSessionDebugAdapter(list);
            return new DebugAdapterInlineImplementation(adapter);
        }				
        // --end   

        const sock = await vscode.window.showQuickPick(list);
	if (sock) {
            sockPath = sock;
	}
        else {
            return new DebugAdapterInlineImplementation(new StopDebugAdapter);
        }

...

Happy to help implementing the new capabilities if this has interests 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions