Merge from vscode 70dc55955d586ebd427658b43cdb344f2047f9c2 (#6789)

This commit is contained in:
Anthony Dresser
2019-08-16 21:47:46 -07:00
committed by GitHub
parent fb26126bcb
commit 41d8663b09
79 changed files with 1815 additions and 572 deletions

View File

@@ -194,3 +194,13 @@ export function getErrorMessage(err: any): string {
return String(err);
}
export class NotImplementedError extends Error {
constructor(message?: string) {
super('NotImplemented');
if (message) {
this.message = message;
}
}
}

View File

@@ -3,6 +3,8 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { URI } from 'vs/base/common/uri';
export namespace Schemas {
/**
@@ -62,13 +64,26 @@ class RemoteAuthoritiesImpl {
}
public set(authority: string, host: string, port: number): void {
this._hosts[authority] = host;
this._hosts[authority] = (host === 'localhost' ? '127.0.0.1' : host);
this._ports[authority] = port;
}
public setConnectionToken(authority: string, connectionToken: string): void {
this._connectionTokens[authority] = connectionToken;
}
public rewrite(authority: string, path: string): URI {
const host = this._hosts[authority];
const port = this._ports[authority];
const connectionToken = this._connectionTokens[authority];
const scheme = (host === '127.0.0.1' ? Schemas.http : Schemas.vscodeRemote);
return URI.from({
scheme: scheme,
authority: `${host}:${port}`,
path: `/vscode-remote2`,
query: `path=${encodeURIComponent(path)}&tkn=${encodeURIComponent(connectionToken)}`
});
}
}
export const RemoteAuthorities = new RemoteAuthoritiesImpl();