let => const

This commit is contained in:
Benjamin Pasero
2016-09-03 11:07:43 +02:00
parent 955aa315b0
commit bb658ff13f
10 changed files with 186 additions and 186 deletions
@@ -44,7 +44,7 @@ export class Win32AutoUpdaterImpl extends EventEmitter {
}
get cachePath(): TPromise<string> {
let result = path.join(tmpdir(), 'vscode-update');
const result = path.join(tmpdir(), 'vscode-update');
return new TPromise<string>((c, e) => mkdirp(result, null, err => err ? e(err) : c(result)));
}
+4 -4
View File
@@ -91,7 +91,7 @@ export class EnvService implements IEnvService {
this._appKeybindingsPath = path.join(this._appSettingsHome, 'keybindings.json');
// Remove the Electron executable
let [, ...args] = process.argv;
const [, ...args] = process.argv;
// If dev, remove the first non-option argument: it's the app location
if (!this.isBuilt) {
@@ -205,14 +205,14 @@ export interface IParsedPath {
}
export function parseLineAndColumnAware(rawPath: string): IParsedPath {
let segments = rawPath.split(':'); // C:\file.txt:<line>:<column>
const segments = rawPath.split(':'); // C:\file.txt:<line>:<column>
let path: string;
let line: number = null;
let column: number = null;
segments.forEach(segment => {
let segmentAsNumber = Number(segment);
const segmentAsNumber = Number(segment);
if (!types.isNumber(segmentAsNumber)) {
path = !!path ? [path, segment].join(':') : segment; // a colon can well be part of a path (e.g. C:\...)
} else if (line === null) {
@@ -234,7 +234,7 @@ export function parseLineAndColumnAware(rawPath: string): IParsedPath {
}
function toLineAndColumnPath(parsedPath: IParsedPath): string {
let segments = [parsedPath.path];
const segments = [parsedPath.path];
if (types.isNumber(parsedPath.line)) {
segments.push(String(parsedPath.line));
+4 -4
View File
@@ -119,7 +119,7 @@ export class LifecycleService implements ILifecycleService {
// Window Before Closing: Main -> Renderer
vscodeWindow.win.on('close', (e) => {
let windowId = vscodeWindow.id;
const windowId = vscodeWindow.id;
this.logService.log('Lifecycle#window-before-close', windowId);
// The window already acknowledged to be closed
@@ -155,9 +155,9 @@ export class LifecycleService implements ILifecycleService {
this.logService.log('Lifecycle#unload()', vscodeWindow.id);
return new TPromise<boolean>((c) => {
let oneTimeEventToken = this.oneTimeListenerTokenGenerator++;
let oneTimeOkEvent = 'vscode:ok' + oneTimeEventToken;
let oneTimeCancelEvent = 'vscode:cancel' + oneTimeEventToken;
const oneTimeEventToken = this.oneTimeListenerTokenGenerator++;
const oneTimeOkEvent = 'vscode:ok' + oneTimeEventToken;
const oneTimeCancelEvent = 'vscode:cancel' + oneTimeEventToken;
ipc.once(oneTimeOkEvent, () => {
c(false); // no veto
+1 -1
View File
@@ -19,7 +19,7 @@ export class MainLogService implements ILogService {
_serviceBrand: any;
constructor( @IEnvService private envService: IEnvService) {
constructor(@IEnvService private envService: IEnvService) {
}
log(...args: any[]): void {
+1 -1
View File
@@ -76,7 +76,7 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: IProce
if (err) {
// take only the message and stack property
let friendlyError = {
const friendlyError = {
message: err.message,
stack: err.stack
};
+112 -112
View File
@@ -98,7 +98,7 @@ export class VSCodeMenu {
// Fill hash map of resolved keybindings
let needsMenuUpdate = false;
keybindings.forEach((keybinding) => {
let accelerator = new Keybinding(keybinding.binding)._toElectronAccelerator();
const accelerator = new Keybinding(keybinding.binding)._toElectronAccelerator();
if (accelerator) {
this.mapResolvedKeybindingToActionId[keybinding.id] = accelerator;
if (this.mapLastKnownKeybindingToActionId[keybinding.id] !== accelerator) {
@@ -167,47 +167,47 @@ export class VSCodeMenu {
private install(): void {
// Menus
let menubar = new Menu();
const menubar = new Menu();
// Mac: Application
let macApplicationMenuItem: Electron.MenuItem;
if (platform.isMacintosh) {
let applicationMenu = new Menu();
const applicationMenu = new Menu();
macApplicationMenuItem = new MenuItem({ label: this.envService.product.nameShort, submenu: applicationMenu });
this.setMacApplicationMenu(applicationMenu);
}
// File
let fileMenu = new Menu();
let fileMenuItem = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'mFile', comment: ['&& denotes a mnemonic'] }, "&&File")), submenu: fileMenu });
const fileMenu = new Menu();
const fileMenuItem = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'mFile', comment: ['&& denotes a mnemonic'] }, "&&File")), submenu: fileMenu });
this.setFileMenu(fileMenu);
// Edit
let editMenu = new Menu();
let editMenuItem = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'mEdit', comment: ['&& denotes a mnemonic'] }, "&&Edit")), submenu: editMenu });
const editMenu = new Menu();
const editMenuItem = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'mEdit', comment: ['&& denotes a mnemonic'] }, "&&Edit")), submenu: editMenu });
this.setEditMenu(editMenu);
// View
let viewMenu = new Menu();
let viewMenuItem = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'mView', comment: ['&& denotes a mnemonic'] }, "&&View")), submenu: viewMenu });
const viewMenu = new Menu();
const viewMenuItem = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'mView', comment: ['&& denotes a mnemonic'] }, "&&View")), submenu: viewMenu });
this.setViewMenu(viewMenu);
// Goto
let gotoMenu = new Menu();
let gotoMenuItem = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'mGoto', comment: ['&& denotes a mnemonic'] }, "&&Go")), submenu: gotoMenu });
const gotoMenu = new Menu();
const gotoMenuItem = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'mGoto', comment: ['&& denotes a mnemonic'] }, "&&Go")), submenu: gotoMenu });
this.setGotoMenu(gotoMenu);
// Mac: Window
let macWindowMenuItem: Electron.MenuItem;
if (platform.isMacintosh) {
let windowMenu = new Menu();
const windowMenu = new Menu();
macWindowMenuItem = new MenuItem({ label: mnemonicLabel(nls.localize('mWindow', "Window")), submenu: windowMenu, role: 'window' });
this.setMacWindowMenu(windowMenu);
}
// Help
let helpMenu = new Menu();
let helpMenuItem = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'mHelp', comment: ['&& denotes a mnemonic'] }, "&&Help")), submenu: helpMenu, role: 'help' });
const helpMenu = new Menu();
const helpMenuItem = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'mHelp', comment: ['&& denotes a mnemonic'] }, "&&Help")), submenu: helpMenu, role: 'help' });
this.setHelpMenu(helpMenu);
// Menu Structure
@@ -232,7 +232,7 @@ export class VSCodeMenu {
if (platform.isMacintosh && !this.appMenuInstalled) {
this.appMenuInstalled = true;
let dockMenu = new Menu();
const dockMenu = new Menu();
dockMenu.append(new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miNewWindow', comment: ['&& denotes a mnemonic'] }, "&&New Window")), click: () => this.windowsService.openNewWindow() }));
app.dock.setMenu(dockMenu);
@@ -244,7 +244,7 @@ export class VSCodeMenu {
return;
}
let mru = this.getOpenedPathsList();
const mru = this.getOpenedPathsList();
if (isFile) {
mru.files.unshift(path);
mru.files = arrays.distinct(mru.files, (f) => platform.isLinux ? f : f.toLowerCase());
@@ -261,7 +261,7 @@ export class VSCodeMenu {
}
private removeFromOpenedPathsList(path: string): void {
let mru = this.getOpenedPathsList();
const mru = this.getOpenedPathsList();
let index = mru.files.indexOf(path);
if (index >= 0) {
@@ -293,15 +293,15 @@ export class VSCodeMenu {
}
private setMacApplicationMenu(macApplicationMenu: Electron.Menu): void {
let about = new MenuItem({ label: nls.localize('mAbout', "About {0}", this.envService.product.nameLong), role: 'about' });
let checkForUpdates = this.getUpdateMenuItems();
let preferences = this.getPreferencesMenu();
let hide = new MenuItem({ label: nls.localize('mHide', "Hide {0}", this.envService.product.nameLong), role: 'hide', accelerator: 'Command+H' });
let hideOthers = new MenuItem({ label: nls.localize('mHideOthers', "Hide Others"), role: 'hideothers', accelerator: 'Command+Alt+H' });
let showAll = new MenuItem({ label: nls.localize('mShowAll', "Show All"), role: 'unhide' });
let quit = new MenuItem({ label: nls.localize('miQuit', "Quit {0}", this.envService.product.nameLong), click: () => this.quit(), accelerator: 'Command+Q' });
const about = new MenuItem({ label: nls.localize('mAbout', "About {0}", this.envService.product.nameLong), role: 'about' });
const checkForUpdates = this.getUpdateMenuItems();
const preferences = this.getPreferencesMenu();
const hide = new MenuItem({ label: nls.localize('mHide', "Hide {0}", this.envService.product.nameLong), role: 'hide', accelerator: 'Command+H' });
const hideOthers = new MenuItem({ label: nls.localize('mHideOthers', "Hide Others"), role: 'hideothers', accelerator: 'Command+Alt+H' });
const showAll = new MenuItem({ label: nls.localize('mShowAll', "Show All"), role: 'unhide' });
const quit = new MenuItem({ label: nls.localize('miQuit', "Quit {0}", this.envService.product.nameLong), click: () => this.quit(), accelerator: 'Command+Q' });
let actions = [about];
const actions = [about];
actions.push(...checkForUpdates);
actions.push(...[
__separator__(),
@@ -318,7 +318,7 @@ export class VSCodeMenu {
}
private setFileMenu(fileMenu: Electron.Menu): void {
let hasNoWindows = (this.windowsService.getWindowCount() === 0);
const hasNoWindows = (this.windowsService.getWindowCount() === 0);
let newFile: Electron.MenuItem;
if (hasNoWindows) {
@@ -327,8 +327,8 @@ export class VSCodeMenu {
newFile = this.createMenuItem(nls.localize({ key: 'miNewFile', comment: ['&& denotes a mnemonic'] }, "&&New File"), 'workbench.action.files.newUntitledFile');
}
let open = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miOpen', comment: ['&& denotes a mnemonic'] }, "&&Open...")), accelerator: this.getAccelerator('workbench.action.files.openFileFolder'), click: () => this.windowsService.openFileFolderPicker() });
let openFolder = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miOpenFolder', comment: ['&& denotes a mnemonic'] }, "Open &&Folder...")), accelerator: this.getAccelerator('workbench.action.files.openFolder'), click: () => this.windowsService.openFolderPicker() });
const open = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miOpen', comment: ['&& denotes a mnemonic'] }, "&&Open...")), accelerator: this.getAccelerator('workbench.action.files.openFileFolder'), click: () => this.windowsService.openFileFolderPicker() });
const openFolder = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miOpenFolder', comment: ['&& denotes a mnemonic'] }, "Open &&Folder...")), accelerator: this.getAccelerator('workbench.action.files.openFolder'), click: () => this.windowsService.openFolderPicker() });
let openFile: Electron.MenuItem;
if (hasNoWindows) {
@@ -337,24 +337,24 @@ export class VSCodeMenu {
openFile = this.createMenuItem(nls.localize({ key: 'miOpenFile', comment: ['&& denotes a mnemonic'] }, "&&Open File..."), 'workbench.action.files.openFile');
}
let openRecentMenu = new Menu();
const openRecentMenu = new Menu();
this.setOpenRecentMenu(openRecentMenu);
let openRecent = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miOpenRecent', comment: ['&& denotes a mnemonic'] }, "Open &&Recent")), submenu: openRecentMenu, enabled: openRecentMenu.items.length > 0 });
const openRecent = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miOpenRecent', comment: ['&& denotes a mnemonic'] }, "Open &&Recent")), submenu: openRecentMenu, enabled: openRecentMenu.items.length > 0 });
let saveFile = this.createMenuItem(nls.localize({ key: 'miSave', comment: ['&& denotes a mnemonic'] }, "&&Save"), 'workbench.action.files.save', this.windowsService.getWindowCount() > 0);
let saveFileAs = this.createMenuItem(nls.localize({ key: 'miSaveAs', comment: ['&& denotes a mnemonic'] }, "Save &&As..."), 'workbench.action.files.saveAs', this.windowsService.getWindowCount() > 0);
let saveAllFiles = this.createMenuItem(nls.localize({ key: 'miSaveAll', comment: ['&& denotes a mnemonic'] }, "Save A&&ll"), 'workbench.action.files.saveAll', this.windowsService.getWindowCount() > 0);
const saveFile = this.createMenuItem(nls.localize({ key: 'miSave', comment: ['&& denotes a mnemonic'] }, "&&Save"), 'workbench.action.files.save', this.windowsService.getWindowCount() > 0);
const saveFileAs = this.createMenuItem(nls.localize({ key: 'miSaveAs', comment: ['&& denotes a mnemonic'] }, "Save &&As..."), 'workbench.action.files.saveAs', this.windowsService.getWindowCount() > 0);
const saveAllFiles = this.createMenuItem(nls.localize({ key: 'miSaveAll', comment: ['&& denotes a mnemonic'] }, "Save A&&ll"), 'workbench.action.files.saveAll', this.windowsService.getWindowCount() > 0);
let preferences = this.getPreferencesMenu();
const preferences = this.getPreferencesMenu();
let newWindow = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miNewWindow', comment: ['&& denotes a mnemonic'] }, "&&New Window")), accelerator: this.getAccelerator('workbench.action.newWindow'), click: () => this.windowsService.openNewWindow() });
let revertFile = this.createMenuItem(nls.localize({ key: 'miRevert', comment: ['&& denotes a mnemonic'] }, "Revert F&&ile"), 'workbench.action.files.revert', this.windowsService.getWindowCount() > 0);
let closeWindow = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miCloseWindow', comment: ['&& denotes a mnemonic'] }, "Close &&Window")), accelerator: this.getAccelerator('workbench.action.closeWindow'), click: () => this.windowsService.getLastActiveWindow().win.close(), enabled: this.windowsService.getWindowCount() > 0 });
const newWindow = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miNewWindow', comment: ['&& denotes a mnemonic'] }, "&&New Window")), accelerator: this.getAccelerator('workbench.action.newWindow'), click: () => this.windowsService.openNewWindow() });
const revertFile = this.createMenuItem(nls.localize({ key: 'miRevert', comment: ['&& denotes a mnemonic'] }, "Revert F&&ile"), 'workbench.action.files.revert', this.windowsService.getWindowCount() > 0);
const closeWindow = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miCloseWindow', comment: ['&& denotes a mnemonic'] }, "Close &&Window")), accelerator: this.getAccelerator('workbench.action.closeWindow'), click: () => this.windowsService.getLastActiveWindow().win.close(), enabled: this.windowsService.getWindowCount() > 0 });
let closeFolder = this.createMenuItem(nls.localize({ key: 'miCloseFolder', comment: ['&& denotes a mnemonic'] }, "Close &&Folder"), 'workbench.action.closeFolder');
let closeEditor = this.createMenuItem(nls.localize({ key: 'miCloseEditor', comment: ['&& denotes a mnemonic'] }, "Close &&Editor"), 'workbench.action.closeActiveEditor');
const closeFolder = this.createMenuItem(nls.localize({ key: 'miCloseFolder', comment: ['&& denotes a mnemonic'] }, "Close &&Folder"), 'workbench.action.closeFolder');
const closeEditor = this.createMenuItem(nls.localize({ key: 'miCloseEditor', comment: ['&& denotes a mnemonic'] }, "Close &&Editor"), 'workbench.action.closeActiveEditor');
let exit = this.createMenuItem(nls.localize({ key: 'miExit', comment: ['&& denotes a mnemonic'] }, "E&&xit"), () => this.quit());
const exit = this.createMenuItem(nls.localize({ key: 'miExit', comment: ['&& denotes a mnemonic'] }, "E&&xit"), () => this.quit());
arrays.coalesce([
newFile,
@@ -381,14 +381,14 @@ export class VSCodeMenu {
}
private getPreferencesMenu(): Electron.MenuItem {
let userSettings = this.createMenuItem(nls.localize({ key: 'miOpenSettings', comment: ['&& denotes a mnemonic'] }, "&&User Settings"), 'workbench.action.openGlobalSettings');
let workspaceSettings = this.createMenuItem(nls.localize({ key: 'miOpenWorkspaceSettings', comment: ['&& denotes a mnemonic'] }, "&&Workspace Settings"), 'workbench.action.openWorkspaceSettings');
let kebindingSettings = this.createMenuItem(nls.localize({ key: 'miOpenKeymap', comment: ['&& denotes a mnemonic'] }, "&&Keyboard Shortcuts"), 'workbench.action.openGlobalKeybindings');
let snippetsSettings = this.createMenuItem(nls.localize({ key: 'miOpenSnippets', comment: ['&& denotes a mnemonic'] }, "User &&Snippets"), 'workbench.action.openSnippets');
let colorThemeSelection = this.createMenuItem(nls.localize({ key: 'miSelectColorTheme', comment: ['&& denotes a mnemonic'] }, "&&Color Theme"), 'workbench.action.selectTheme');
let iconThemeSelection = this.createMenuItem(nls.localize({ key: 'miSelectIconTheme', comment: ['&& denotes a mnemonic'] }, "File &&Icon Theme"), 'workbench.action.selectIconTheme');
const userSettings = this.createMenuItem(nls.localize({ key: 'miOpenSettings', comment: ['&& denotes a mnemonic'] }, "&&User Settings"), 'workbench.action.openGlobalSettings');
const workspaceSettings = this.createMenuItem(nls.localize({ key: 'miOpenWorkspaceSettings', comment: ['&& denotes a mnemonic'] }, "&&Workspace Settings"), 'workbench.action.openWorkspaceSettings');
const kebindingSettings = this.createMenuItem(nls.localize({ key: 'miOpenKeymap', comment: ['&& denotes a mnemonic'] }, "&&Keyboard Shortcuts"), 'workbench.action.openGlobalKeybindings');
const snippetsSettings = this.createMenuItem(nls.localize({ key: 'miOpenSnippets', comment: ['&& denotes a mnemonic'] }, "User &&Snippets"), 'workbench.action.openSnippets');
const colorThemeSelection = this.createMenuItem(nls.localize({ key: 'miSelectColorTheme', comment: ['&& denotes a mnemonic'] }, "&&Color Theme"), 'workbench.action.selectTheme');
const iconThemeSelection = this.createMenuItem(nls.localize({ key: 'miSelectIconTheme', comment: ['&& denotes a mnemonic'] }, "File &&Icon Theme"), 'workbench.action.selectIconTheme');
let preferencesMenu = new Menu();
const preferencesMenu = new Menu();
preferencesMenu.append(userSettings);
preferencesMenu.append(workspaceSettings);
preferencesMenu.append(__separator__());
@@ -406,7 +406,7 @@ export class VSCodeMenu {
// If the user selected to exit from an extension development host window, do not quit, but just
// close the window unless this is the last window that is opened.
let vscodeWindow = this.windowsService.getFocusedWindow();
const vscodeWindow = this.windowsService.getFocusedWindow();
if (vscodeWindow && vscodeWindow.isPluginDevelopmentHost && this.windowsService.getWindowCount() > 1) {
vscodeWindow.win.close();
}
@@ -424,7 +424,7 @@ export class VSCodeMenu {
private setOpenRecentMenu(openRecentMenu: Electron.Menu): void {
openRecentMenu.append(this.createMenuItem(nls.localize({ key: 'miReopenClosedEditor', comment: ['&& denotes a mnemonic'] }, "&&Reopen Closed Editor"), 'workbench.action.reopenClosedEditor'));
let {folders, files} = this.getOpenedPathsList();
const {folders, files} = this.getOpenedPathsList();
// Folders
if (folders.length > 0) {
@@ -453,7 +453,7 @@ export class VSCodeMenu {
private createOpenRecentMenuItem(path: string): Electron.MenuItem {
return new MenuItem({
label: unMnemonicLabel(path), click: () => {
let success = !!this.windowsService.open({ cli: this.envService.cliArgs, pathsToOpen: [path] });
const success = !!this.windowsService.open({ cli: this.envService.cliArgs, pathsToOpen: [path] });
if (!success) {
this.removeFromOpenedPathsList(path);
this.updateMenu();
@@ -463,7 +463,7 @@ export class VSCodeMenu {
}
private createRoleMenuItem(label: string, actionId: string, role: Electron.MenuItemRole): Electron.MenuItem {
let options: Electron.MenuItemOptions = {
const options: Electron.MenuItemOptions = {
label: mnemonicLabel(label),
accelerator: this.getAccelerator(actionId),
role,
@@ -497,10 +497,10 @@ export class VSCodeMenu {
selectAll = this.createMenuItem(nls.localize({ key: 'miSelectAll', comment: ['&& denotes a mnemonic'] }, "&&Select All"), 'editor.action.selectAll');
}
let find = this.createMenuItem(nls.localize({ key: 'miFind', comment: ['&& denotes a mnemonic'] }, "&&Find"), 'actions.find');
let replace = this.createMenuItem(nls.localize({ key: 'miReplace', comment: ['&& denotes a mnemonic'] }, "&&Replace"), 'editor.action.startFindReplaceAction');
let findInFiles = this.createMenuItem(nls.localize({ key: 'miFindInFiles', comment: ['&& denotes a mnemonic'] }, "Find &&in Files"), 'workbench.view.search');
let replaceInFiles = this.createMenuItem(nls.localize({ key: 'miReplaceInFiles', comment: ['&& denotes a mnemonic'] }, "Replace &&in Files"), 'workbench.action.replaceInFiles');
const find = this.createMenuItem(nls.localize({ key: 'miFind', comment: ['&& denotes a mnemonic'] }, "&&Find"), 'actions.find');
const replace = this.createMenuItem(nls.localize({ key: 'miReplace', comment: ['&& denotes a mnemonic'] }, "&&Replace"), 'editor.action.startFindReplaceAction');
const findInFiles = this.createMenuItem(nls.localize({ key: 'miFindInFiles', comment: ['&& denotes a mnemonic'] }, "Find &&in Files"), 'workbench.view.search');
const replaceInFiles = this.createMenuItem(nls.localize({ key: 'miReplaceInFiles', comment: ['&& denotes a mnemonic'] }, "Replace &&in Files"), 'workbench.action.replaceInFiles');
[
undo,
@@ -520,34 +520,34 @@ export class VSCodeMenu {
}
private setViewMenu(viewMenu: Electron.Menu): void {
let explorer = this.createMenuItem(nls.localize({ key: 'miViewExplorer', comment: ['&& denotes a mnemonic'] }, "&&Explorer"), 'workbench.view.explorer');
let search = this.createMenuItem(nls.localize({ key: 'miViewSearch', comment: ['&& denotes a mnemonic'] }, "&&Search"), 'workbench.view.search');
let git = this.createMenuItem(nls.localize({ key: 'miViewGit', comment: ['&& denotes a mnemonic'] }, "&&Git"), 'workbench.view.git');
let debug = this.createMenuItem(nls.localize({ key: 'miViewDebug', comment: ['&& denotes a mnemonic'] }, "&&Debug"), 'workbench.view.debug');
let extensions = this.createMenuItem(nls.localize({ key: 'miViewExtensions', comment: ['&& denotes a mnemonic'] }, "E&&xtensions"), 'workbench.view.extensions');
let output = this.createMenuItem(nls.localize({ key: 'miToggleOutput', comment: ['&& denotes a mnemonic'] }, "&&Output"), 'workbench.action.output.toggleOutput');
let debugConsole = this.createMenuItem(nls.localize({ key: 'miToggleDebugConsole', comment: ['&& denotes a mnemonic'] }, "De&&bug Console"), 'workbench.debug.action.toggleRepl');
let integratedTerminal = this.createMenuItem(nls.localize({ key: 'miToggleIntegratedTerminal', comment: ['&& denotes a mnemonic'] }, "&&Integrated Terminal"), 'workbench.action.terminal.toggleTerminal');
let problems = this.createMenuItem(nls.localize({ key: 'miMarker', comment: ['&& denotes a mnemonic'] }, "&&Problems"), 'workbench.actions.view.problems');
const explorer = this.createMenuItem(nls.localize({ key: 'miViewExplorer', comment: ['&& denotes a mnemonic'] }, "&&Explorer"), 'workbench.view.explorer');
const search = this.createMenuItem(nls.localize({ key: 'miViewSearch', comment: ['&& denotes a mnemonic'] }, "&&Search"), 'workbench.view.search');
const git = this.createMenuItem(nls.localize({ key: 'miViewGit', comment: ['&& denotes a mnemonic'] }, "&&Git"), 'workbench.view.git');
const debug = this.createMenuItem(nls.localize({ key: 'miViewDebug', comment: ['&& denotes a mnemonic'] }, "&&Debug"), 'workbench.view.debug');
const extensions = this.createMenuItem(nls.localize({ key: 'miViewExtensions', comment: ['&& denotes a mnemonic'] }, "E&&xtensions"), 'workbench.view.extensions');
const output = this.createMenuItem(nls.localize({ key: 'miToggleOutput', comment: ['&& denotes a mnemonic'] }, "&&Output"), 'workbench.action.output.toggleOutput');
const debugConsole = this.createMenuItem(nls.localize({ key: 'miToggleDebugConsole', comment: ['&& denotes a mnemonic'] }, "De&&bug Console"), 'workbench.debug.action.toggleRepl');
const integratedTerminal = this.createMenuItem(nls.localize({ key: 'miToggleIntegratedTerminal', comment: ['&& denotes a mnemonic'] }, "&&Integrated Terminal"), 'workbench.action.terminal.toggleTerminal');
const problems = this.createMenuItem(nls.localize({ key: 'miMarker', comment: ['&& denotes a mnemonic'] }, "&&Problems"), 'workbench.actions.view.problems');
let commands = this.createMenuItem(nls.localize({ key: 'miCommandPalette', comment: ['&& denotes a mnemonic'] }, "&&Command Palette..."), 'workbench.action.showCommands');
const commands = this.createMenuItem(nls.localize({ key: 'miCommandPalette', comment: ['&& denotes a mnemonic'] }, "&&Command Palette..."), 'workbench.action.showCommands');
let fullscreen = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miToggleFullScreen', comment: ['&& denotes a mnemonic'] }, "Toggle &&Full Screen")), accelerator: this.getAccelerator('workbench.action.toggleFullScreen'), click: () => this.windowsService.getLastActiveWindow().toggleFullScreen(), enabled: this.windowsService.getWindowCount() > 0 });
let toggleMenuBar = this.createMenuItem(nls.localize({ key: 'miToggleMenuBar', comment: ['&& denotes a mnemonic'] }, "Toggle Menu &&Bar"), 'workbench.action.toggleMenuBar');
let splitEditor = this.createMenuItem(nls.localize({ key: 'miSplitEditor', comment: ['&& denotes a mnemonic'] }, "Split &&Editor"), 'workbench.action.splitEditor');
let toggleSidebar = this.createMenuItem(nls.localize({ key: 'miToggleSidebar', comment: ['&& denotes a mnemonic'] }, "&&Toggle Side Bar"), 'workbench.action.toggleSidebarVisibility');
let moveSidebar = this.createMenuItem(nls.localize({ key: 'miMoveSidebar', comment: ['&& denotes a mnemonic'] }, "&&Move Side Bar"), 'workbench.action.toggleSidebarPosition');
let togglePanel = this.createMenuItem(nls.localize({ key: 'miTogglePanel', comment: ['&& denotes a mnemonic'] }, "Toggle &&Panel"), 'workbench.action.togglePanel');
let toggleStatusbar = this.createMenuItem(nls.localize({ key: 'miToggleStatusbar', comment: ['&& denotes a mnemonic'] }, "&&Toggle Status Bar"), 'workbench.action.toggleStatusbarVisibility');
const fullscreen = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miToggleFullScreen', comment: ['&& denotes a mnemonic'] }, "Toggle &&Full Screen")), accelerator: this.getAccelerator('workbench.action.toggleFullScreen'), click: () => this.windowsService.getLastActiveWindow().toggleFullScreen(), enabled: this.windowsService.getWindowCount() > 0 });
const toggleMenuBar = this.createMenuItem(nls.localize({ key: 'miToggleMenuBar', comment: ['&& denotes a mnemonic'] }, "Toggle Menu &&Bar"), 'workbench.action.toggleMenuBar');
const splitEditor = this.createMenuItem(nls.localize({ key: 'miSplitEditor', comment: ['&& denotes a mnemonic'] }, "Split &&Editor"), 'workbench.action.splitEditor');
const toggleSidebar = this.createMenuItem(nls.localize({ key: 'miToggleSidebar', comment: ['&& denotes a mnemonic'] }, "&&Toggle Side Bar"), 'workbench.action.toggleSidebarVisibility');
const moveSidebar = this.createMenuItem(nls.localize({ key: 'miMoveSidebar', comment: ['&& denotes a mnemonic'] }, "&&Move Side Bar"), 'workbench.action.toggleSidebarPosition');
const togglePanel = this.createMenuItem(nls.localize({ key: 'miTogglePanel', comment: ['&& denotes a mnemonic'] }, "Toggle &&Panel"), 'workbench.action.togglePanel');
const toggleStatusbar = this.createMenuItem(nls.localize({ key: 'miToggleStatusbar', comment: ['&& denotes a mnemonic'] }, "&&Toggle Status Bar"), 'workbench.action.toggleStatusbarVisibility');
const toggleWordWrap = this.createMenuItem(nls.localize({ key: 'miToggleWordWrap', comment: ['&& denotes a mnemonic'] }, "Toggle &&Word Wrap"), 'editor.action.toggleWordWrap');
const toggleRenderWhitespace = this.createMenuItem(nls.localize({ key: 'miToggleRenderWhitespace', comment: ['&& denotes a mnemonic'] }, "Toggle &&Render Whitespace"), 'editor.action.toggleRenderWhitespace');
const toggleRenderControlCharacters = this.createMenuItem(nls.localize({ key: 'miToggleRenderControlCharacters', comment: ['&& denotes a mnemonic'] }, "Toggle &&Control Characters"), 'editor.action.toggleRenderControlCharacter');
let zoomIn = this.createMenuItem(nls.localize({ key: 'miZoomIn', comment: ['&& denotes a mnemonic'] }, "&&Zoom In"), 'workbench.action.zoomIn');
let zoomOut = this.createMenuItem(nls.localize({ key: 'miZoomOut', comment: ['&& denotes a mnemonic'] }, "Zoom O&&ut"), 'workbench.action.zoomOut');
let resetZoom = this.createMenuItem(nls.localize({ key: 'miZoomReset', comment: ['&& denotes a mnemonic'] }, "&&Reset Zoom"), 'workbench.action.zoomReset');
const zoomIn = this.createMenuItem(nls.localize({ key: 'miZoomIn', comment: ['&& denotes a mnemonic'] }, "&&Zoom In"), 'workbench.action.zoomIn');
const zoomOut = this.createMenuItem(nls.localize({ key: 'miZoomOut', comment: ['&& denotes a mnemonic'] }, "Zoom O&&ut"), 'workbench.action.zoomOut');
const resetZoom = this.createMenuItem(nls.localize({ key: 'miZoomReset', comment: ['&& denotes a mnemonic'] }, "&&Reset Zoom"), 'workbench.action.zoomReset');
arrays.coalesce([
commands,
@@ -583,15 +583,15 @@ export class VSCodeMenu {
}
private setGotoMenu(gotoMenu: Electron.Menu): void {
let back = this.createMenuItem(nls.localize({ key: 'miBack', comment: ['&& denotes a mnemonic'] }, "&&Back"), 'workbench.action.navigateBack');
let forward = this.createMenuItem(nls.localize({ key: 'miForward', comment: ['&& denotes a mnemonic'] }, "&&Forward"), 'workbench.action.navigateForward');
const back = this.createMenuItem(nls.localize({ key: 'miBack', comment: ['&& denotes a mnemonic'] }, "&&Back"), 'workbench.action.navigateBack');
const forward = this.createMenuItem(nls.localize({ key: 'miForward', comment: ['&& denotes a mnemonic'] }, "&&Forward"), 'workbench.action.navigateForward');
let switchEditorMenu = new Menu();
const switchEditorMenu = new Menu();
let nextEditor = this.createMenuItem(nls.localize({ key: 'miNextEditor', comment: ['&& denotes a mnemonic'] }, "&&Next Editor"), 'workbench.action.nextEditor');
let previousEditor = this.createMenuItem(nls.localize({ key: 'miPreviousEditor', comment: ['&& denotes a mnemonic'] }, "&&Previous Editor"), 'workbench.action.previousEditor');
let nextEditorInGroup = this.createMenuItem(nls.localize({ key: 'miNextEditorInGroup', comment: ['&& denotes a mnemonic'] }, "&&Next Used Editor in Group"), 'workbench.action.openNextRecentlyUsedEditorInGroup');
let previousEditorInGroup = this.createMenuItem(nls.localize({ key: 'miPreviousEditorInGroup', comment: ['&& denotes a mnemonic'] }, "&&Previous Used Editor in Group"), 'workbench.action.openPreviousRecentlyUsedEditorInGroup');
const nextEditor = this.createMenuItem(nls.localize({ key: 'miNextEditor', comment: ['&& denotes a mnemonic'] }, "&&Next Editor"), 'workbench.action.nextEditor');
const previousEditor = this.createMenuItem(nls.localize({ key: 'miPreviousEditor', comment: ['&& denotes a mnemonic'] }, "&&Previous Editor"), 'workbench.action.previousEditor');
const nextEditorInGroup = this.createMenuItem(nls.localize({ key: 'miNextEditorInGroup', comment: ['&& denotes a mnemonic'] }, "&&Next Used Editor in Group"), 'workbench.action.openNextRecentlyUsedEditorInGroup');
const previousEditorInGroup = this.createMenuItem(nls.localize({ key: 'miPreviousEditorInGroup', comment: ['&& denotes a mnemonic'] }, "&&Previous Used Editor in Group"), 'workbench.action.openPreviousRecentlyUsedEditorInGroup');
[
nextEditor,
@@ -601,15 +601,15 @@ export class VSCodeMenu {
previousEditorInGroup
].forEach(item => switchEditorMenu.append(item));
let switchEditor = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miSwitchEditor', comment: ['&& denotes a mnemonic'] }, "Switch &&Editor")), submenu: switchEditorMenu, enabled: true });
const switchEditor = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miSwitchEditor', comment: ['&& denotes a mnemonic'] }, "Switch &&Editor")), submenu: switchEditorMenu, enabled: true });
let switchGroupMenu = new Menu();
const switchGroupMenu = new Menu();
let focusFirstGroup = this.createMenuItem(nls.localize({ key: 'miFocusFirstGroup', comment: ['&& denotes a mnemonic'] }, "&&Left Group"), 'workbench.action.focusFirstEditorGroup');
let focusSecondGroup = this.createMenuItem(nls.localize({ key: 'miFocusSecondGroup', comment: ['&& denotes a mnemonic'] }, "&&Center Group"), 'workbench.action.focusSecondEditorGroup');
let focusThirdGroup = this.createMenuItem(nls.localize({ key: 'miFocusThirdGroup', comment: ['&& denotes a mnemonic'] }, "&&Right Group"), 'workbench.action.focusThirdEditorGroup');
let nextGroup = this.createMenuItem(nls.localize({ key: 'miNextGroup', comment: ['&& denotes a mnemonic'] }, "&&Next Group"), 'workbench.action.focusNextGroup');
let previousGroup = this.createMenuItem(nls.localize({ key: 'miPreviousGroup', comment: ['&& denotes a mnemonic'] }, "&&Previous Group"), 'workbench.action.focusPreviousGroup');
const focusFirstGroup = this.createMenuItem(nls.localize({ key: 'miFocusFirstGroup', comment: ['&& denotes a mnemonic'] }, "&&Left Group"), 'workbench.action.focusFirstEditorGroup');
const focusSecondGroup = this.createMenuItem(nls.localize({ key: 'miFocusSecondGroup', comment: ['&& denotes a mnemonic'] }, "&&Center Group"), 'workbench.action.focusSecondEditorGroup');
const focusThirdGroup = this.createMenuItem(nls.localize({ key: 'miFocusThirdGroup', comment: ['&& denotes a mnemonic'] }, "&&Right Group"), 'workbench.action.focusThirdEditorGroup');
const nextGroup = this.createMenuItem(nls.localize({ key: 'miNextGroup', comment: ['&& denotes a mnemonic'] }, "&&Next Group"), 'workbench.action.focusNextGroup');
const previousGroup = this.createMenuItem(nls.localize({ key: 'miPreviousGroup', comment: ['&& denotes a mnemonic'] }, "&&Previous Group"), 'workbench.action.focusPreviousGroup');
[
focusFirstGroup,
@@ -620,12 +620,12 @@ export class VSCodeMenu {
previousGroup
].forEach(item => switchGroupMenu.append(item));
let switchGroup = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miSwitchGroup', comment: ['&& denotes a mnemonic'] }, "Switch &&Group")), submenu: switchGroupMenu, enabled: true });
const switchGroup = new MenuItem({ label: mnemonicLabel(nls.localize({ key: 'miSwitchGroup', comment: ['&& denotes a mnemonic'] }, "Switch &&Group")), submenu: switchGroupMenu, enabled: true });
let gotoFile = this.createMenuItem(nls.localize({ key: 'miGotoFile', comment: ['&& denotes a mnemonic'] }, "Go to &&File..."), 'workbench.action.quickOpen');
let gotoSymbol = this.createMenuItem(nls.localize({ key: 'miGotoSymbol', comment: ['&& denotes a mnemonic'] }, "Go to &&Symbol..."), 'workbench.action.gotoSymbol');
let gotoDefinition = this.createMenuItem(nls.localize({ key: 'miGotoDefinition', comment: ['&& denotes a mnemonic'] }, "Go to &&Definition"), 'editor.action.goToDeclaration');
let gotoLine = this.createMenuItem(nls.localize({ key: 'miGotoLine', comment: ['&& denotes a mnemonic'] }, "Go to &&Line..."), 'workbench.action.gotoLine');
const gotoFile = this.createMenuItem(nls.localize({ key: 'miGotoFile', comment: ['&& denotes a mnemonic'] }, "Go to &&File..."), 'workbench.action.quickOpen');
const gotoSymbol = this.createMenuItem(nls.localize({ key: 'miGotoSymbol', comment: ['&& denotes a mnemonic'] }, "Go to &&Symbol..."), 'workbench.action.gotoSymbol');
const gotoDefinition = this.createMenuItem(nls.localize({ key: 'miGotoDefinition', comment: ['&& denotes a mnemonic'] }, "Go to &&Definition"), 'editor.action.goToDeclaration');
const gotoLine = this.createMenuItem(nls.localize({ key: 'miGotoLine', comment: ['&& denotes a mnemonic'] }, "Go to &&Line..."), 'workbench.action.gotoLine');
[
back,
@@ -642,9 +642,9 @@ export class VSCodeMenu {
}
private setMacWindowMenu(macWindowMenu: Electron.Menu): void {
let minimize = new MenuItem({ label: nls.localize('mMinimize', "Minimize"), role: 'minimize', accelerator: 'Command+M', enabled: this.windowsService.getWindowCount() > 0 });
let close = new MenuItem({ label: nls.localize('mClose', "Close"), role: 'close', accelerator: 'Command+W', enabled: this.windowsService.getWindowCount() > 0 });
let bringAllToFront = new MenuItem({ label: nls.localize('mBringToFront', "Bring All to Front"), role: 'front', enabled: this.windowsService.getWindowCount() > 0 });
const minimize = new MenuItem({ label: nls.localize('mMinimize', "Minimize"), role: 'minimize', accelerator: 'Command+M', enabled: this.windowsService.getWindowCount() > 0 });
const close = new MenuItem({ label: nls.localize('mClose', "Close"), role: 'close', accelerator: 'Command+W', enabled: this.windowsService.getWindowCount() > 0 });
const bringAllToFront = new MenuItem({ label: nls.localize('mBringToFront', "Bring All to Front"), role: 'front', enabled: this.windowsService.getWindowCount() > 0 });
[
minimize,
@@ -655,14 +655,14 @@ export class VSCodeMenu {
}
private toggleDevTools(): void {
let w = this.windowsService.getFocusedWindow();
const w = this.windowsService.getFocusedWindow();
if (w && w.win) {
w.win.webContents.toggleDevTools();
}
}
private setHelpMenu(helpMenu: Electron.Menu): void {
let toggleDevToolsItem = new MenuItem({
const toggleDevToolsItem = new MenuItem({
label: mnemonicLabel(nls.localize({ key: 'miToggleDevTools', comment: ['&& denotes a mnemonic'] }, "&&Toggle Developer Tools")),
accelerator: this.getAccelerator('workbench.action.toggleDevTools'),
click: () => this.toggleDevTools(),
@@ -682,7 +682,7 @@ export class VSCodeMenu {
this.envService.product.licenseUrl ? new MenuItem({
label: mnemonicLabel(nls.localize({ key: 'miLicense', comment: ['&& denotes a mnemonic'] }, "&&View License")), click: () => {
if (platform.language) {
let queryArgChar = this.envService.product.licenseUrl.indexOf('?') > 0 ? '&' : '?';
const queryArgChar = this.envService.product.licenseUrl.indexOf('?') > 0 ? '&' : '?';
this.openUrl(`${this.envService.product.licenseUrl}${queryArgChar}lang=${platform.language}`, 'openLicenseUrl');
} else {
this.openUrl(this.envService.product.licenseUrl, 'openLicenseUrl');
@@ -692,7 +692,7 @@ export class VSCodeMenu {
this.envService.product.privacyStatementUrl ? new MenuItem({
label: mnemonicLabel(nls.localize({ key: 'miPrivacyStatement', comment: ['&& denotes a mnemonic'] }, "&&Privacy Statement")), click: () => {
if (platform.language) {
let queryArgChar = this.envService.product.licenseUrl.indexOf('?') > 0 ? '&' : '?';
const queryArgChar = this.envService.product.licenseUrl.indexOf('?') > 0 ? '&' : '?';
this.openUrl(`${this.envService.product.privacyStatementUrl}${queryArgChar}lang=${platform.language}`, 'openPrivacyStatement');
} else {
this.openUrl(this.envService.product.privacyStatementUrl, 'openPrivacyStatement');
@@ -721,7 +721,7 @@ export class VSCodeMenu {
return [];
case UpdateState.UpdateDownloaded:
let update = this.updateService.availableUpdate;
const update = this.updateService.availableUpdate;
return [new MenuItem({
label: nls.localize('miRestartToUpdate', "Restart To Update..."), click: () => {
this.reportMenuActionTelemetry('RestartToUpdate');
@@ -742,14 +742,14 @@ export class VSCodeMenu {
})];
}
let updateAvailableLabel = platform.isWindows
const updateAvailableLabel = platform.isWindows
? nls.localize('miDownloadingUpdate', "Downloading Update...")
: nls.localize('miInstallingUpdate', "Installing Update...");
return [new MenuItem({ label: updateAvailableLabel, enabled: false })];
default:
let result = [new MenuItem({
const result = [new MenuItem({
label: nls.localize('miCheckForUpdates', "Check For Updates..."), click: () => setTimeout(() => {
this.reportMenuActionTelemetry('CheckForUpdate');
this.updateService.checkForUpdates(true);
@@ -763,16 +763,16 @@ export class VSCodeMenu {
private createMenuItem(label: string, actionId: string, enabled?: boolean): Electron.MenuItem;
private createMenuItem(label: string, click: () => void, enabled?: boolean): Electron.MenuItem;
private createMenuItem(arg1: string, arg2: any, arg3?: boolean): Electron.MenuItem {
let label = mnemonicLabel(arg1);
let click: () => void = (typeof arg2 === 'function') ? arg2 : () => this.windowsService.sendToFocused('vscode:runAction', arg2);
let enabled = typeof arg3 === 'boolean' ? arg3 : this.windowsService.getWindowCount() > 0;
const label = mnemonicLabel(arg1);
const click: () => void = (typeof arg2 === 'function') ? arg2 : () => this.windowsService.sendToFocused('vscode:runAction', arg2);
const enabled = typeof arg3 === 'boolean' ? arg3 : this.windowsService.getWindowCount() > 0;
let actionId: string;
if (typeof arg2 === 'string') {
actionId = arg2;
}
let options: Electron.MenuItemOptions = {
const options: Electron.MenuItemOptions = {
label: label,
accelerator: this.getAccelerator(actionId),
click: click,
@@ -788,7 +788,7 @@ export class VSCodeMenu {
accelerator: this.getAccelerator(actionId),
enabled: this.windowsService.getWindowCount() > 0,
click: () => {
let windowInFocus = this.windowsService.getFocusedWindow();
const windowInFocus = this.windowsService.getFocusedWindow();
if (!windowInFocus) {
return;
}
@@ -804,7 +804,7 @@ export class VSCodeMenu {
private getAccelerator(actionId: string): string {
if (actionId) {
let resolvedKeybinding = this.mapResolvedKeybindingToActionId[actionId];
const resolvedKeybinding = this.mapResolvedKeybindingToActionId[actionId];
if (resolvedKeybinding) {
return resolvedKeybinding; // keybinding is fully resolved
}
@@ -813,7 +813,7 @@ export class VSCodeMenu {
this.actionIdKeybindingRequests.push(actionId); // keybinding needs to be resolved
}
let lastKnownKeybinding = this.mapLastKnownKeybindingToActionId[actionId];
const lastKnownKeybinding = this.mapLastKnownKeybindingToActionId[actionId];
return lastKnownKeybinding; // return the last known keybining (chance of mismatch is very low unless it changed)
}
@@ -822,7 +822,7 @@ export class VSCodeMenu {
}
private openAboutDialog(): void {
let lastActiveWindow = this.windowsService.getFocusedWindow() || this.windowsService.getLastActiveWindow();
const lastActiveWindow = this.windowsService.getFocusedWindow() || this.windowsService.getLastActiveWindow();
dialog.showMessageBox(lastActiveWindow && lastActiveWindow.win, {
title: this.envService.product.nameLong,
+1 -1
View File
@@ -26,7 +26,7 @@ function _spawnSharedProcess(options: ISharedProcessOptions): cp.ChildProcess {
}
if (options.debugPort) {
execArgv.push(`--debug=${ options.debugPort }`);
execArgv.push(`--debug=${options.debugPort}`);
}
const result = cp.fork(boostrapPath, ['--type=SharedProcess'], { env, execArgv });
+2 -2
View File
@@ -68,7 +68,7 @@ export class StorageService implements IStorageService {
}
}
let oldValue = this.database[key];
const oldValue = this.database[key];
this.database[key] = data;
this.save();
@@ -81,7 +81,7 @@ export class StorageService implements IStorageService {
}
if (this.database[key]) {
let oldValue = this.database[key];
const oldValue = this.database[key];
delete this.database[key];
this.save();
+1 -1
View File
@@ -131,7 +131,7 @@ export class UpdateManager extends EventEmitter implements IUpdateService {
});
this.raw.on('update-downloaded', (event: any, releaseNotes: string, version: string, date: Date, url: string, rawQuitAndUpdate: () => void) => {
let data: IUpdate = {
const data: IUpdate = {
releaseNotes: releaseNotes,
version: version,
date: date,
+59 -59
View File
@@ -211,7 +211,7 @@ export class WindowsManager implements IWindowsService {
ipc.on('vscode:workbenchLoaded', (event, windowId: number) => {
this.logService.log('IPC#vscode-workbenchLoaded');
let win = this.getWindowById(windowId);
const win = this.getWindowById(windowId);
if (win) {
win.setReady();
@@ -241,7 +241,7 @@ export class WindowsManager implements IWindowsService {
ipc.on('vscode:closeFolder', (event, windowId: number) => {
this.logService.log('IPC#vscode-closeFolder');
let win = this.getWindowById(windowId);
const win = this.getWindowById(windowId);
if (win) {
this.open({ cli: this.envService.cliArgs, forceEmpty: true, windowToUse: win });
}
@@ -256,7 +256,7 @@ export class WindowsManager implements IWindowsService {
ipc.on('vscode:reloadWindow', (event, windowId: number) => {
this.logService.log('IPC#vscode:reloadWindow');
let vscodeWindow = this.getWindowById(windowId);
const vscodeWindow = this.getWindowById(windowId);
if (vscodeWindow) {
this.reload(vscodeWindow);
}
@@ -265,7 +265,7 @@ export class WindowsManager implements IWindowsService {
ipc.on('vscode:toggleFullScreen', (event, windowId: number) => {
this.logService.log('IPC#vscode:toggleFullScreen');
let vscodeWindow = this.getWindowById(windowId);
const vscodeWindow = this.getWindowById(windowId);
if (vscodeWindow) {
vscodeWindow.toggleFullScreen();
}
@@ -274,7 +274,7 @@ export class WindowsManager implements IWindowsService {
ipc.on('vscode:setFullScreen', (event, windowId: number, fullscreen: boolean) => {
this.logService.log('IPC#vscode:setFullScreen');
let vscodeWindow = this.getWindowById(windowId);
const vscodeWindow = this.getWindowById(windowId);
if (vscodeWindow) {
vscodeWindow.win.setFullScreen(fullscreen);
}
@@ -283,7 +283,7 @@ export class WindowsManager implements IWindowsService {
ipc.on('vscode:toggleDevTools', (event, windowId: number) => {
this.logService.log('IPC#vscode:toggleDevTools');
let vscodeWindow = this.getWindowById(windowId);
const vscodeWindow = this.getWindowById(windowId);
if (vscodeWindow) {
vscodeWindow.win.webContents.toggleDevTools();
}
@@ -292,7 +292,7 @@ export class WindowsManager implements IWindowsService {
ipc.on('vscode:openDevTools', (event, windowId: number) => {
this.logService.log('IPC#vscode:openDevTools');
let vscodeWindow = this.getWindowById(windowId);
const vscodeWindow = this.getWindowById(windowId);
if (vscodeWindow) {
vscodeWindow.win.webContents.openDevTools();
vscodeWindow.win.show();
@@ -302,7 +302,7 @@ export class WindowsManager implements IWindowsService {
ipc.on('vscode:setRepresentedFilename', (event, windowId: number, fileName: string) => {
this.logService.log('IPC#vscode:setRepresentedFilename');
let vscodeWindow = this.getWindowById(windowId);
const vscodeWindow = this.getWindowById(windowId);
if (vscodeWindow) {
vscodeWindow.win.setRepresentedFilename(fileName);
}
@@ -311,7 +311,7 @@ export class WindowsManager implements IWindowsService {
ipc.on('vscode:setMenuBarVisibility', (event, windowId: number, visibility: boolean) => {
this.logService.log('IPC#vscode:setMenuBarVisibility');
let vscodeWindow = this.getWindowById(windowId);
const vscodeWindow = this.getWindowById(windowId);
if (vscodeWindow) {
vscodeWindow.win.setMenuBarVisibility(visibility);
}
@@ -320,7 +320,7 @@ export class WindowsManager implements IWindowsService {
ipc.on('vscode:flashFrame', (event, windowId: number) => {
this.logService.log('IPC#vscode:flashFrame');
let vscodeWindow = this.getWindowById(windowId);
const vscodeWindow = this.getWindowById(windowId);
if (vscodeWindow) {
vscodeWindow.win.flashFrame(!vscodeWindow.win.isFocused());
}
@@ -329,7 +329,7 @@ export class WindowsManager implements IWindowsService {
ipc.on('vscode:openRecent', (event, windowId: number) => {
this.logService.log('IPC#vscode:openRecent');
let vscodeWindow = this.getWindowById(windowId);
const vscodeWindow = this.getWindowById(windowId);
if (vscodeWindow) {
const recents = this.getRecentlyOpenedPaths(vscodeWindow.config.workspacePath, vscodeWindow.config.filesToOpen);
@@ -340,7 +340,7 @@ export class WindowsManager implements IWindowsService {
ipc.on('vscode:focusWindow', (event, windowId: number) => {
this.logService.log('IPC#vscode:focusWindow');
let vscodeWindow = this.getWindowById(windowId);
const vscodeWindow = this.getWindowById(windowId);
if (vscodeWindow) {
vscodeWindow.win.focus();
}
@@ -349,7 +349,7 @@ export class WindowsManager implements IWindowsService {
ipc.on('vscode:setDocumentEdited', (event, windowId: number, edited: boolean) => {
this.logService.log('IPC#vscode:setDocumentEdited');
let vscodeWindow = this.getWindowById(windowId);
const vscodeWindow = this.getWindowById(windowId);
if (vscodeWindow && vscodeWindow.win.isDocumentEdited() !== edited) {
vscodeWindow.win.setDocumentEdited(edited);
}
@@ -359,8 +359,8 @@ export class WindowsManager implements IWindowsService {
this.logService.log('IPC#vscode:toggleMenuBar');
// Update in settings
let menuBarHidden = this.storageService.getItem(VSCodeWindow.menuBarHiddenKey, false);
let newMenuBarHidden = !menuBarHidden;
const menuBarHidden = this.storageService.getItem(VSCodeWindow.menuBarHiddenKey, false);
const newMenuBarHidden = !menuBarHidden;
this.storageService.setItem(VSCodeWindow.menuBarHiddenKey, newMenuBarHidden);
// Update across windows
@@ -368,7 +368,7 @@ export class WindowsManager implements IWindowsService {
// Inform user if menu bar is now hidden
if (newMenuBarHidden) {
let vscodeWindow = this.getWindowById(windowId);
const vscodeWindow = this.getWindowById(windowId);
if (vscodeWindow) {
vscodeWindow.send('vscode:showInfoMessage', nls.localize('hiddenMenuBar', "You can still access the menu bar by pressing the **Alt** key."));
}
@@ -399,9 +399,9 @@ export class WindowsManager implements IWindowsService {
});
ipc.on('vscode:log', (event, logEntry: ILogEntry) => {
let args = [];
const args = [];
try {
let parsed = JSON.parse(logEntry.arguments);
const parsed = JSON.parse(logEntry.arguments);
args.push(...Object.getOwnPropertyNames(parsed).map(o => parsed[o]));
} catch (error) {
args.push(logEntry.arguments);
@@ -504,16 +504,16 @@ export class WindowsManager implements IWindowsService {
public open(openConfig: IOpenConfiguration): VSCodeWindow[] {
let iPathsToOpen: IPath[];
let usedWindows: VSCodeWindow[] = [];
const usedWindows: VSCodeWindow[] = [];
// Find paths from provided paths if any
if (openConfig.pathsToOpen && openConfig.pathsToOpen.length > 0) {
iPathsToOpen = openConfig.pathsToOpen.map((pathToOpen) => {
let iPath = this.toIPath(pathToOpen, false, openConfig.cli && openConfig.cli.goto);
const iPath = this.toIPath(pathToOpen, false, openConfig.cli && openConfig.cli.goto);
// Warn if the requested path to open does not exist
if (!iPath) {
let options: Electron.ShowMessageBoxOptions = {
const options: Electron.ShowMessageBoxOptions = {
title: this.envService.product.nameLong,
type: 'info',
buttons: [nls.localize('ok', "OK")],
@@ -522,7 +522,7 @@ export class WindowsManager implements IWindowsService {
noLink: true
};
let activeWindow = BrowserWindow.getFocusedWindow();
const activeWindow = BrowserWindow.getFocusedWindow();
if (activeWindow) {
dialog.showMessageBox(activeWindow, options);
} else {
@@ -548,7 +548,7 @@ export class WindowsManager implements IWindowsService {
// Otherwise infer from command line arguments
else {
let ignoreFileNotFound = openConfig.cli.paths.length > 0; // we assume the user wants to create this file from command line
const ignoreFileNotFound = openConfig.cli.paths.length > 0; // we assume the user wants to create this file from command line
iPathsToOpen = this.cliToPaths(openConfig.cli, ignoreFileNotFound);
}
@@ -560,7 +560,7 @@ export class WindowsManager implements IWindowsService {
let filesToCreate = iPathsToOpen.filter((iPath) => !!iPath.filePath && iPath.createFilePath && !iPath.installExtensionPath);
// Diff mode needs special care
let candidates = iPathsToOpen.filter((iPath) => !!iPath.filePath && !iPath.createFilePath && !iPath.installExtensionPath);
const candidates = iPathsToOpen.filter((iPath) => !!iPath.filePath && !iPath.createFilePath && !iPath.installExtensionPath);
if (openConfig.diffMode) {
if (candidates.length === 2) {
filesToDiff = candidates;
@@ -579,7 +579,7 @@ export class WindowsManager implements IWindowsService {
// Handle files to open/diff or to create when we dont open a folder
if (!foldersToOpen.length && (filesToOpen.length > 0 || filesToCreate.length > 0 || filesToDiff.length > 0 || extensionsToInstall.length > 0)) {
// Let the user settings override how files are open in a new window or same window unless we are forced
// const the user settings override how files are open in a new window or same window unless we are forced
let openFilesInNewWindow: boolean;
if (openConfig.forceNewWindow) {
openFilesInNewWindow = true;
@@ -594,7 +594,7 @@ export class WindowsManager implements IWindowsService {
}
// Open Files in last instance if any and flag tells us so
let lastActiveWindow = this.getLastActiveWindow();
const lastActiveWindow = this.getLastActiveWindow();
if (!openFilesInNewWindow && lastActiveWindow) {
lastActiveWindow.focus();
lastActiveWindow.ready().then((readyWindow) => {
@@ -615,7 +615,7 @@ export class WindowsManager implements IWindowsService {
// Otherwise open instance with files
else {
configuration = this.toConfiguration(this.getWindowUserEnv(openConfig), openConfig.cli, null, filesToOpen, filesToCreate, filesToDiff, extensionsToInstall);
let browserWindow = this.openInBrowserWindow(configuration, true /* new window */);
const browserWindow = this.openInBrowserWindow(configuration, true /* new window */);
usedWindows.push(browserWindow);
openConfig.forceNewWindow = true; // any other folders to open must open in new window then
@@ -627,9 +627,9 @@ export class WindowsManager implements IWindowsService {
if (foldersToOpen.length > 0) {
// Check for existing instances
let windowsOnWorkspacePath = arrays.coalesce(foldersToOpen.map((iPath) => this.findWindow(iPath.workspacePath)));
const windowsOnWorkspacePath = arrays.coalesce(foldersToOpen.map((iPath) => this.findWindow(iPath.workspacePath)));
if (windowsOnWorkspacePath.length > 0) {
let browserWindow = windowsOnWorkspacePath[0];
const browserWindow = windowsOnWorkspacePath[0];
browserWindow.focus(); // just focus one of them
browserWindow.ready().then((readyWindow) => {
readyWindow.send('vscode:openFiles', {
@@ -661,7 +661,7 @@ export class WindowsManager implements IWindowsService {
}
configuration = this.toConfiguration(this.getWindowUserEnv(openConfig), openConfig.cli, folderToOpen.workspacePath, filesToOpen, filesToCreate, filesToDiff, extensionsToInstall);
let browserWindow = this.openInBrowserWindow(configuration, openInNewWindow, openInNewWindow ? void 0 : openConfig.windowToUse);
const browserWindow = this.openInBrowserWindow(configuration, openInNewWindow, openInNewWindow ? void 0 : openConfig.windowToUse);
usedWindows.push(browserWindow);
// Reset these because we handled them
@@ -677,8 +677,8 @@ export class WindowsManager implements IWindowsService {
// Handle empty
if (emptyToOpen.length > 0) {
emptyToOpen.forEach(() => {
let configuration = this.toConfiguration(this.getWindowUserEnv(openConfig), openConfig.cli);
let browserWindow = this.openInBrowserWindow(configuration, openInNewWindow, openInNewWindow ? void 0 : openConfig.windowToUse);
const configuration = this.toConfiguration(this.getWindowUserEnv(openConfig), openConfig.cli);
const browserWindow = this.openInBrowserWindow(configuration, openInNewWindow, openInNewWindow ? void 0 : openConfig.windowToUse);
usedWindows.push(browserWindow);
openInNewWindow = true; // any other folders to open must open in new window then
@@ -717,7 +717,7 @@ export class WindowsManager implements IWindowsService {
// Fill in previously opened workspace unless an explicit path is provided and we are not unit testing
if (openConfig.cli.paths.length === 0 && !openConfig.cli.extensionTestsPath) {
let workspaceToOpen = this.windowsState.lastPluginDevelopmentHostWindow && this.windowsState.lastPluginDevelopmentHostWindow.workspacePath;
const workspaceToOpen = this.windowsState.lastPluginDevelopmentHostWindow && this.windowsState.lastPluginDevelopmentHostWindow.workspacePath;
if (workspaceToOpen) {
openConfig.cli.paths = [workspaceToOpen];
}
@@ -736,7 +736,7 @@ export class WindowsManager implements IWindowsService {
}
private toConfiguration(userEnv: IProcessEnvironment, cli: ICommandLineArguments, workspacePath?: string, filesToOpen?: IPath[], filesToCreate?: IPath[], filesToDiff?: IPath[], extensionsToInstall?: string[]): IWindowConfiguration {
let configuration: IWindowConfiguration = mixin({}, cli); // inherit all properties from CLI
const configuration: IWindowConfiguration = mixin({}, cli); // inherit all properties from CLI
configuration.appRoot = this.envService.appRoot;
configuration.execPath = process.execPath;
configuration.userEnv = userEnv;
@@ -754,7 +754,7 @@ export class WindowsManager implements IWindowsService {
let folders: string[];
// Get from storage
let storedRecents = this.storageService.getItem<IOpenedPathsList>(WindowsManager.openedPathsListStorageKey);
const storedRecents = this.storageService.getItem<IOpenedPathsList>(WindowsManager.openedPathsListStorageKey);
if (storedRecents) {
files = storedRecents.files || [];
folders = storedRecents.folders || [];
@@ -791,9 +791,9 @@ export class WindowsManager implements IWindowsService {
anyPath = parsedPath.path;
}
let candidate = path.normalize(anyPath);
const candidate = path.normalize(anyPath);
try {
let candidateStat = fs.statSync(candidate);
const candidateStat = fs.statSync(candidate);
if (candidateStat) {
return candidateStat.isFile() ?
{
@@ -831,11 +831,11 @@ export class WindowsManager implements IWindowsService {
reopenFolders = (windowConfig && windowConfig.reopenFolders) || ReopenFoldersSetting.ONE;
}
let lastActiveFolder = this.windowsState.lastActiveWindow && this.windowsState.lastActiveWindow.workspacePath;
const lastActiveFolder = this.windowsState.lastActiveWindow && this.windowsState.lastActiveWindow.workspacePath;
// Restore all
if (reopenFolders === ReopenFoldersSetting.ALL) {
let lastOpenedFolders = this.windowsState.openedFolders.map(o => o.workspacePath);
const lastOpenedFolders = this.windowsState.openedFolders.map(o => o.workspacePath);
// If we have a last active folder, move it to the end
if (lastActiveFolder) {
@@ -852,7 +852,7 @@ export class WindowsManager implements IWindowsService {
}
}
let iPaths = candidates.map((candidate) => this.toIPath(candidate, ignoreFileNotFound, cli.goto)).filter((path) => !!path);
const iPaths = candidates.map((candidate) => this.toIPath(candidate, ignoreFileNotFound, cli.goto)).filter((path) => !!path);
if (iPaths.length > 0) {
return iPaths;
}
@@ -901,7 +901,7 @@ export class WindowsManager implements IWindowsService {
// Some configuration things get inherited if the window is being reused and we are
// in plugin development host mode. These options are all development related.
let currentWindowConfig = vscodeWindow.config;
const currentWindowConfig = vscodeWindow.config;
if (!configuration.extensionDevelopmentPath && currentWindowConfig && !!currentWindowConfig.extensionDevelopmentPath) {
configuration.extensionDevelopmentPath = currentWindowConfig.extensionDevelopmentPath;
configuration.verbose = currentWindowConfig.verbose;
@@ -932,14 +932,14 @@ export class WindowsManager implements IWindowsService {
// Known Folder - load from stored settings if any
if (configuration.workspacePath) {
let stateForWorkspace = this.windowsState.openedFolders.filter(o => this.isPathEqual(o.workspacePath, configuration.workspacePath)).map(o => o.uiState);
const stateForWorkspace = this.windowsState.openedFolders.filter(o => this.isPathEqual(o.workspacePath, configuration.workspacePath)).map(o => o.uiState);
if (stateForWorkspace.length) {
return stateForWorkspace[0];
}
}
// First Window
let lastActive = this.getLastActiveWindow();
const lastActive = this.getLastActiveWindow();
if (!lastActive && this.windowsState.lastActiveWindow) {
return this.windowsState.lastActiveWindow.uiState;
}
@@ -950,7 +950,7 @@ export class WindowsManager implements IWindowsService {
// We want the new window to open on the same display that the last active one is in
let displayToUse: Electron.Display;
let displays = screen.getAllDisplays();
const displays = screen.getAllDisplays();
// Single Display
if (displays.length === 1) {
@@ -962,7 +962,7 @@ export class WindowsManager implements IWindowsService {
// on mac there is 1 menu per window so we need to use the monitor where the cursor currently is
if (platform.isMacintosh) {
let cursorPoint = screen.getCursorScreenPoint();
const cursorPoint = screen.getCursorScreenPoint();
displayToUse = screen.getDisplayNearestPoint(cursorPoint);
}
@@ -977,7 +977,7 @@ export class WindowsManager implements IWindowsService {
}
}
let defaultState = defaultWindowState();
const defaultState = defaultWindowState();
defaultState.x = displayToUse.bounds.x + (displayToUse.bounds.width / 2) - (defaultState.width / 2);
defaultState.y = displayToUse.bounds.y + (displayToUse.bounds.height / 2) - (defaultState.height / 2);
@@ -989,7 +989,7 @@ export class WindowsManager implements IWindowsService {
return state;
}
let existingWindowBounds = WindowsManager.WINDOWS.map((win) => win.getBounds());
const existingWindowBounds = WindowsManager.WINDOWS.map((win) => win.getBounds());
while (existingWindowBounds.some((b) => b.x === state.x || b.y === state.y)) {
state.x += 30;
state.y += 30;
@@ -1019,8 +1019,8 @@ export class WindowsManager implements IWindowsService {
}
private getFileOrFolderPaths(options: INativeOpenDialogOptions, clb: (paths: string[]) => void): void {
let workingDir = options.path ||  this.storageService.getItem<string>(WindowsManager.workingDirPickerStorageKey);
let focussedWindow = this.getFocusedWindow();
const workingDir = options.path || this.storageService.getItem<string>(WindowsManager.workingDirPickerStorageKey);
const focussedWindow = this.getFocusedWindow();
let pickerProperties: ('openFile' | 'openDirectory' | 'multiSelections' | 'createDirectory')[];
if (options.pickFiles && options.pickFolders) {
@@ -1047,7 +1047,7 @@ export class WindowsManager implements IWindowsService {
}
public focusLastActive(cli: ICommandLineArguments): VSCodeWindow {
let lastActive = this.getLastActiveWindow();
const lastActive = this.getLastActiveWindow();
if (lastActive) {
lastActive.focus();
@@ -1063,8 +1063,8 @@ export class WindowsManager implements IWindowsService {
public getLastActiveWindow(): VSCodeWindow {
if (WindowsManager.WINDOWS.length) {
let lastFocussedDate = Math.max.apply(Math, WindowsManager.WINDOWS.map((w) => w.lastFocusTime));
let res = WindowsManager.WINDOWS.filter((w) => w.lastFocusTime === lastFocussedDate);
const lastFocussedDate = Math.max.apply(Math, WindowsManager.WINDOWS.map((w) => w.lastFocusTime));
const res = WindowsManager.WINDOWS.filter((w) => w.lastFocusTime === lastFocussedDate);
if (res && res.length) {
return res[0];
}
@@ -1077,15 +1077,15 @@ export class WindowsManager implements IWindowsService {
if (WindowsManager.WINDOWS.length) {
// Sort the last active window to the front of the array of windows to test
let windowsToTest = WindowsManager.WINDOWS.slice(0);
let lastActiveWindow = this.getLastActiveWindow();
const windowsToTest = WindowsManager.WINDOWS.slice(0);
const lastActiveWindow = this.getLastActiveWindow();
if (lastActiveWindow) {
windowsToTest.splice(windowsToTest.indexOf(lastActiveWindow), 1);
windowsToTest.unshift(lastActiveWindow);
}
// Find it
let res = windowsToTest.filter((w) => {
const res = windowsToTest.filter((w) => {
// match on workspace
if (typeof w.openedWorkspacePath === 'string' && (this.isPathEqual(w.openedWorkspacePath, workspacePath))) {
@@ -1141,7 +1141,7 @@ export class WindowsManager implements IWindowsService {
}
public getFocusedWindow(): VSCodeWindow {
let win = BrowserWindow.getFocusedWindow();
const win = BrowserWindow.getFocusedWindow();
if (win) {
return this.getWindowById(win.id);
}
@@ -1150,7 +1150,7 @@ export class WindowsManager implements IWindowsService {
}
public getWindowById(windowId: number): VSCodeWindow {
let res = WindowsManager.WINDOWS.filter((w) => w.id === windowId);
const res = WindowsManager.WINDOWS.filter((w) => w.id === windowId);
if (res && res.length === 1) {
return res[0];
}
@@ -1214,7 +1214,7 @@ export class WindowsManager implements IWindowsService {
}
// On Window close, update our stored state of this window
let state: IWindowState = { workspacePath: win.openedWorkspacePath, uiState: win.serializeWindowState() };
const state: IWindowState = { workspacePath: win.openedWorkspacePath, uiState: win.serializeWindowState() };
if (win.isPluginDevelopmentHost) {
this.windowsState.lastPluginDevelopmentHostWindow = state;
} else {
@@ -1234,7 +1234,7 @@ export class WindowsManager implements IWindowsService {
win.dispose();
// Remove from our list so that Electron can clean it up
let index = WindowsManager.WINDOWS.indexOf(win);
const index = WindowsManager.WINDOWS.indexOf(win);
WindowsManager.WINDOWS.splice(index, 1);
// Emit