💄 code style

This commit is contained in:
Benjamin Pasero 2020-06-01 09:10:03 +02:00
parent 781950c23e
commit b0b329c1a2
2 changed files with 12 additions and 6 deletions

View file

@ -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.
@ -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);

View file

@ -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();
}