diff --git a/src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts b/src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts index f847d1a68306d..01a6f1ca36d70 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts @@ -25,7 +25,6 @@ import { ICommandService } from 'vs/platform/commands/common/commands'; import { IDebugConfigurationProvider, ICompound, IDebugConfiguration, IConfig, IGlobalConfig, IConfigurationManager, ILaunch, IAdapterExecutable, IDebugAdapterProvider, IDebugAdapter, ITerminalSettings, ITerminalLauncher } from 'vs/workbench/parts/debug/common/debug'; import { Debugger } from 'vs/workbench/parts/debug/node/debugger'; import { IEditorService, ACTIVE_GROUP, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService'; -import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen'; import { isCodeEditor } from 'vs/editor/browser/editorBrowser'; import { launchSchemaId } from 'vs/workbench/services/configuration/common/configuration'; import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences'; @@ -33,6 +32,7 @@ import { TerminalLauncher } from 'vs/workbench/parts/debug/electron-browser/term import { Registry } from 'vs/platform/registry/common/platform'; import { IJSONContributionRegistry, Extensions as JSONExtensions } from 'vs/platform/jsonschemas/common/jsonContributionRegistry'; import { launchSchema, debuggersExtPoint, breakpointsExtPoint } from 'vs/workbench/parts/debug/common/debugSchemas'; +import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput'; const jsonRegistry = Registry.as(JSONExtensions.JSONContribution); jsonRegistry.registerSchema(launchSchemaId, launchSchema); @@ -57,7 +57,7 @@ export class ConfigurationManager implements IConfigurationManager { @IWorkspaceContextService private contextService: IWorkspaceContextService, @IEditorService private editorService: IEditorService, @IConfigurationService private configurationService: IConfigurationService, - @IQuickOpenService private quickOpenService: IQuickOpenService, + @IQuickInputService private quickInputService: IQuickInputService, @IInstantiationService private instantiationService: IInstantiationService, @ICommandService private commandService: ICommandService, @IStorageService private storageService: IStorageService, @@ -347,10 +347,11 @@ export class ConfigurationManager implements IConfigurationManager { } candidates = candidates.sort((first, second) => first.label.localeCompare(second.label)); - return this.quickOpenService.pick([...candidates, { label: 'More...', separator: { border: true } }], { placeHolder: nls.localize('selectDebug', "Select Environment") }) + const picks = candidates.map(c => ({ label: c.label, debugger: c })); + return this.quickInputService.pick<(typeof picks)[0]>([...picks, { type: 'separator', border: true }, { label: 'More...', debugger: undefined }], { placeHolder: nls.localize('selectDebug', "Select Environment") }) .then(picked => { - if (picked instanceof Debugger) { - return picked; + if (picked.debugger) { + return picked.debugger; } if (picked) { this.commandService.executeCommand('debug.installAdditionalDebuggers'); diff --git a/src/vs/workbench/parts/snippets/electron-browser/configureSnippets.ts b/src/vs/workbench/parts/snippets/electron-browser/configureSnippets.ts index c739895403565..a9bf617716534 100644 --- a/src/vs/workbench/parts/snippets/electron-browser/configureSnippets.ts +++ b/src/vs/workbench/parts/snippets/electron-browser/configureSnippets.ts @@ -9,7 +9,6 @@ import { CommandsRegistry } from 'vs/platform/commands/common/commands'; import { writeFile, exists } from 'vs/base/node/pfs'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IModeService } from 'vs/editor/common/services/modeService'; -import { IQuickOpenService, IPickOpenEntry } from 'vs/platform/quickOpen/common/quickOpen'; import { IWindowService } from 'vs/platform/windows/common/windows'; import { join, basename, dirname, extname } from 'path'; import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions'; @@ -18,6 +17,7 @@ import { IOpenerService } from 'vs/platform/opener/common/opener'; import URI from 'vs/base/common/uri'; import { ISnippetsService } from 'vs/workbench/parts/snippets/electron-browser/snippets.contribution'; import { values } from 'vs/base/common/map'; +import { IQuickPickItem, IQuickInputService, QuickPickInput } from 'vs/platform/quickinput/common/quickInput'; const id = 'workbench.action.openSnippets'; @@ -27,7 +27,7 @@ namespace ISnippetPick { } } -interface ISnippetPick extends IPickOpenEntry { +interface ISnippetPick extends IQuickPickItem { filepath: string; hint?: true; } @@ -179,22 +179,23 @@ async function createLanguageSnippetFile(pick: ISnippetPick) { CommandsRegistry.registerCommand(id, async accessor => { const snippetService = accessor.get(ISnippetsService); - const quickOpenService = accessor.get(IQuickOpenService); + const quickInputService = accessor.get(IQuickInputService); const opener = accessor.get(IOpenerService); const windowService = accessor.get(IWindowService); const modeService = accessor.get(IModeService); const envService = accessor.get(IEnvironmentService); - const { existing, future } = await computePicks(snippetService, envService, modeService); - const newGlobalPick = { label: nls.localize('new.global', "New Global Snippets file...") }; + const picks = await computePicks(snippetService, envService, modeService); + const existing: QuickPickInput[] = picks.existing; + const newGlobalPick = { label: nls.localize('new.global', "New Global Snippets file...") }; if (existing.length > 0) { - existing[0].separator = { label: nls.localize('group.global', "Existing Snippets") }; - newGlobalPick.separator = { border: true, label: nls.localize('new.global.sep', "New Snippets") }; + existing.unshift({ type: 'separator', label: nls.localize('group.global', "Existing Snippets") }); + existing.push({ type: 'separator', border: true, label: nls.localize('new.global.sep', "New Snippets") }); } else { - newGlobalPick.separator = { label: nls.localize('new.global.sep', "New Snippets") }; + existing.push({ type: 'separator', label: nls.localize('new.global.sep', "New Snippets") }); } - const pick = await quickOpenService.pick(<(IPickOpenEntry | ISnippetPick)[]>[].concat(existing, newGlobalPick, future), { + const pick = await quickInputService.pick(<(IQuickPickItem | ISnippetPick)[]>[].concat(existing, newGlobalPick, picks.future), { placeHolder: nls.localize('openSnippet.pickLanguage', "Select Snippets File or Create Snippets"), matchOnDescription: true }); diff --git a/src/vs/workbench/parts/snippets/electron-browser/insertSnippet.ts b/src/vs/workbench/parts/snippets/electron-browser/insertSnippet.ts index 581e4854c2f11..062036e19b44c 100644 --- a/src/vs/workbench/parts/snippets/electron-browser/insertSnippet.ts +++ b/src/vs/workbench/parts/snippets/electron-browser/insertSnippet.ts @@ -7,7 +7,6 @@ import * as nls from 'vs/nls'; import { TPromise } from 'vs/base/common/winjs.base'; import { registerEditorAction, ServicesAccessor, EditorAction } from 'vs/editor/browser/editorExtensions'; -import { IQuickOpenService, IPickOpenEntry } from 'vs/platform/quickOpen/common/quickOpen'; import { IModeService } from 'vs/editor/common/services/modeService'; import { LanguageId } from 'vs/editor/common/modes'; import { ICommandService, CommandsRegistry } from 'vs/platform/commands/common/commands'; @@ -16,8 +15,9 @@ import { SnippetController2 } from 'vs/editor/contrib/snippet/snippetController2 import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { Snippet } from 'vs/workbench/parts/snippets/electron-browser/snippetsFile'; +import { IQuickPickItem, IQuickInputService, QuickPickInput } from 'vs/platform/quickinput/common/quickInput'; -interface ISnippetPick extends IPickOpenEntry { +interface ISnippetPick extends IQuickPickItem { snippet: Snippet; } @@ -71,7 +71,7 @@ class InsertSnippetAction extends EditorAction { return undefined; } - const quickOpenService = accessor.get(IQuickOpenService); + const quickInputService = accessor.get(IQuickInputService); const { lineNumber, column } = editor.getPosition(); let { snippet, name, langId } = Args.fromUser(arg); @@ -116,7 +116,7 @@ class InsertSnippetAction extends EditorAction { } else { // let user pick a snippet const snippets = (await snippetService.getSnippets(languageId)).sort(Snippet.compare); - const picks: ISnippetPick[] = []; + const picks: QuickPickInput[] = []; let prevSnippet: Snippet; for (const snippet of snippets) { const pick: ISnippetPick = { @@ -125,14 +125,14 @@ class InsertSnippetAction extends EditorAction { snippet }; if (!snippet.isFromExtension && !prevSnippet) { - pick.separator = { label: nls.localize('sep.userSnippet', "User Snippets") }; + picks.push({ type: 'separator', label: nls.localize('sep.userSnippet', "User Snippets") }); } else if (snippet.isFromExtension && (!prevSnippet || !prevSnippet.isFromExtension)) { - pick.separator = { label: nls.localize('sep.extSnippet', "Extension Snippets") }; + picks.push({ type: 'separator', label: nls.localize('sep.extSnippet', "Extension Snippets") }); } picks.push(pick); prevSnippet = snippet; } - return quickOpenService.pick(picks, { matchOnDetail: true }).then(pick => resolve(pick && pick.snippet), reject); + return quickInputService.pick(picks, { matchOnDetail: true }).then(pick => resolve(pick && pick.snippet), reject); } }).then(snippet => { if (snippet) {