remoteHosts.ts 907 字节
Newer Older
M
Martin Aeschlimann 已提交
1 2 3 4 5 6
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

import { URI } from 'vs/base/common/uri';
B
Benjamin Pasero 已提交
7
import { Schemas } from 'vs/base/common/network';
M
Martin Aeschlimann 已提交
8

B
Benjamin Pasero 已提交
9
export const REMOTE_HOST_SCHEME = Schemas.vscodeRemote;
M
Martin Aeschlimann 已提交
10

11
export function getRemoteAuthority(uri: URI): string | undefined {
R
Rob Lourens 已提交
12
	return uri.scheme === REMOTE_HOST_SCHEME ? uri.authority : undefined;
13 14 15 16 17 18 19 20 21 22 23 24
}

export function getRemoteName(authority: string | undefined): string | undefined {
	if (!authority) {
		return undefined;
	}
	const pos = authority.indexOf('+');
	if (pos < 0) {
		// funky? bad authority?
		return authority;
	}
	return authority.substr(0, pos);
M
Martin Aeschlimann 已提交
25
}