Skip to content

Commit

Permalink
Icons (#29096)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrmarti committed Aug 7, 2018
1 parent cd3b0bf commit 756f897
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
7 changes: 1 addition & 6 deletions src/vs/platform/quickinput/common/quickInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,16 @@ import { CancellationToken } from 'vs/base/common/cancellation';
import { ResolvedKeybinding } from 'vs/base/common/keyCodes';
import URI from 'vs/base/common/uri';
import { Event } from 'vs/base/common/event';
import { FileKind } from 'vs/platform/files/common/files';

export interface IQuickPickItem {
id?: string;
label: string;
description?: string;
detail?: string;
iconClasses?: string[];
picked?: boolean;
}

export interface IFilePickItem extends IQuickPickItem {
resource: URI;
fileKind?: FileKind;
}

export interface IQuickNavigateConfiguration {
keybindings: ResolvedKeybinding[];
}
Expand Down
16 changes: 10 additions & 6 deletions src/vs/workbench/browser/actions/workspaceCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { isLinux } from 'vs/base/common/platform';
import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay';
import { IQuickInputService, IPickOptions, IFilePickItem } from 'vs/platform/quickinput/common/quickInput';
import { IQuickInputService, IPickOptions, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
import { getIconClasses } from 'vs/workbench/browser/labels';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IModeService } from 'vs/editor/common/services/modeService';

export const ADD_ROOT_FOLDER_COMMAND_ID = 'addRootFolder';
export const ADD_ROOT_FOLDER_LABEL = nls.localize('addFolderToWorkspace', "Add Folder to Workspace...");
Expand Down Expand Up @@ -158,10 +161,12 @@ CommandsRegistry.registerCommand({
}
});

CommandsRegistry.registerCommand(PICK_WORKSPACE_FOLDER_COMMAND_ID, function (accessor, args?: [IPickOptions<IFilePickItem>, CancellationToken]) {
CommandsRegistry.registerCommand(PICK_WORKSPACE_FOLDER_COMMAND_ID, function (accessor, args?: [IPickOptions<IQuickPickItem>, CancellationToken]) {
const quickInputService = accessor.get(IQuickInputService);
const uriDisplayService = accessor.get(IUriDisplayService);
const contextService = accessor.get(IWorkspaceContextService);
const modelService = accessor.get(IModelService);
const modeService = accessor.get(IModeService);

const folders = contextService.getWorkspace().folders;
if (!folders.length) {
Expand All @@ -173,12 +178,11 @@ CommandsRegistry.registerCommand(PICK_WORKSPACE_FOLDER_COMMAND_ID, function (acc
label: folder.name,
description: uriDisplayService.getLabel(resources.dirname(folder.uri), true),
folder,
resource: folder.uri,
fileKind: FileKind.ROOT_FOLDER
} as IFilePickItem;
iconClasses: getIconClasses(modelService, modeService, folder.uri, FileKind.ROOT_FOLDER)
} as IQuickPickItem;
});

let options: IPickOptions<IFilePickItem>;
let options: IPickOptions<IQuickPickItem>;
if (args) {
options = args[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/browser/parts/quickinput/quickInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ export class QuickInputService extends Component implements IQuickInputService {
}

const workbench = document.getElementById(this.partService.getWorkbenchElementId());
const container = dom.append(workbench, $('.quick-input-widget'));
const container = dom.append(workbench, $('.quick-input-widget.show-file-icons'));
container.tabIndex = -1;
container.style.display = 'none';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class ListElementRenderer implements IRenderer<ListElement, IListElementTemplate
options.matches = labelHighlights || [];
options.descriptionTitle = element.item.description;
options.descriptionMatches = descriptionHighlights || [];
options.extraClasses = element.item.iconClasses;
data.label.setValue(element.item.label, element.item.description, options);

// Meta
Expand Down

0 comments on commit 756f897

Please sign in to comment.