Skip to content

Commit

Permalink
Fix microsoft#51414 - show workspace folder names in search tree
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed Jun 8, 2018
1 parent a8978c6 commit 0cae1cd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/vs/workbench/parts/search/browser/searchResultsView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import * as nls from 'vs/nls';
import * as resources from 'vs/base/common/resources';
import * as paths from 'vs/base/common/paths';
import * as DOM from 'vs/base/browser/dom';
import { Disposable, IDisposable, dispose } from 'vs/base/common/lifecycle';
Expand Down Expand Up @@ -148,7 +149,8 @@ export class SearchRenderer extends Disposable implements IRenderer {
actionRunner: IActionRunner,
private searchView: SearchView,
@IInstantiationService private instantiationService: IInstantiationService,
@IThemeService private themeService: IThemeService
@IThemeService private themeService: IThemeService,
@IWorkspaceContextService protected contextService: IWorkspaceContextService
) {
super();
}
Expand Down Expand Up @@ -234,7 +236,11 @@ export class SearchRenderer extends Disposable implements IRenderer {

private renderFolderMatch(tree: ITree, folderMatch: FolderMatch, templateData: IFolderMatchTemplate): void {
if (folderMatch.hasRoot()) {
templateData.label.setFile(folderMatch.resource(), { fileKind: FileKind.FOLDER });
const fileKind = resources.isEqual(this.contextService.getWorkspaceFolder(folderMatch.resource()).uri, folderMatch.resource()) ?
FileKind.ROOT_FOLDER :
FileKind.FOLDER;

templateData.label.setFile(folderMatch.resource(), { fileKind });
} else {
templateData.label.setValue(nls.localize('searchFolderMatch.other.label', "Other files"));
}
Expand Down

0 comments on commit 0cae1cd

Please sign in to comment.