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

Activate VS Code actions from command line during startup #60070

Closed
rrmistry opened this issue Oct 6, 2018 · 2 comments
Closed

Activate VS Code actions from command line during startup #60070

rrmistry opened this issue Oct 6, 2018 · 2 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues *duplicate Issue identified as a duplicate of another issue(s)

Comments

@rrmistry
Copy link

rrmistry commented Oct 6, 2018

The problem I am trying to solve is:

Use VS code as JIT debugger for .NET

I can probably solve this problem if I add vs code executable path to Windows Registry. But I would like to see a more cross-platform solution.

The way I would like to solve this problem is in such a way that it can open the door to automation and boost productivity with VS code.

My use case

The way I see this working is that my .NET code would be as such:

using System.Diagnostics;
using System.Threading;
...
// Store current process which gets passed into VS Code command line by its ID
var CurrentProcess = Process.GetCurrentProcess ();

// Start VS Code and activate a command on initialization
Process.Start ($"Code.exe --execute \"CSharp:Attach {CurrentProcess.Id}\" ");

// Now wait for VS Code to initialize
while (!Debugger.IsAttached)
   Thread.Sleep (100);

// Break the debugger at the specified location on demand (like JIT)
Debugger.Break();
...

Some Considerations

The command line can be specific to .NET Core as a minimum-viable-product (e.g. Code.exe dotnet attach 12345). But if we add the capability to execute the VS Code actions on initialization then this can support a Macro (#4490) or VS Code Script nicely.

Common functionality can be set aside in a VS Code Script file, e.g. datalake_env_setup.vscs:

# Some interaction may be required
Azure: Login
ADL: Login

# Setup environment dynamically
File: Open File
my_path/pass.usql
View: Move Editor into Right Group
File: Open File
my_path/test.usql

# Perform repetitive tasks
ADL: Compile Script

followed by Code.exe --folder-uri "C:/my_folder/" --execute "datalake_env_setup.vscs"


I am not sure if this is possible via an extension. I would love to get feedback and offer my support.
Thanks,

@isidorn
Copy link
Contributor

isidorn commented Oct 8, 2018

Dup of #10979

@isidorn isidorn closed this as completed Oct 8, 2018
@isidorn isidorn added debug Debug viewlet, configurations, breakpoints, adapter issues *duplicate Issue identified as a duplicate of another issue(s) labels Oct 8, 2018
@rrmistry
Copy link
Author

rrmistry commented Oct 9, 2018

@isidorn thank you for finding the duplicate.

My apologies for not finding it earlier.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 22, 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 *duplicate Issue identified as a duplicate of another issue(s)
Projects
None yet
Development

No branches or pull requests

2 participants