Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Support attaching multiple process #372

Open
ikhsan opened this issue Oct 27, 2023 · 3 comments
Open

Proposal: Support attaching multiple process #372

ikhsan opened this issue Oct 27, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@ikhsan
Copy link
Contributor

ikhsan commented Oct 27, 2023

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 👍

@ko1
Copy link
Collaborator

ko1 commented Dec 25, 2023

attaching to the all Ruby processes from one VSCode instance?

@ikhsan
Copy link
Contributor Author

ikhsan commented Dec 25, 2023

attaching to the all Ruby processes from one VSCode instance?

indeed, this way all the processes (eg we’re using 4 processes on our setup) will all be attached and will be treated as child processes

without this, then the DX isn’t ideal as we need to select manually 4 times

@ko1 ko1 added the enhancement New feature or request label Dec 27, 2023
@ikhsan
Copy link
Contributor Author

ikhsan commented Feb 3, 2024

Got my first draft PR for the proposal: #427

Let me know what you folks think 🙏

cc @ko1 @ono-max

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants