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

Test dynamic extension points for Tasks, Problem Patterns, and Problem Matchers #67285

Closed
2 tasks done
alexr00 opened this issue Jan 28, 2019 · 0 comments
Closed
2 tasks done
Labels
tasks Task system issues testplan-item

Comments

@alexr00
Copy link
Member

alexr00 commented Jan 28, 2019

  • macOS @misolori
  • anyOS @mjbvz

Complexity: 3

Tests #66574.

Create a simple extension that contributes a task, a problem matcher, and a problem pattern (starting point below). Run VS Code with the extension, but don't activate it. The problem matcher should show up as a completion suggestion for the problemMatcher task property if you create a tasks.json task. Disable the extension without activating it and verify that the contributed problem matcher is no longer in the tasks.json suggestions. Verify that the task is not available if you execute the Run Task command. Finally, re-enable the extension and verify that it's contributions are available again.

"taskDefinitions": [
			{
				"type": "TestTask",
				"required": [
					"task"
				],
				"properties": {
					"task": {
						"type": "string",
						"description": "Test task"
					},
					"file": {
						"type": "string",
						"description": "Test Task"
					}
				}
			}
		],
		"problemPatterns": [
			{
				"name": "Test Problem Pattern",
				"regexp": "^test",
				"file": 1,
				"location": 2,
				"message": 3
			}
		],
		"problemMatchers": [
			{
				"name": "Test Probelm Matcher",
				"applyTo": "allDocuments",
				"pattern":{
					"regexp": "^test",
					"file": 1,
					"location": 2,
					"message": 3
				},
				"owner": "Test",
				"source": "Test"
			}
		],
let taskProvider: vscode.Disposable | undefined;

export function activate(_context: vscode.ExtensionContext): void {
	taskProvider = vscode.tasks.registerTaskProvider('TestTask', {
		provideTasks: () => {
			return Promise.resolve([new vscode.Task({type: 'TestTask', task: 'A task for testing'}, vscode.TaskScope.Workspace, 'A task for testing', 'TestTask', new vscode.ShellExecution('echo \"This is a test\"'))]);
		},
		resolveTask(_task: vscode.Task): vscode.Task | undefined {
			return undefined;
		}
	});
}

export function deactivate(): void {
	if (taskProvider) {
		taskProvider.dispose();
	}
}
@alexr00 alexr00 added tasks Task system issues testplan-item labels Jan 28, 2019
@alexr00 alexr00 added this to the December/January 2019 milestone Jan 28, 2019
@miguelsolorio miguelsolorio removed their assignment Jan 29, 2019
@mjbvz mjbvz closed this as completed Jan 30, 2019
@mjbvz mjbvz removed their assignment Jan 30, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tasks Task system issues testplan-item
Projects
None yet
Development

No branches or pull requests

3 participants