mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-01 17:23:35 -05:00
Merge from vscode ad407028575a77ea387eb7cc219b323dc017b686
This commit is contained in:
committed by
Anthony Dresser
parent
404260b8a0
commit
4ad73d381c
@@ -5,17 +5,15 @@
|
||||
|
||||
// import * as path from 'vs/base/common/path';
|
||||
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { UriComponents } from 'vs/base/common/uri';
|
||||
import { win32 } from 'vs/base/node/processes';
|
||||
import * as types from 'vs/workbench/api/common/extHostTypes';
|
||||
import { IExtHostWorkspace } from 'vs/workbench/api/common/extHostWorkspace';
|
||||
import type * as vscode from 'vscode';
|
||||
import * as tasks from '../common/shared/tasks';
|
||||
import * as Objects from 'vs/base/common/objects';
|
||||
import { ExtHostVariableResolverService } from 'vs/workbench/api/common/extHostDebugService';
|
||||
// import { ExtHostVariableResolverService } from 'vs/workbench/api/common/extHostDebugService';
|
||||
import { IExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocumentsAndEditors';
|
||||
import { IExtHostConfiguration } from 'vs/workbench/api/common/extHostConfiguration';
|
||||
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { IExtHostTerminalService } from 'vs/workbench/api/common/extHostTerminalService';
|
||||
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
|
||||
@@ -23,16 +21,15 @@ import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitData
|
||||
import { ExtHostTaskBase, TaskHandleDTO, TaskDTO, CustomExecutionDTO, HandlerData } from 'vs/workbench/api/common/extHostTask';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IProcessEnvironment } from 'vs/base/common/platform';
|
||||
import { IExtHostApiDeprecationService } from 'vs/workbench/api/common/extHostApiDeprecationService';
|
||||
|
||||
export class ExtHostTask extends ExtHostTaskBase {
|
||||
private _variableResolver: ExtHostVariableResolverService | undefined;
|
||||
// private _variableResolver: ExtHostVariableResolverService | undefined; {{ SQL CARBON EDIT }}
|
||||
|
||||
constructor(
|
||||
@IExtHostRpcService extHostRpc: IExtHostRpcService,
|
||||
@IExtHostInitDataService initData: IExtHostInitDataService,
|
||||
@IExtHostWorkspace workspaceService: IExtHostWorkspace,
|
||||
@IExtHostWorkspace private readonly workspaceService: IExtHostWorkspace,
|
||||
@IExtHostDocumentsAndEditors editorService: IExtHostDocumentsAndEditors,
|
||||
@IExtHostConfiguration configurationService: IExtHostConfiguration,
|
||||
@IExtHostTerminalService extHostTerminalService: IExtHostTerminalService,
|
||||
@@ -55,7 +52,7 @@ export class ExtHostTask extends ExtHostTaskBase {
|
||||
// We have a preserved ID. So the task didn't change.
|
||||
if (tTask._id !== undefined) {
|
||||
// Always get the task execution first to prevent timing issues when retrieving it later
|
||||
const handleDto = TaskHandleDTO.from(tTask);
|
||||
const handleDto = TaskHandleDTO.from(tTask, this.workspaceService);
|
||||
const executionDTO = await this._proxy.$getTaskExecution(handleDto);
|
||||
if (executionDTO.task === undefined) {
|
||||
throw new Error('Task from execution DTO is undefined');
|
||||
@@ -115,39 +112,13 @@ export class ExtHostTask extends ExtHostTaskBase {
|
||||
return resolvedTaskDTO;
|
||||
}
|
||||
|
||||
private async getVariableResolver(workspaceFolders: vscode.WorkspaceFolder[]): Promise<ExtHostVariableResolverService> {
|
||||
if (this._variableResolver === undefined) {
|
||||
const configProvider = await this._configurationService.getConfigProvider();
|
||||
this._variableResolver = new ExtHostVariableResolverService(workspaceFolders, this._editorService, configProvider, process.env as IProcessEnvironment);
|
||||
}
|
||||
return this._variableResolver;
|
||||
}
|
||||
|
||||
protected async resolveDefinition(uri: number | UriComponents | undefined, definition: vscode.TaskDefinition | undefined): Promise<vscode.TaskDefinition | undefined> {
|
||||
if (!uri || (typeof uri === 'number') || !definition) {
|
||||
return definition;
|
||||
}
|
||||
const workspaceFolder = await this._workspaceProvider.resolveWorkspaceFolder(URI.revive(uri));
|
||||
const workspaceFolders = await this._workspaceProvider.getWorkspaceFolders2();
|
||||
if (!workspaceFolders || !workspaceFolder) {
|
||||
return definition;
|
||||
}
|
||||
const resolver = await this.getVariableResolver(workspaceFolders);
|
||||
const ws: IWorkspaceFolder = {
|
||||
uri: workspaceFolder.uri,
|
||||
name: workspaceFolder.name,
|
||||
index: workspaceFolder.index,
|
||||
toResource: () => {
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
};
|
||||
const resolvedDefinition = Objects.deepClone(definition);
|
||||
for (const key in resolvedDefinition) {
|
||||
resolvedDefinition[key] = resolver.resolve(ws, resolvedDefinition[key]);
|
||||
}
|
||||
|
||||
return resolvedDefinition;
|
||||
}
|
||||
// private async getVariableResolver(workspaceFolders: vscode.WorkspaceFolder[]): Promise<ExtHostVariableResolverService> {
|
||||
// if (this._variableResolver === undefined) {
|
||||
// const configProvider = await this._configurationService.getConfigProvider();
|
||||
// this._variableResolver = new ExtHostVariableResolverService(workspaceFolders, this._editorService, configProvider, process.env as IProcessEnvironment);
|
||||
// }
|
||||
// return this._variableResolver;
|
||||
// } {{ SQL CARBON EDIT }}
|
||||
|
||||
public async $resolveVariables(uriComponents: UriComponents, toResolve: { process?: { name: string; cwd?: string; path?: string }, variables: string[] }): Promise<{ process?: string, variables: { [key: string]: string; } }> {
|
||||
/*const uri: URI = URI.revive(uriComponents);
|
||||
@@ -186,7 +157,7 @@ export class ExtHostTask extends ExtHostTaskBase {
|
||||
paths
|
||||
);
|
||||
}
|
||||
return result;*/
|
||||
return result;*/ // {{ SQL CARBON EDIT }}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user