Skip to content

Commit

Permalink
Add border between recently opened and file results for the quick fil…
Browse files Browse the repository at this point in the history
…e open

Added border between the `recently opened` and `file results` quick file open groups, similar to vscode.

Signed-off-by: Vincent Fugnitto <vincent.fugnitto@ericsson.com>
  • Loading branch information
vince-fugnitto committed Feb 25, 2019
1 parent 43f772d commit 6bd4786
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/file-search/src/browser/quick-file-open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export class QuickFileOpenService implements QuickOpenModel, QuickOpenHandler {
for (const location of locations) {
const uriString = location.uri.toString();
if (!alreadyCollected.has(uriString) && fuzzy.test(lookFor, uriString)) {
recentlyUsedItems.push(await this.toItem(location.uri, recentlyUsedItems.length === 0 ? 'recently opened' : undefined));
recentlyUsedItems.push(await this.toItem(location.uri, { groupLabel: recentlyUsedItems.length === 0 ? 'recently opened' : undefined, showBorder: false }));
alreadyCollected.add(uriString);
}
}
Expand All @@ -177,7 +177,7 @@ export class QuickFileOpenService implements QuickOpenModel, QuickOpenHandler {
const first = sortedResults[0];
sortedResults.shift();
if (first) {
sortedResults.unshift(await this.toItem(first.getUri()!, 'file results'));
sortedResults.unshift(await this.toItem(first.getUri()!, { groupLabel: 'file results', showBorder: true }));
}

// Return the recently used items, followed by the search results.
Expand Down Expand Up @@ -298,7 +298,7 @@ export class QuickFileOpenService implements QuickOpenModel, QuickOpenHandler {
.catch(error => this.messageService.error(error));
}

private async toItem(uriOrString: URI | string, group?: string) {
private async toItem(uriOrString: URI | string, group?: QuickOpenGroupItemOptions) {
const uri = uriOrString instanceof URI ? uriOrString : new URI(uriOrString);
let description = this.labelProvider.getLongName(uri.parent);
if (this.workspaceService.workspace && !this.workspaceService.workspace.isDirectory) {
Expand All @@ -317,10 +317,7 @@ export class QuickFileOpenService implements QuickOpenModel, QuickOpenHandler {
run: this.getRunFunction(uri)
};
if (group) {
return new QuickOpenGroupItem<QuickOpenGroupItemOptions>({
...options,
groupLabel: group
});
return new QuickOpenGroupItem<QuickOpenGroupItemOptions>({ ...options, ...group });
} else {
return new QuickOpenItem<QuickOpenItemOptions>(options);
}
Expand Down

0 comments on commit 6bd4786

Please sign in to comment.