mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-06 09:35:41 -05:00
VSCode merge (#4610)
* Merge from vscode e388c734f30757875976c7e326d6cfeee77710de * fix yarn lcoks * remove small issue
This commit is contained in:
@@ -37,17 +37,17 @@ export class ConfigurationResolverService extends AbstractVariableResolverServic
|
||||
@IQuickInputService private readonly quickInputService: IQuickInputService
|
||||
) {
|
||||
super({
|
||||
getFolderUri: (folderName: string): uri => {
|
||||
getFolderUri: (folderName: string): uri | undefined => {
|
||||
const folder = workspaceContextService.getWorkspace().folders.filter(f => f.name === folderName).pop();
|
||||
return folder ? folder.uri : undefined;
|
||||
},
|
||||
getWorkspaceFolderCount: (): number => {
|
||||
return workspaceContextService.getWorkspace().folders.length;
|
||||
},
|
||||
getConfigurationValue: (folderUri: uri, suffix: string) => {
|
||||
return configurationService.getValue<string>(suffix, folderUri ? { resource: folderUri } : undefined);
|
||||
getConfigurationValue: (folderUri: uri, suffix: string): string | undefined => {
|
||||
return configurationService.getValue<string>(suffix, folderUri ? { resource: folderUri } : {});
|
||||
},
|
||||
getExecPath: () => {
|
||||
getExecPath: (): string | undefined => {
|
||||
return environmentService['execPath'];
|
||||
},
|
||||
getFilePath: (): string | undefined => {
|
||||
@@ -72,18 +72,21 @@ export class ConfigurationResolverService extends AbstractVariableResolverServic
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
getLineNumber: (): string => {
|
||||
getLineNumber: (): string | undefined => {
|
||||
const activeTextEditorWidget = editorService.activeTextEditorWidget;
|
||||
if (isCodeEditor(activeTextEditorWidget)) {
|
||||
const lineNumber = activeTextEditorWidget.getSelection().positionLineNumber;
|
||||
return String(lineNumber);
|
||||
const selection = activeTextEditorWidget.getSelection();
|
||||
if (selection) {
|
||||
const lineNumber = selection.positionLineNumber;
|
||||
return String(lineNumber);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}, windowService.getConfiguration().userEnv);
|
||||
}
|
||||
|
||||
public resolveWithInteractionReplace(folder: IWorkspaceFolder, config: any, section?: string, variables?: IStringDictionary<string>): Promise<any> {
|
||||
public resolveWithInteractionReplace(folder: IWorkspaceFolder | undefined, config: any, section?: string, variables?: IStringDictionary<string>): Promise<any> {
|
||||
// resolve any non-interactive variables
|
||||
config = this.resolveAny(folder, config);
|
||||
|
||||
@@ -100,7 +103,7 @@ export class ConfigurationResolverService extends AbstractVariableResolverServic
|
||||
});
|
||||
}
|
||||
|
||||
public resolveWithInteraction(folder: IWorkspaceFolder, config: any, section?: string, variables?: IStringDictionary<string>): Promise<Map<string, string>> {
|
||||
public resolveWithInteraction(folder: IWorkspaceFolder | undefined, config: any, section?: string, variables?: IStringDictionary<string>): Promise<Map<string, string> | undefined> {
|
||||
// resolve any non-interactive variables
|
||||
const resolved = this.resolveAnyMap(folder, config);
|
||||
config = resolved.newConfig;
|
||||
@@ -118,7 +121,7 @@ export class ConfigurationResolverService extends AbstractVariableResolverServic
|
||||
/**
|
||||
* Add all items from newMapping to fullMapping. Returns false if newMapping is undefined.
|
||||
*/
|
||||
private updateMapping(newMapping: IStringDictionary<string>, fullMapping: Map<string, string>): boolean {
|
||||
private updateMapping(newMapping: IStringDictionary<string> | undefined, fullMapping: Map<string, string>): boolean {
|
||||
if (!newMapping) {
|
||||
return false;
|
||||
}
|
||||
@@ -136,15 +139,15 @@ export class ConfigurationResolverService extends AbstractVariableResolverServic
|
||||
*
|
||||
* @param variableToCommandMap Aliases for commands
|
||||
*/
|
||||
private async resolveWithInputAndCommands(folder: IWorkspaceFolder, configuration: any, variableToCommandMap: IStringDictionary<string>, section: string): Promise<IStringDictionary<string>> {
|
||||
private async resolveWithInputAndCommands(folder: IWorkspaceFolder | undefined, configuration: any, variableToCommandMap?: IStringDictionary<string>, section?: string): Promise<IStringDictionary<string> | undefined> {
|
||||
|
||||
if (!configuration) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
// get all "inputs"
|
||||
let inputs: ConfiguredInput[] = undefined;
|
||||
if (folder && this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY) {
|
||||
let inputs: ConfiguredInput[] = [];
|
||||
if (folder && this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY && section) {
|
||||
let result = this.configurationService.getValue<any>(section, { resource: folder.uri });
|
||||
if (result) {
|
||||
inputs = result.inputs;
|
||||
@@ -222,7 +225,7 @@ export class ConfigurationResolverService extends AbstractVariableResolverServic
|
||||
* @param variable Name of the input variable.
|
||||
* @param inputInfos Information about each possible input variable.
|
||||
*/
|
||||
private showUserInput(variable: string, inputInfos: ConfiguredInput[]): Promise<string> {
|
||||
private showUserInput(variable: string, inputInfos: ConfiguredInput[]): Promise<string | undefined> {
|
||||
|
||||
// find info for the given input variable
|
||||
const info = inputInfos.filter(item => item.id === variable).pop();
|
||||
@@ -290,4 +293,4 @@ export class ConfigurationResolverService extends AbstractVariableResolverServic
|
||||
}
|
||||
}
|
||||
|
||||
registerSingleton(IConfigurationResolverService, ConfigurationResolverService, true);
|
||||
registerSingleton(IConfigurationResolverService, ConfigurationResolverService, true);
|
||||
|
||||
Reference in New Issue
Block a user