Merge VS Code 1.23.1 (#1520)

This commit is contained in:
Matt Irvine
2018-06-05 11:24:51 -07:00
committed by GitHub
parent e3baf5c443
commit 0c58f09e59
3651 changed files with 74249 additions and 48599 deletions

View File

@@ -36,8 +36,8 @@ import { StateService } from 'vs/platform/state/node/stateService';
import { createSpdLogService } from 'vs/platform/log/node/spdlogService';
import { ILogService, getLogLevel } from 'vs/platform/log/common/log';
import { isPromiseCanceledError } from 'vs/base/common/errors';
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
import { ChoiceCliService } from 'vs/platform/dialogs/node/choiceCli';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { CommandLineDialogService } from 'vs/platform/dialogs/node/dialogService';
const notFound = (id: string) => localize('notFound', "Extension '{0}' not found.", id);
const notInstalled = (id: string) => localize('notInstalled', "Extension '{0}' is not installed.", id);
@@ -144,15 +144,15 @@ class Main {
return this.extensionManagementService.installFromGallery(extension)
.then(
() => console.log(localize('successInstall', "Extension '{0}' v{1} was successfully installed!", id, extension.version)),
error => {
if (isPromiseCanceledError(error)) {
console.log(localize('cancelVsixInstall', "Cancelled installing Extension '{0}'.", id));
return null;
} else {
return TPromise.wrapError(error);
}
});
() => console.log(localize('successInstall', "Extension '{0}' v{1} was successfully installed!", id, extension.version)),
error => {
if (isPromiseCanceledError(error)) {
console.log(localize('cancelVsixInstall', "Cancelled installing Extension '{0}'.", id));
return null;
} else {
return TPromise.wrapError(error);
}
});
});
});
});
@@ -219,7 +219,7 @@ export function main(argv: ParsedArgs): TPromise<void> {
services.set(IRequestService, new SyncDescriptor(RequestService));
services.set(IExtensionManagementService, new SyncDescriptor(ExtensionManagementService));
services.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryService));
services.set(IChoiceService, new SyncDescriptor(ChoiceCliService));
services.set(IDialogService, new SyncDescriptor(CommandLineDialogService));
if (isBuilt && !extensionDevelopmentPath && !envService.args['disable-telemetry'] && product.enableTelemetry) {
const appenders: AppInsightsAppender[] = [];

View File

@@ -5,8 +5,6 @@
'use strict';
import * as path from 'path';
import * as fs from 'fs';
import * as platform from 'vs/base/common/platform';
import * as paths from 'vs/base/common/paths';
import { OpenContext } from 'vs/platform/windows/common/windows';
@@ -35,22 +33,9 @@ export interface IBestWindowOrFolderOptions<W extends ISimpleWindow> {
export function findBestWindowOrFolderForFile<W extends ISimpleWindow>({ windows, newWindow, reuseWindow, context, filePath, userHome, codeSettingsFolder, workspaceResolver }: IBestWindowOrFolderOptions<W>): W | string {
if (!newWindow && filePath && (context === OpenContext.DESKTOP || context === OpenContext.CLI || context === OpenContext.DOCK)) {
const windowOnFilePath = findWindowOnFilePath(windows, filePath, workspaceResolver);
// 1) window wins if it has a workspace opened
if (windowOnFilePath && !!windowOnFilePath.openedWorkspace) {
if (windowOnFilePath) {
return windowOnFilePath;
}
// 2) window wins if it has a folder opened that is more specific than settings folder
const folderWithCodeSettings = !reuseWindow && findFolderWithCodeSettings(filePath, userHome, codeSettingsFolder);
if (windowOnFilePath && !(folderWithCodeSettings && folderWithCodeSettings.length > windowOnFilePath.openedFolderPath.length)) {
return windowOnFilePath;
}
// 3) finally return path to folder with settings
if (folderWithCodeSettings) {
return folderWithCodeSettings;
}
}
return !newWindow ? getLastActiveWindow(windows) : null;
@@ -77,41 +62,6 @@ function findWindowOnFilePath<W extends ISimpleWindow>(windows: W[], filePath: s
return null;
}
function findFolderWithCodeSettings(filePath: string, userHome?: string, codeSettingsFolder?: string): string {
let folder = path.dirname(paths.normalize(filePath, true));
let homeFolder = userHome && paths.normalize(userHome, true);
if (!platform.isLinux) {
homeFolder = homeFolder && homeFolder.toLowerCase();
}
let previous = null;
while (folder !== previous) {
if (hasCodeSettings(folder, homeFolder, codeSettingsFolder)) {
return folder;
}
previous = folder;
folder = path.dirname(folder);
}
return null;
}
// {{SQL CARBON EDIT}}
function hasCodeSettings(folder: string, normalizedUserHome?: string, codeSettingsFolder = '.sqlops') {
try {
if ((platform.isLinux ? folder : folder.toLowerCase()) === normalizedUserHome) {
return fs.statSync(path.join(folder, codeSettingsFolder, 'settings.json')).isFile(); // ~/.vscode/extensions is used for extensions
}
return fs.statSync(path.join(folder, codeSettingsFolder)).isDirectory();
} catch (err) {
// assume impossible to access
}
return false;
}
export function getLastActiveWindow<W extends ISimpleWindow>(windows: W[]): W {
const lastFocusedDate = Math.max.apply(Math, windows.map(window => window.lastFocusTime));