提交 71fcfc46 编写于 作者: A Andre Weinand

support empty window when debugging extensions

上级 3ecbf67c
......@@ -1256,10 +1256,9 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
openConfig.cli['file-uri'] = fileUris;
// if there are no files or folders cli args left, use the "remote" cli argument
if (!cliArgs.length && !folderUris.length && !fileUris.length) {
if (authority) {
openConfig.cli.remote = authority;
}
const noFilesOrFolders = !cliArgs.length && !folderUris.length && !fileUris.length;
if (noFilesOrFolders && authority) {
openConfig.cli.remote = authority;
}
// Open it
......@@ -1267,7 +1266,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
context: openConfig.context,
cli: openConfig.cli,
forceNewWindow: true,
forceEmpty: !cliArgs.length && !folderUris.length && !fileUris.length,
forceEmpty: noFilesOrFolders,
userEnv: openConfig.userEnv,
noRecentEntry: true,
waitMarkerFileURI: openConfig.waitMarkerFileURI
......
......@@ -658,6 +658,15 @@ export class SimpleWindowsService implements IWindowsService {
// we pass the "ParsedArgs" as query parameters of the URL
let newAddress = `${document.location.origin}/?`;
let gotFolder = false;
const addQueryParameter = (key: string, value: string) => {
const lastChar = newAddress.charAt(newAddress.length - 1);
if (lastChar !== '?' && lastChar !== '&') {
newAddress += '&';
}
newAddress += `${key}=${encodeURIComponent(value)}`;
};
const f = args['folder-uri'];
if (f) {
......@@ -670,9 +679,14 @@ export class SimpleWindowsService implements IWindowsService {
u = URI.parse(f);
}
if (u) {
newAddress += `folder=${encodeURIComponent(u.path)}`;
gotFolder = true;
addQueryParameter('folder', u.path);
}
}
if (!gotFolder) {
// request empty window
addQueryParameter('ew', 'true');
}
const ep = args['extensionDevelopmentPath'];
if (ep) {
......@@ -685,23 +699,23 @@ export class SimpleWindowsService implements IWindowsService {
u = ep;
}
if (u) {
newAddress += `&edp=${encodeURIComponent(u)}`;
addQueryParameter('edp', u);
}
}
const di = args['debugId'];
if (di) {
newAddress += `&di=${encodeURIComponent(di)}`;
addQueryParameter('di', di);
}
const ibe = args['inspect-brk-extensions'];
if (ibe) {
newAddress += `&ibe=${encodeURIComponent(ibe)}`;
addQueryParameter('ibe', ibe);
}
// add connection token
if (this.workbenchEnvironmentService.configuration.connectionToken) {
newAddress += `&tkn=${this.workbenchEnvironmentService.configuration.connectionToken}`;
addQueryParameter('tkn', this.workbenchEnvironmentService.configuration.connectionToken);
}
window.open(newAddress);
......
......@@ -105,7 +105,7 @@ export class BrowserWorkbenchEnvironmentService implements IEnvironmentService {
for (let p of vars) {
const pair = p.split('=');
if (pair.length >= 2) {
map.set(decodeURIComponent(pair[0]), decodeURIComponent(pair[1]));
map.set(pair[0], decodeURIComponent(pair[1]));
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册