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

Process Picker: Pick process id from file #50378

Closed
rheaditi opened this issue May 24, 2018 · 4 comments
Closed

Process Picker: Pick process id from file #50378

rheaditi opened this issue May 24, 2018 · 4 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues *extension-candidate Issue identified as good extension implementation feature-request Request for new features or functionality

Comments

@rheaditi
Copy link

Issue Type: Feature Request

Hey guys!

Thanks for an awesome debugging experience. 💙

I'd previously posted a question on SO (currently unanswered at the time of this request) about debugging processes started by pm2.

tl;dr of the problem is: a process started by pm2 is not showing up in the debugger's pick process dialogue (for Attach to Node Process) for some reason. Since I'm running my server in watch mode every time I make a change I've to manually copy the process id back-and-forth for now. 😅

Feature Request:
Allow for a way for the launch configuration to pick a process to watch by fetching the pid from a file.
pm2 already maintains a pid file at a configured path.
This would be really helpful!

Thanks again :)

VS Code version: Code 1.23.1 (d0182c3, 2018-05-10T16:03:31.083Z)
OS version: Darwin x64 17.5.0

@vscodebot
Copy link

vscodebot bot commented May 24, 2018

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@roblourens
Copy link
Member

Good suggestion. An extension could do this using registerDebugConfigurationProvider. I don't know whether it should be in node-debug or not. @weinand

@roblourens roblourens added feature-request Request for new features or functionality debug Debug viewlet, configurations, breakpoints, adapter issues labels May 25, 2018
@weinand weinand self-assigned this May 25, 2018
@weinand
Copy link
Contributor

weinand commented May 25, 2018

@rheaditi there are many different ways how this problem could be tackled.

Here is a very simple one:

Just create an extension "pm2support" that implements a command pm2support.readPid that reads the pid and returns it as a string.

In your launch config you can use this command like this:

		{
			"type": "node",
			"request": "attach",
			"name": "Attach to pm2",
			"processId": "${command:pm2support.readPid}"
		},

and the code for the "pm2support" extension is this:

import * as vscode from 'vscode';

export function activate(context: vscode.ExtensionContext) {
  context.subscriptions.push(vscode.commands.registerCommand('pm2support.readPid', () => {
	let pid = // read pid from file
    return String(pid);
  }));
}

If you want to get really fancy, you could even watch for changes of the pid-file, create a launch config on the fly, fill in the pid and start a debug session....

@weinand weinand added the *extension-candidate Issue identified as good extension implementation label Sep 11, 2018
@vscodebot
Copy link

vscodebot bot commented Sep 11, 2018

We try to keep VS Code lean and we think the functionality you're asking for is great for a VS Code extension. Maybe you can already find one that suits you in the VS Code Marketplace. Just in case, in a few simple steps you can get started writing your own extension. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot closed this as completed Sep 11, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues *extension-candidate Issue identified as good extension implementation feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

3 participants