mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 4d91d96e5e121b38d33508cdef17868bab255eae
This commit is contained in:
committed by
AzureDataStudio
parent
a971aee5bd
commit
5e7071e466
@@ -12,8 +12,12 @@ import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, isSingleFolderW
|
||||
import { localize } from 'vs/nls';
|
||||
import { isEqualOrParent, basename } from 'vs/base/common/resources';
|
||||
|
||||
export const ILabelService = createDecorator<ILabelService>('labelService');
|
||||
|
||||
export interface ILabelService {
|
||||
_serviceBrand: undefined;
|
||||
|
||||
readonly _serviceBrand: undefined;
|
||||
|
||||
/**
|
||||
* Gets the human readable label for a uri.
|
||||
* If relative is passed returns a label relative to the workspace root that the uri belongs to.
|
||||
@@ -24,6 +28,7 @@ export interface ILabelService {
|
||||
getWorkspaceLabel(workspace: (IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | IWorkspace), options?: { verbose: boolean }): string;
|
||||
getHostLabel(scheme: string, authority?: string): string;
|
||||
getSeparator(scheme: string, authority?: string): '/' | '\\';
|
||||
|
||||
registerFormatter(formatter: ResourceLabelFormatter): IDisposable;
|
||||
onDidChangeFormatters: Event<IFormatterChangeEvent>;
|
||||
}
|
||||
@@ -48,12 +53,11 @@ export interface ResourceLabelFormatting {
|
||||
authorityPrefix?: string;
|
||||
}
|
||||
|
||||
const LABEL_SERVICE_ID = 'label';
|
||||
|
||||
export function getSimpleWorkspaceLabel(workspace: IWorkspaceIdentifier | URI, workspaceHome: URI): string {
|
||||
if (isSingleFolderWorkspaceIdentifier(workspace)) {
|
||||
return basename(workspace);
|
||||
}
|
||||
|
||||
// Workspace: Untitled
|
||||
if (isEqualOrParent(workspace.configPath, workspaceHome)) {
|
||||
return localize('untitledWorkspace', "Untitled (Workspace)");
|
||||
@@ -63,8 +67,6 @@ export function getSimpleWorkspaceLabel(workspace: IWorkspaceIdentifier | URI, w
|
||||
if (filename.endsWith(WORKSPACE_EXTENSION)) {
|
||||
filename = filename.substr(0, filename.length - WORKSPACE_EXTENSION.length - 1);
|
||||
}
|
||||
|
||||
return localize('workspaceName', "{0} (Workspace)", filename);
|
||||
}
|
||||
|
||||
|
||||
export const ILabelService = createDecorator<ILabelService>(LABEL_SERVICE_ID);
|
||||
|
||||
Reference in New Issue
Block a user