mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-08 09:38:26 -05:00
Merge from vscode 70dc55955d586ebd427658b43cdb344f2047f9c2 (#6789)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user