mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-19 22:59:48 +01:00
@@ -10,7 +10,7 @@
|
||||
color-picker: [],
|
||||
css-less-sass: [ aeschli ],
|
||||
debug: {
|
||||
assignees: [ weinand ],
|
||||
assignees: [ isidorn ],
|
||||
assignLabel: false
|
||||
},
|
||||
diff-editor: [],
|
||||
|
||||
@@ -269,7 +269,7 @@ function registerEditorCommands() {
|
||||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
|
||||
when: void 0,
|
||||
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_U),
|
||||
handler: (accessor, resource: URI, context: IEditorCommandsContext) => {
|
||||
handler: (accessor, resource: URI | {}, context: IEditorCommandsContext) => {
|
||||
const editorGroupService = accessor.get(IEditorGroupService);
|
||||
const model = editorGroupService.getStacksModel();
|
||||
const editorService = accessor.get(IWorkbenchEditorService);
|
||||
@@ -299,7 +299,7 @@ function registerEditorCommands() {
|
||||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
|
||||
when: void 0,
|
||||
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_W),
|
||||
handler: (accessor, resource: URI, context: IEditorCommandsContext) => {
|
||||
handler: (accessor, resource: URI | {}, context: IEditorCommandsContext) => {
|
||||
const editorGroupService = accessor.get(IEditorGroupService);
|
||||
const editorService = accessor.get(IWorkbenchEditorService);
|
||||
const contexts = getMultiSelectedEditorContexts(context, accessor.get(IListService));
|
||||
@@ -324,7 +324,7 @@ function registerEditorCommands() {
|
||||
when: void 0,
|
||||
primary: KeyMod.CtrlCmd | KeyCode.KEY_W,
|
||||
win: { primary: KeyMod.CtrlCmd | KeyCode.F4, secondary: [KeyMod.CtrlCmd | KeyCode.KEY_W] },
|
||||
handler: (accessor, resource: URI, context: IEditorCommandsContext) => {
|
||||
handler: (accessor, resource: URI | {}, context: IEditorCommandsContext) => {
|
||||
const editorGroupService = accessor.get(IEditorGroupService);
|
||||
const editorService = accessor.get(IWorkbenchEditorService);
|
||||
|
||||
@@ -373,7 +373,7 @@ function registerEditorCommands() {
|
||||
when: void 0,
|
||||
primary: void 0,
|
||||
mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_T },
|
||||
handler: (accessor, resource: URI, context: IEditorCommandsContext) => {
|
||||
handler: (accessor, resource: URI | {}, context: IEditorCommandsContext) => {
|
||||
const editorGroupService = accessor.get(IEditorGroupService);
|
||||
const editorService = accessor.get(IWorkbenchEditorService);
|
||||
const contexts = getMultiSelectedEditorContexts(context, accessor.get(IListService));
|
||||
|
||||
@@ -34,6 +34,7 @@ export class BreakpointWidget extends ZoneWidget {
|
||||
private hitCountContext: boolean;
|
||||
private hitCountInput: string;
|
||||
private conditionInput: string;
|
||||
private breakpoint: IBreakpoint;
|
||||
|
||||
constructor(editor: ICodeEditor, private lineNumber: number, private column: number,
|
||||
@IContextViewService private contextViewService: IContextViewService,
|
||||
@@ -45,6 +46,14 @@ export class BreakpointWidget extends ZoneWidget {
|
||||
this.toDispose = [];
|
||||
this.hitCountInput = '';
|
||||
this.conditionInput = '';
|
||||
const uri = this.editor.getModel().uri;
|
||||
this.breakpoint = this.debugService.getModel().getBreakpoints().filter(bp => bp.lineNumber === this.lineNumber && bp.column === this.column && bp.uri.toString() === uri.toString()).pop();
|
||||
|
||||
this.toDispose.push(this.debugService.getModel().onDidChangeBreakpoints(e => {
|
||||
if (this.breakpoint && e.removed && e.removed.indexOf(this.breakpoint) >= 0) {
|
||||
this.dispose();
|
||||
}
|
||||
}));
|
||||
this.create();
|
||||
}
|
||||
|
||||
@@ -66,10 +75,7 @@ export class BreakpointWidget extends ZoneWidget {
|
||||
|
||||
protected _fillContainer(container: HTMLElement): void {
|
||||
this.setCssClass('breakpoint-widget');
|
||||
const uri = this.editor.getModel().uri;
|
||||
const breakpoint = this.debugService.getModel().getBreakpoints().filter(bp => bp.lineNumber === this.lineNumber && bp.column === this.column && bp.uri.toString() === uri.toString()).pop();
|
||||
|
||||
this.hitCountContext = breakpoint && breakpoint.hitCondition && !breakpoint.condition;
|
||||
this.hitCountContext = this.breakpoint && this.breakpoint.hitCondition && !this.breakpoint.condition;
|
||||
const selected = this.hitCountContext ? 1 : 0;
|
||||
const selectBox = new SelectBox([nls.localize('expression', "Expression"), nls.localize('hitCount', "Hit Count")], selected, this.contextViewService);
|
||||
this.toDispose.push(attachSelectBoxStyler(selectBox, this.themeService));
|
||||
@@ -84,7 +90,7 @@ export class BreakpointWidget extends ZoneWidget {
|
||||
|
||||
this.inputBox.setAriaLabel(this.ariaLabel);
|
||||
this.inputBox.setPlaceHolder(this.placeholder);
|
||||
this.inputBox.value = this.getInputBoxValue(breakpoint);
|
||||
this.inputBox.value = this.getInputBoxValue(this.breakpoint);
|
||||
});
|
||||
|
||||
const inputBoxContainer = dom.append(container, $('.inputBoxContainer'));
|
||||
@@ -96,7 +102,7 @@ export class BreakpointWidget extends ZoneWidget {
|
||||
this.toDispose.push(this.inputBox);
|
||||
|
||||
dom.addClass(this.inputBox.inputElement, isWindows ? 'windows' : isMacintosh ? 'mac' : 'linux');
|
||||
this.inputBox.value = this.getInputBoxValue(breakpoint);
|
||||
this.inputBox.value = this.getInputBoxValue(this.breakpoint);
|
||||
// Due to an electron bug we have to do the timeout, otherwise we do not get focus
|
||||
setTimeout(() => this.inputBox.focus(), 0);
|
||||
|
||||
@@ -106,11 +112,9 @@ export class BreakpointWidget extends ZoneWidget {
|
||||
disposed = true;
|
||||
if (success) {
|
||||
// if there is already a breakpoint on this location - remove it.
|
||||
const oldBreakpoint = this.debugService.getModel().getBreakpoints()
|
||||
.filter(bp => bp.lineNumber === this.lineNumber && bp.column === this.column && bp.uri.toString() === uri.toString()).pop();
|
||||
|
||||
let condition = oldBreakpoint && oldBreakpoint.condition;
|
||||
let hitCondition = oldBreakpoint && oldBreakpoint.hitCondition;
|
||||
let condition = this.breakpoint && this.breakpoint.condition;
|
||||
let hitCondition = this.breakpoint && this.breakpoint.hitCondition;
|
||||
|
||||
if (this.hitCountContext) {
|
||||
hitCondition = this.inputBox.value;
|
||||
@@ -124,18 +128,18 @@ export class BreakpointWidget extends ZoneWidget {
|
||||
}
|
||||
}
|
||||
|
||||
if (oldBreakpoint) {
|
||||
this.debugService.updateBreakpoints(oldBreakpoint.uri, {
|
||||
[oldBreakpoint.getId()]: {
|
||||
if (this.breakpoint) {
|
||||
this.debugService.updateBreakpoints(this.breakpoint.uri, {
|
||||
[this.breakpoint.getId()]: {
|
||||
condition,
|
||||
hitCondition,
|
||||
verified: oldBreakpoint.verified
|
||||
verified: this.breakpoint.verified
|
||||
}
|
||||
}, false);
|
||||
} else {
|
||||
this.debugService.addBreakpoints(uri, [{
|
||||
this.debugService.addBreakpoints(this.editor.getModel().uri, [{
|
||||
lineNumber: this.lineNumber,
|
||||
column: oldBreakpoint ? oldBreakpoint.column : undefined,
|
||||
column: this.breakpoint ? this.breakpoint.column : undefined,
|
||||
enabled: true,
|
||||
condition,
|
||||
hitCondition
|
||||
|
||||
@@ -16,7 +16,7 @@ import { IFileStat } from 'vs/platform/files/common/files';
|
||||
|
||||
// Commands can get exeucted from a command pallete, from a context menu or from some list using a keybinding
|
||||
// To cover all these cases we need to properly compute the resource on which the command is being executed
|
||||
export function getResourceForCommand(resource: URI, listService: IListService, editorService: IWorkbenchEditorService): URI {
|
||||
export function getResourceForCommand(resource: URI | {}, listService: IListService, editorService: IWorkbenchEditorService): URI {
|
||||
if (URI.isUri(resource)) {
|
||||
return resource;
|
||||
}
|
||||
@@ -34,7 +34,7 @@ export function getResourceForCommand(resource: URI, listService: IListService,
|
||||
return toResource(editorService.getActiveEditorInput(), { supportSideBySide: true });
|
||||
}
|
||||
|
||||
export function getMultiSelectedResources(resource: URI, listService: IListService, editorService: IWorkbenchEditorService): URI[] {
|
||||
export function getMultiSelectedResources(resource: URI | {}, listService: IListService, editorService: IWorkbenchEditorService): URI[] {
|
||||
const list = listService.lastFocusedList;
|
||||
if (list && list.isDOMFocused()) {
|
||||
// Explorer
|
||||
@@ -49,6 +49,7 @@ export function getMultiSelectedResources(resource: URI, listService: IListServi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Open editors view
|
||||
if (list instanceof List) {
|
||||
const focus = list.getFocusedElements();
|
||||
|
||||
@@ -240,7 +240,7 @@ function saveAll(saveAllArguments: any, editorService: IWorkbenchEditorService,
|
||||
|
||||
CommandsRegistry.registerCommand({
|
||||
id: REVERT_FILE_COMMAND_ID,
|
||||
handler: (accessor, resource: URI) => {
|
||||
handler: (accessor, resource: URI | {}) => {
|
||||
const editorService = accessor.get(IWorkbenchEditorService);
|
||||
const textFileService = accessor.get(ITextFileService);
|
||||
const notificationService = accessor.get(INotificationService);
|
||||
@@ -264,7 +264,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
mac: {
|
||||
primary: KeyMod.WinCtrl | KeyCode.Enter
|
||||
},
|
||||
id: OPEN_TO_SIDE_COMMAND_ID, handler: (accessor, resource: URI) => {
|
||||
id: OPEN_TO_SIDE_COMMAND_ID, handler: (accessor, resource: URI | {}) => {
|
||||
const editorService = accessor.get(IWorkbenchEditorService);
|
||||
const editorGroupService = accessor.get(IEditorGroupService);
|
||||
const listService = accessor.get(IListService);
|
||||
@@ -308,7 +308,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
when: undefined,
|
||||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
|
||||
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_D),
|
||||
handler: (accessor, resource: URI) => {
|
||||
handler: (accessor, resource: URI | {}) => {
|
||||
if (!provider) {
|
||||
const instantiationService = accessor.get(IInstantiationService);
|
||||
const textModelService = accessor.get(ITextModelService);
|
||||
@@ -317,13 +317,13 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
}
|
||||
|
||||
const editorService = accessor.get(IWorkbenchEditorService);
|
||||
resource = getResourceForCommand(resource, accessor.get(IListService), editorService);
|
||||
const uri = getResourceForCommand(resource, accessor.get(IListService), editorService);
|
||||
|
||||
if (resource && resource.scheme === Schemas.file /* only files on disk supported for now */) {
|
||||
const name = paths.basename(resource.fsPath);
|
||||
if (uri && uri.scheme === Schemas.file /* only files on disk supported for now */) {
|
||||
const name = paths.basename(uri.fsPath);
|
||||
const editorLabel = nls.localize('modifiedLabel', "{0} (on disk) ↔ {1}", name, name);
|
||||
|
||||
return editorService.openEditor({ leftResource: URI.from({ scheme: COMPARE_WITH_SAVED_SCHEMA, path: resource.fsPath }), rightResource: resource, label: editorLabel }).then(() => void 0);
|
||||
return editorService.openEditor({ leftResource: URI.from({ scheme: COMPARE_WITH_SAVED_SCHEMA, path: uri.fsPath }), rightResource: resource, label: editorLabel }).then(() => void 0);
|
||||
}
|
||||
|
||||
return TPromise.as(true);
|
||||
@@ -334,7 +334,7 @@ let globalResourceToCompare: URI;
|
||||
let resourceSelectedForCompareContext: IContextKey<boolean>;
|
||||
CommandsRegistry.registerCommand({
|
||||
id: SELECT_FOR_COMPARE_COMMAND_ID,
|
||||
handler: (accessor, resource: URI) => {
|
||||
handler: (accessor, resource: URI | {}) => {
|
||||
const listService = accessor.get(IListService);
|
||||
const tree = listService.lastFocusedList;
|
||||
// Remove highlight
|
||||
@@ -353,7 +353,7 @@ CommandsRegistry.registerCommand({
|
||||
|
||||
CommandsRegistry.registerCommand({
|
||||
id: COMPARE_SELECTED_COMMAND_ID,
|
||||
handler: (accessor, resource: URI) => {
|
||||
handler: (accessor, resource: URI | {}) => {
|
||||
const editorService = accessor.get(IWorkbenchEditorService);
|
||||
const resources = getMultiSelectedResources(resource, accessor.get(IListService), editorService);
|
||||
|
||||
@@ -370,7 +370,7 @@ CommandsRegistry.registerCommand({
|
||||
|
||||
CommandsRegistry.registerCommand({
|
||||
id: COMPARE_RESOURCE_COMMAND_ID,
|
||||
handler: (accessor, resource: URI) => {
|
||||
handler: (accessor, resource: URI | {}) => {
|
||||
const editorService = accessor.get(IWorkbenchEditorService);
|
||||
const listService = accessor.get(IListService);
|
||||
const tree = listService.lastFocusedList;
|
||||
@@ -402,7 +402,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
win: {
|
||||
primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_R
|
||||
},
|
||||
handler: (accessor: ServicesAccessor, resource: URI) => {
|
||||
handler: (accessor: ServicesAccessor, resource: URI | {}) => {
|
||||
const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IWorkbenchEditorService));
|
||||
revealResourcesInOS(resources, accessor.get(IWindowsService), accessor.get(INotificationService));
|
||||
}
|
||||
@@ -412,7 +412,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
when: undefined,
|
||||
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_R),
|
||||
id: 'workbench.action.files.revealActiveFileInWindows',
|
||||
handler: (accessor: ServicesAccessor, resource: URI) => {
|
||||
handler: (accessor: ServicesAccessor) => {
|
||||
const editorService = accessor.get(IWorkbenchEditorService);
|
||||
const activeInput = editorService.getActiveEditorInput();
|
||||
const resources = activeInput && activeInput.getResource() ? [activeInput.getResource()] : [];
|
||||
@@ -437,7 +437,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_C
|
||||
},
|
||||
id: COPY_PATH_COMMAND_ID,
|
||||
handler: (accessor, resource: URI) => {
|
||||
handler: (accessor, resource: URI | {}) => {
|
||||
const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IWorkbenchEditorService));
|
||||
resourcesToClipboard(resources, accessor.get(IClipboardService), accessor.get(INotificationService));
|
||||
}
|
||||
@@ -448,7 +448,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
when: undefined,
|
||||
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_P),
|
||||
id: 'workbench.action.files.copyPathOfActiveFile',
|
||||
handler: (accessor, resource: URI) => {
|
||||
handler: (accessor) => {
|
||||
const editorService = accessor.get(IWorkbenchEditorService);
|
||||
const activeInput = editorService.getActiveEditorInput();
|
||||
const resources = activeInput && activeInput.getResource() ? [activeInput.getResource()] : [];
|
||||
@@ -458,18 +458,18 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
|
||||
CommandsRegistry.registerCommand({
|
||||
id: REVEAL_IN_EXPLORER_COMMAND_ID,
|
||||
handler: (accessor, resource: URI) => {
|
||||
handler: (accessor, resource: URI | {}) => {
|
||||
const viewletService = accessor.get(IViewletService);
|
||||
const contextService = accessor.get(IWorkspaceContextService);
|
||||
resource = getResourceForCommand(resource, accessor.get(IListService), accessor.get(IWorkbenchEditorService));
|
||||
const uri = getResourceForCommand(resource, accessor.get(IListService), accessor.get(IWorkbenchEditorService));
|
||||
|
||||
viewletService.openViewlet(VIEWLET_ID, false).then((viewlet: ExplorerViewlet) => {
|
||||
const isInsideWorkspace = contextService.isInsideWorkspace(resource);
|
||||
const isInsideWorkspace = contextService.isInsideWorkspace(uri);
|
||||
if (isInsideWorkspace) {
|
||||
const explorerView = viewlet.getExplorerView();
|
||||
if (explorerView) {
|
||||
explorerView.setExpanded(true);
|
||||
explorerView.select(resource, true);
|
||||
explorerView.select(uri, true);
|
||||
}
|
||||
} else {
|
||||
const openEditorsView = viewlet.getOpenEditorsView();
|
||||
@@ -486,10 +486,9 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
|
||||
when: undefined,
|
||||
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_S,
|
||||
handler: (accessor, resource: URI) => {
|
||||
handler: (accessor, resource: URI | {}) => {
|
||||
const editorService = accessor.get(IWorkbenchEditorService);
|
||||
resource = getResourceForCommand(resource, accessor.get(IListService), editorService);
|
||||
return save(resource, true, editorService, accessor.get(IFileService), accessor.get(IUntitledEditorService), accessor.get(ITextFileService), accessor.get(IEditorGroupService));
|
||||
return save(getResourceForCommand(resource, accessor.get(IListService), editorService), true, editorService, accessor.get(IFileService), accessor.get(IUntitledEditorService), accessor.get(ITextFileService), accessor.get(IEditorGroupService));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -498,7 +497,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
|
||||
primary: KeyMod.CtrlCmd | KeyCode.KEY_S,
|
||||
id: SAVE_FILE_COMMAND_ID,
|
||||
handler: (accessor, resource: URI) => {
|
||||
handler: (accessor, resource: URI | {}) => {
|
||||
const editorService = accessor.get(IWorkbenchEditorService);
|
||||
const resources = getMultiSelectedResources(resource, accessor.get(IListService), editorService);
|
||||
|
||||
@@ -519,7 +518,7 @@ CommandsRegistry.registerCommand({
|
||||
|
||||
CommandsRegistry.registerCommand({
|
||||
id: SAVE_ALL_IN_GROUP_COMMAND_ID,
|
||||
handler: (accessor, resource: URI, editorContext: IEditorCommandsContext) => {
|
||||
handler: (accessor, resource: URI | {}, editorContext: IEditorCommandsContext) => {
|
||||
const contexts = getMultiSelectedEditorContexts(editorContext, accessor.get(IListService));
|
||||
const editorGroupService = accessor.get(IEditorGroupService);
|
||||
let saveAllArg: any;
|
||||
@@ -552,7 +551,7 @@ CommandsRegistry.registerCommand({
|
||||
|
||||
CommandsRegistry.registerCommand({
|
||||
id: REMOVE_ROOT_FOLDER_COMMAND_ID,
|
||||
handler: (accessor, resource: URI) => {
|
||||
handler: (accessor, resource: URI | {}) => {
|
||||
const workspaceEditingService = accessor.get(IWorkspaceEditingService);
|
||||
const contextService = accessor.get(IWorkspaceContextService);
|
||||
const workspace = contextService.getWorkspace();
|
||||
|
||||
Reference in New Issue
Block a user