Merge from vscode 011858832762aaff245b2336fb1c38166e7a10fb (#4663)

This commit is contained in:
Anthony Dresser
2019-03-22 13:07:54 -07:00
committed by GitHub
parent f5c9174c2f
commit 4a87a24235
296 changed files with 2531 additions and 2472 deletions

View File

@@ -39,6 +39,7 @@ import { ILogService, getLogLevel } from 'vs/platform/log/common/log';
import { OcticonLabel } from 'vs/base/browser/ui/octiconLabel/octiconLabel';
import { normalizeGitHubUrl } from 'vs/code/electron-browser/issue/issueReporterUtil';
import { Button } from 'vs/base/browser/ui/button/button';
import { withUndefinedAsNull } from 'vs/base/common/types';
const MAX_URL_LENGTH = platform.isWindows ? 2081 : 5400;
@@ -211,7 +212,7 @@ export class IssueReporter extends Disposable {
styleTag.innerHTML = content.join('\n');
document.head.appendChild(styleTag);
document.body.style.color = styles.color || null;
document.body.style.color = withUndefinedAsNull(styles.color);
}
private handleExtensionData(extensions: IssueReporterExtensionData[]) {

View File

@@ -99,7 +99,7 @@ function attachTo(item: ProcessItem) {
ipcRenderer.send('vscode:workbenchCommand', { id: 'debug.startFromConfig', from: 'processExplorer', args: [config] });
}
function getProcessIdWithHighestProperty(processList, propertyName: string) {
function getProcessIdWithHighestProperty(processList: any[], propertyName: string) {
let max = 0;
let maxProcessId;
processList.forEach(process => {
@@ -112,7 +112,7 @@ function getProcessIdWithHighestProperty(processList, propertyName: string) {
return maxProcessId;
}
function updateProcessInfo(processList): void {
function updateProcessInfo(processList: any[]): void {
const container = document.getElementById('process-list');
if (!container) {
return;
@@ -199,12 +199,12 @@ function applyZoom(zoomLevel: number): void {
browser.setZoomLevel(webFrame.getZoomLevel(), /*isTrusted*/false);
}
function showContextMenu(e) {
function showContextMenu(e: MouseEvent) {
e.preventDefault();
const items: IContextMenuItem[] = [];
const pid = parseInt(e.currentTarget.id);
const pid = parseInt((e.currentTarget as HTMLElement).id);
if (pid && typeof pid === 'number') {
items.push({
label: localize('killProcess', "Kill Process"),
@@ -277,7 +277,7 @@ export function startup(data: ProcessExplorerData): void {
applyZoom(data.zoomLevel);
// Map window process pids to titles, annotate process names with this when rendering to distinguish between them
ipcRenderer.on('vscode:windowsInfoResponse', (event, windows) => {
ipcRenderer.on('vscode:windowsInfoResponse', (_event: unknown, windows: any[]) => {
mapPidToWindowTitle = new Map<number, string>();
windows.forEach(window => mapPidToWindowTitle.set(window.pid, window.title));
});

View File

@@ -388,7 +388,7 @@ export class CodeApplication extends Disposable {
this.logService.info(`Tracing: waiting for windows to get ready...`);
let recordingStopped = false;
const stopRecording = (timeout) => {
const stopRecording = (timeout: boolean) => {
if (recordingStopped) {
return;
}
@@ -574,16 +574,17 @@ export class CodeApplication extends Disposable {
const hasCliArgs = hasArgs(args._);
const hasFolderURIs = hasArgs(args['folder-uri']);
const hasFileURIs = hasArgs(args['file-uri']);
const noRecentEntry = args['skip-add-to-recently-opened'] === true;
if (args['new-window'] && !hasCliArgs && !hasFolderURIs && !hasFileURIs) {
return this.windowsMainService.open({ context, cli: args, forceNewWindow: true, forceEmpty: true, initialStartup: true }); // new window if "-n" was used without paths
return this.windowsMainService.open({ context, cli: args, forceNewWindow: true, forceEmpty: true, noRecentEntry, initialStartup: true }); // new window if "-n" was used without paths
}
if (macOpenFiles && macOpenFiles.length && !hasCliArgs && !hasFolderURIs && !hasFileURIs) {
return this.windowsMainService.open({ context: OpenContext.DOCK, cli: args, urisToOpen: macOpenFiles.map(file => ({ uri: URI.file(file) })), initialStartup: true }); // mac: open-file event received on startup
return this.windowsMainService.open({ context: OpenContext.DOCK, cli: args, urisToOpen: macOpenFiles.map(file => ({ uri: URI.file(file) })), noRecentEntry, initialStartup: true }); // mac: open-file event received on startup
}
return this.windowsMainService.open({ context, cli: args, forceNewWindow: args['new-window'] || (!hasCliArgs && args['unity-launch']), diffMode: args.diff, initialStartup: true }); // default: read paths from cli
return this.windowsMainService.open({ context, cli: args, forceNewWindow: args['new-window'] || (!hasCliArgs && args['unity-launch']), diffMode: args.diff, noRecentEntry, initialStartup: true }); // default: read paths from cli
}
private afterWindowOpen(accessor: ServicesAccessor): void {

View File

@@ -489,7 +489,7 @@ export class WindowsManager implements IWindowsMainService {
// Remember in recent document list (unless this opens for extension development)
// Also do not add paths when files are opened for diffing, only if opened individually
if (!usedWindows.some(w => w.isExtensionDevelopmentHost) && !openConfig.diffMode && !this.environmentService.skipAddToRecentlyOpened) {
if (!usedWindows.some(w => w.isExtensionDevelopmentHost) && !openConfig.diffMode && !openConfig.noRecentEntry) {
const recents: IRecent[] = [];
for (let pathToOpen of pathsToOpen) {
if (pathToOpen.workspace) {
@@ -746,7 +746,7 @@ export class WindowsManager implements IWindowsMainService {
private doOpenFilesInExistingWindow(configuration: IOpenConfiguration, window: ICodeWindow, fileInputs?: IFileInputs): ICodeWindow {
window.focus(); // make sure window has focus
const params: { filesToOpen?, filesToCreate?, filesToDiff?, filesToWait?, termProgram?} = {};
const params: { filesToOpen?: IPath[], filesToCreate?: IPath[], filesToDiff?: IPath[], filesToWait?: IPathsToWaitFor, termProgram?: string } = {};
if (fileInputs) {
params.filesToOpen = fileInputs.filesToOpen;
params.filesToCreate = fileInputs.filesToCreate;
@@ -1216,7 +1216,7 @@ export class WindowsManager implements IWindowsMainService {
}
// Open it
this.open({ context: openConfig.context, cli: openConfig.cli, forceNewWindow: true, forceEmpty: !cliArgs.length && !folderUris.length && !fileUris.length, userEnv: openConfig.userEnv });
this.open({ context: openConfig.context, cli: openConfig.cli, forceNewWindow: true, forceEmpty: !cliArgs.length && !folderUris.length && !fileUris.length, userEnv: openConfig.userEnv, noRecentEntry: true });
}
private openInBrowserWindow(options: IOpenBrowserWindowOptions): ICodeWindow {
@@ -1897,9 +1897,15 @@ class Dialogs {
showMessageBox(options: Electron.MessageBoxOptions, window?: ICodeWindow): Promise<IMessageBoxResult> {
return this.getDialogQueue(window).queue(() => {
return new Promise(resolve => {
dialog.showMessageBox(window ? window.win : undefined!, options, (response: number, checkboxChecked: boolean) => {
const callback = (response: number, checkboxChecked: boolean) => {
resolve({ button: response, checkboxChecked });
});
};
if (window) {
dialog.showMessageBox(window.win, options, callback);
} else {
dialog.showMessageBox(options, callback);
}
});
});
}
@@ -1916,9 +1922,15 @@ class Dialogs {
return this.getDialogQueue(window).queue(() => {
return new Promise(resolve => {
dialog.showSaveDialog(window ? window.win : undefined!, options, path => {
const callback = (path: string) => {
resolve(normalizePath(path));
});
};
if (window) {
dialog.showSaveDialog(window.win, options, callback);
} else {
dialog.showSaveDialog(options, callback);
}
});
});
}
@@ -1948,9 +1960,15 @@ class Dialogs {
// Show dialog and wrap as promise
validatePathPromise.then(() => {
dialog.showOpenDialog(window ? window.win : undefined!, options, paths => {
const callback = (paths: string[]) => {
resolve(normalizePaths(paths));
});
};
if (window) {
dialog.showOpenDialog(window.win, options, callback);
} else {
dialog.showOpenDialog(options, callback);
}
});
});
});