parent
ae90cd7b9e
commit
7687a1473d
3 changed files with 10 additions and 14 deletions
|
@ -353,6 +353,7 @@
|
|||
"./vs/nls.d.ts",
|
||||
"./vs/nls.mock.ts",
|
||||
"./vs/platform/actions/common/actions.ts",
|
||||
"./vs/platform/label/common/label.ts",
|
||||
"./vs/platform/backup/common/backup.ts",
|
||||
"./vs/platform/broadcast/electron-browser/broadcastService.ts",
|
||||
"./vs/platform/clipboard/common/clipboardService.ts",
|
||||
|
@ -525,4 +526,4 @@
|
|||
"exclude": [
|
||||
"./typings/require-monaco.d.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,11 +24,7 @@ export interface IUserHomeProvider {
|
|||
/**
|
||||
* @deprecated use LabelService instead
|
||||
*/
|
||||
export function getPathLabel(resource: URI | string, userHomeProvider: IUserHomeProvider, rootProvider?: IWorkspaceFolderProvider): string | undefined {
|
||||
if (!resource) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getPathLabel(resource: URI | string, userHomeProvider: IUserHomeProvider, rootProvider?: IWorkspaceFolderProvider): string {
|
||||
if (typeof resource === 'string') {
|
||||
resource = URI.file(resource);
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ const sepRegexp = /\//g;
|
|||
const labelMatchingRegexp = /\$\{scheme\}|\$\{authority\}|\$\{path\}/g;
|
||||
|
||||
function hasDriveLetter(path: string): boolean {
|
||||
return isWindows && path && path[2] === ':';
|
||||
return !!(isWindows && path && path[2] === ':');
|
||||
}
|
||||
|
||||
export class LabelService implements ILabelService {
|
||||
|
@ -73,7 +73,7 @@ export class LabelService implements ILabelService {
|
|||
return this._onDidRegisterFormatter.event;
|
||||
}
|
||||
|
||||
findFormatter(resource: URI): LabelRules {
|
||||
findFormatter(resource: URI): LabelRules | undefined {
|
||||
const path = `${resource.scheme}://${resource.authority}`;
|
||||
let bestPrefix = '';
|
||||
for (let prefix in this.formatters) {
|
||||
|
@ -88,9 +88,6 @@ export class LabelService implements ILabelService {
|
|||
}
|
||||
|
||||
getUriLabel(resource: URI, options: { relative?: boolean, noPrefix?: boolean } = {}): string {
|
||||
if (!resource) {
|
||||
return undefined;
|
||||
}
|
||||
const formatter = this.findFormatter(resource);
|
||||
if (!formatter) {
|
||||
return getPathLabel(resource.path, this.environmentService, options.relative ? this.contextService : undefined);
|
||||
|
@ -122,10 +119,12 @@ export class LabelService implements ILabelService {
|
|||
|
||||
getWorkspaceLabel(workspace: (IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | IWorkspace), options?: { verbose: boolean }): string {
|
||||
if (!isWorkspaceIdentifier(workspace) && !isSingleFolderWorkspaceIdentifier(workspace)) {
|
||||
workspace = toWorkspaceIdentifier(workspace);
|
||||
if (!workspace) {
|
||||
const identifier = toWorkspaceIdentifier(workspace);
|
||||
if (!identifier) {
|
||||
return '';
|
||||
}
|
||||
|
||||
workspace = identifier;
|
||||
}
|
||||
|
||||
// Workspace: Single Folder
|
||||
|
@ -165,7 +164,7 @@ export class LabelService implements ILabelService {
|
|||
};
|
||||
}
|
||||
|
||||
private formatUri(resource: URI, formatter: LabelRules, forceNoTildify: boolean): string {
|
||||
private formatUri(resource: URI, formatter: LabelRules, forceNoTildify?: boolean): string {
|
||||
let label = formatter.uri.label.replace(labelMatchingRegexp, match => {
|
||||
switch (match) {
|
||||
case '${scheme}': return resource.scheme;
|
||||
|
|
Loading…
Reference in a new issue