提交 5f8d991f 编写于 作者: I isidor

debug: offer 'More...' when picking debug adapter

#16171
上级 512ca3ab
......@@ -3,6 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import * as lifecycle from 'vs/base/common/lifecycle';
import * as errors from 'vs/base/common/errors';
import { IAction, IActionRunner } from 'vs/base/common/actions';
......@@ -13,7 +14,7 @@ import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';
import { SelectActionItem, IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { EventEmitter } from 'vs/base/common/eventEmitter';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IDebugService, NO_CONFIGURATIONS_LABEL } from 'vs/workbench/parts/debug/common/debug';
import { IDebugService } from 'vs/workbench/parts/debug/common/debug';
const $ = dom.$;
......@@ -106,7 +107,7 @@ export class StartDebugActionItem extends EventEmitter implements IActionItem {
private setEnabled(enabled: boolean): void {
this.selectBox.enabled = enabled;
if (!enabled) {
this.selectBox.setOptions([NO_CONFIGURATIONS_LABEL], 0);
this.selectBox.setOptions([nls.localize('noConfigurations', "No Configurations")], 0);
}
}
......
......@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import uri from 'vs/base/common/uri';
import { TPromise } from 'vs/base/common/winjs.base';
import Event from 'vs/base/common/event';
......@@ -29,7 +28,6 @@ export const CONTEXT_BREAKPOINT_WIDGET_VISIBLE = new RawContextKey<boolean>('bre
export const EDITOR_CONTRIBUTION_ID = 'editor.contrib.debug';
export const DEBUG_SCHEME = 'debug';
export const NO_CONFIGURATIONS_LABEL = nls.localize('noConfigurations', "No Configurations");
// raw
......@@ -260,7 +258,7 @@ export interface IModel extends ITreeElement {
onDidChangeReplElements: Event<void>;
};
// service enums
// Debug enums
export enum State {
Disabled,
......@@ -271,15 +269,13 @@ export enum State {
RunningNoDebug
}
// Service config
// Debug configuration interfaces
export interface IDebugConfiguration {
allowBreakpointsEverywhere: boolean;
openExplorerOnEnd: boolean;
}
// service interfaces
export interface IGlobalConfig {
version: string;
compounds: ICompound[];
......@@ -331,10 +327,6 @@ export interface IRawAdapter extends IRawEnvAdapter {
linux?: IRawEnvAdapter;
}
export interface IRawBreakpointContribution {
language: string;
}
export interface IConfigurationManager {
/**
......@@ -366,6 +358,8 @@ export interface IConfigurationManager {
canSetBreakpointsIn(model: EditorIModel): boolean;
}
// Debug service interfaces
export const IDebugService = createDecorator<IDebugService>(DEBUG_SERVICE_ID);
export interface IDebugService {
......
......@@ -22,6 +22,8 @@ import { IFileService } from 'vs/platform/files/common/files';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IExtensionsViewlet, VIEWLET_ID as EXTENSIONS_VIEWLET_ID } from 'vs/workbench/parts/extensions/common/extensions';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import * as debug from 'vs/workbench/parts/debug/common/debug';
import { Adapter } from 'vs/workbench/parts/debug/node/debugAdapter';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
......@@ -111,8 +113,12 @@ export const debuggersExtPoint = extensionsRegistry.ExtensionsRegistry.registerE
}
});
interface IRawBreakpointContribution {
language: string;
}
// breakpoints extension point #9037
export const breakpointsExtPoint = extensionsRegistry.ExtensionsRegistry.registerExtensionPoint<debug.IRawBreakpointContribution[]>('breakpoints', [], {
const breakpointsExtPoint = extensionsRegistry.ExtensionsRegistry.registerExtensionPoint<IRawBreakpointContribution[]>('breakpoints', [], {
description: nls.localize('vscode.extension.contributes.breakpoints', 'Contributes breakpoints.'),
type: 'array',
defaultSnippets: [{ body: [{ language: '' }] }],
......@@ -197,7 +203,8 @@ export class ConfigurationManager implements debug.IConfigurationManager {
@IConfigurationService private configurationService: IConfigurationService,
@IQuickOpenService private quickOpenService: IQuickOpenService,
@IConfigurationResolverService private configurationResolverService: IConfigurationResolverService,
@IInstantiationService private instantiationService: IInstantiationService
@IInstantiationService private instantiationService: IInstantiationService,
@IViewletService private viewletService: IViewletService
) {
this.adapters = [];
this.registerListeners();
......@@ -326,8 +333,21 @@ export class ConfigurationManager implements debug.IConfigurationManager {
let configFileCreated = false;
return this.fileService.resolveContent(resource).then(content => true, err =>
this.quickOpenService.pick(this.adapters, { placeHolder: nls.localize('selectDebug', "Select Environment") })
.then(adapter => adapter ? adapter.getInitialConfigurationContent() : null)
this.quickOpenService.pick([...this.adapters, { label: 'More...' }], { placeHolder: nls.localize('selectDebug', "Select Environment") })
.then(picked => {
if (picked instanceof Adapter) {
return picked ? picked.getInitialConfigurationContent() : null;
}
if (picked) {
return this.viewletService.openViewlet(EXTENSIONS_VIEWLET_ID, true)
.then(viewlet => viewlet as IExtensionsViewlet)
.then(viewlet => {
viewlet.search('tag:debuggers');
viewlet.focus();
return null;
});
}
})
.then(content => {
if (!content) {
return false;
......
......@@ -34,7 +34,7 @@ import { RawDebugSession } from 'vs/workbench/parts/debug/electron-browser/rawDe
import { Model, ExceptionBreakpoint, FunctionBreakpoint, Breakpoint, Expression, OutputNameValueElement, ExpressionContainer, Process } from 'vs/workbench/parts/debug/common/debugModel';
import { ViewModel } from 'vs/workbench/parts/debug/common/debugViewModel';
import * as debugactions from 'vs/workbench/parts/debug/browser/debugActions';
import { ConfigurationManager } from 'vs/workbench/parts/debug/node/debugConfigurationManager';
import { ConfigurationManager } from 'vs/workbench/parts/debug/electron-browser/debugConfigurationManager';
import { ToggleMarkersPanelAction } from 'vs/workbench/parts/markers/browser/markersPanelActions';
import { ITaskService, TaskEvent, TaskType, TaskServiceEvents, ITaskSummary } from 'vs/workbench/parts/tasks/common/taskService';
import { TaskError, TaskErrors } from 'vs/workbench/parts/tasks/common/taskSystem';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册