Skip to content

Commit

Permalink
💄 code style
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Jun 1, 2020
1 parent 781950c commit b0b329c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/vs/platform/label/common/label.ts
Expand Up @@ -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;

/**
* 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.
Expand All @@ -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>;
}
Expand All @@ -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)");
Expand All @@ -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);
Expand Up @@ -51,8 +51,12 @@ export class RemoteFileSystemProvider extends Disposable implements
const connection = remoteAgentService.getConnection()!;
this.channel = connection.getChannel<IChannel>(REMOTE_FILE_SYSTEM_CHANNEL_NAME);

// Initially assume case sensitivity until remote environment is resolved
this.setCaseSensitive(true);
remoteAgentService.getEnvironment().then(remoteAgentEnvironment => this.setCaseSensitive(!!(remoteAgentEnvironment && remoteAgentEnvironment.os === OperatingSystem.Linux)));
(async () => {
const remoteAgentEnvironment = await remoteAgentService.getEnvironment();
this.setCaseSensitive(remoteAgentEnvironment?.os === OperatingSystem.Linux);
})();

this.registerListeners();
}
Expand Down

0 comments on commit b0b329c

Please sign in to comment.