mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-01 17:23:35 -05:00
Merge from vscode a5cf1da01d5db3d2557132be8d30f89c38019f6c (#8525)
* Merge from vscode a5cf1da01d5db3d2557132be8d30f89c38019f6c * remove files we don't want * fix hygiene * update distro * update distro * fix hygiene * fix strict nulls * distro * distro * fix tests * fix tests * add another edit * fix viewlet icon * fix azure dialog * fix some padding * fix more padding issues
This commit is contained in:
@@ -5,24 +5,28 @@
|
||||
|
||||
// import * as path from 'vs/base/common/path';
|
||||
|
||||
import { /*URI,*/ UriComponents } from 'vs/base/common/uri';
|
||||
import { URI, 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 * as vscode from 'vscode';
|
||||
import * as tasks from '../common/shared/tasks';
|
||||
// import { ExtHostVariableResolverService } from 'vs/workbench/api/node/extHostDebugService';
|
||||
import * as Objects from 'vs/base/common/objects';
|
||||
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 { 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';
|
||||
import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService';
|
||||
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';
|
||||
|
||||
export class ExtHostTask extends ExtHostTaskBase {
|
||||
private _variableResolver: ExtHostVariableResolverService | undefined;
|
||||
|
||||
constructor(
|
||||
@IExtHostRpcService extHostRpc: IExtHostRpcService,
|
||||
@@ -30,9 +34,10 @@ export class ExtHostTask extends ExtHostTaskBase {
|
||||
@IExtHostWorkspace workspaceService: IExtHostWorkspace,
|
||||
@IExtHostDocumentsAndEditors editorService: IExtHostDocumentsAndEditors,
|
||||
@IExtHostConfiguration configurationService: IExtHostConfiguration,
|
||||
@IExtHostTerminalService extHostTerminalService: IExtHostTerminalService
|
||||
@IExtHostTerminalService extHostTerminalService: IExtHostTerminalService,
|
||||
@ILogService logService: ILogService
|
||||
) {
|
||||
super(extHostRpc, initData, workspaceService, editorService, configurationService, extHostTerminalService);
|
||||
super(extHostRpc, initData, workspaceService, editorService, configurationService, extHostTerminalService, logService);
|
||||
if (initData.remote.isRemote && initData.remote.authority) {
|
||||
this.registerTaskSystem(Schemas.vscodeRemote, {
|
||||
scheme: Schemas.vscodeRemote,
|
||||
@@ -69,7 +74,7 @@ export class ExtHostTask extends ExtHostTaskBase {
|
||||
if (value) {
|
||||
for (let task of value) {
|
||||
if (!task.definition || !validTypes[task.definition.type]) {
|
||||
console.warn(`The task [${task.source}, ${task.name}] uses an undefined task type. The task will be ignored in the future.`);
|
||||
this._logService.warn(`The task [${task.source}, ${task.name}] uses an undefined task type. The task will be ignored in the future.`);
|
||||
}
|
||||
|
||||
const taskDTO: tasks.TaskDTO | undefined = TaskDTO.from(task, handler.extension);
|
||||
@@ -95,9 +100,42 @@ 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;
|
||||
}
|
||||
|
||||
public async $resolveVariables(uriComponents: UriComponents, toResolve: { process?: { name: string; cwd?: string; path?: string }, variables: string[] }): Promise<{ process?: string, variables: { [key: string]: string; } }> {
|
||||
/*const configProvider = await this._configurationService.getConfigProvider();
|
||||
const uri: URI = URI.revive(uriComponents);
|
||||
/*const uri: URI = URI.revive(uriComponents);
|
||||
const result = {
|
||||
process: <unknown>undefined as string,
|
||||
variables: Object.create(null)
|
||||
@@ -107,7 +145,7 @@ export class ExtHostTask extends ExtHostTaskBase {
|
||||
if (!workspaceFolders || !workspaceFolder) {
|
||||
throw new Error('Unexpected: Tasks can only be run in a workspace folder');
|
||||
}
|
||||
const resolver = new ExtHostVariableResolverService(workspaceFolders, this._editorService, configProvider);
|
||||
const resolver = await this.getVariableResolver(workspaceFolders);
|
||||
const ws: IWorkspaceFolder = {
|
||||
uri: workspaceFolder.uri,
|
||||
name: workspaceFolder.name,
|
||||
|
||||
Reference in New Issue
Block a user