Skip to content

Provide func tasks programmatically #936

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

Merged
merged 3 commits into from
Jan 31, 2019
Merged

Provide func tasks programmatically #936

merged 3 commits into from
Jan 31, 2019

Conversation

ejizba
Copy link
Contributor

@ejizba ejizba commented Jan 25, 2019

By providing func tasks programmatically, we get the following benefits:

  1. We can call the python extension api to get the debugger command instead of installing ptvsd into a user's project. This protects us from any breaking changes in ptvsd
  2. We can fix things under the covers without having to manually change a user's project
  3. We don't have to write as much stuff to the user's launch.json/tasks.json

I'm somewhat hesitant to merge this PR to master because it relies on a few fixes only in insiders, but I think it's worth it to give it some bake time since it affects a high priority scenario (debug) within our extension.

Fixes #822
Fixes #821

I've also filed a few issues for remaining work: #932 #933 #935

@ejizba
Copy link
Contributor Author

ejizba commented Jan 30, 2019

ping

private readonly _pythonDebugProvider: PythonDebugProvider;
private readonly _javaDebugProvider: JavaDebugProvider;

constructor(nodeDebugProvider: NodeDebugProvider, pythonDebugProvider: PythonDebugProvider, javaDebugProvider: JavaDebugProvider) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have this be part of the constructor rather than just export it from the respective files? It doesn't seem like there are any dynamic properties in the constructors for any of the DebugProviders.

if (venvName) {
command = convertToVenvCommand(venvName, process.platform, command);
}
const options: ShellExecutionOptions = { env: { languageWorkers__python__arguments: await getPythonCommand(localhost, port) } };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the Python extension supposed to handle activating the virtual environment as well? I thought that was part of the reason we wanted them to provide an API.

context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('node', nodeDebugProvider));
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('python', pythonDebugProvider));
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('java', javaDebugProvider));
context.subscriptions.push(vscode.workspace.registerTaskProvider(func, new FuncTaskProvider(nodeDebugProvider, pythonDebugProvider, javaDebugProvider)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the C# launch too simple to justify creating a FuncTaskProvider for it?

@ejizba
Copy link
Contributor Author

ejizba commented Jan 31, 2019

Discussed offline. Might add more stuff for the C# scenario in the future, but not needed right now.

ejizba added a commit that referenced this pull request Jan 31, 2019
I was having problems with tests when I tried to run them against Insiders for this PR: #936 These are just a few quality of life improvements that came out of that.
1. Use `mocha-multi-reporters` like stephen's done in other repos
1. Set `ext.ui` immediately. In some cases this will report "Unexpected call to showWarningMessage..." instead of a timeout
1. Added `runWithSetting` so that I had more control on when settings are used in tests. For example, if the `dispose` method of `FunctionTesterBase` failed at `fse.remove` these weren't getting set back
@ejizba ejizba merged commit 525604b into master Jan 31, 2019
@ejizba ejizba deleted the ej/tasksV3 branch January 31, 2019 20:11
@github-actions github-actions bot locked and limited conversation to collaborators Jan 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide func host start as a task Refactor Python launch.json/tasks.json to leverage getRemoteLauncherCommand api
2 participants