Merge VS Code 1.21 source code (#1067)

* Initial VS Code 1.21 file copy with patches

* A few more merges

* Post npm install

* Fix batch of build breaks

* Fix more build breaks

* Fix more build errors

* Fix more build breaks

* Runtime fixes 1

* Get connection dialog working with some todos

* Fix a few packaging issues

* Copy several node_modules to package build to fix loader issues

* Fix breaks from master

* A few more fixes

* Make tests pass

* First pass of license header updates

* Second pass of license header updates

* Fix restore dialog issues

* Remove add additional themes menu items

* fix select box issues where the list doesn't show up

* formatting

* Fix editor dispose issue

* Copy over node modules to correct location on all platforms
This commit is contained in:
Karl Burtram
2018-04-04 15:27:51 -07:00
committed by GitHub
parent 5fba3e31b4
commit dafb780987
9412 changed files with 141255 additions and 98813 deletions

View File

@@ -0,0 +1,40 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { TPromise } from 'vs/base/common/winjs.base';
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
import Severity from 'vs/base/common/severity';
export interface IChoiceChannel extends IChannel {
call(command: 'choose'): TPromise<number>;
call(command: string, arg?: any): TPromise<any>;
}
export class ChoiceChannel implements IChoiceChannel {
constructor( @IChoiceService private choiceService: IChoiceService) {
}
call(command: string, args?: [Severity, string, string[], number, boolean]): TPromise<any> {
switch (command) {
case 'choose': return this.choiceService.choose(args[0], args[1], args[2], args[3], args[4]);
}
return TPromise.wrapError(new Error('invalid command'));
}
}
export class ChoiceChannelClient implements IChoiceService {
_serviceBrand: any;
constructor(private channel: IChoiceChannel) { }
choose(severity: Severity, message: string, options: string[], cancelId?: number, modal?: boolean): TPromise<number> {
return this.channel.call('choose', [severity, message, options, cancelId, modal]);
}
}

View File

@@ -0,0 +1,84 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { TPromise } from 'vs/base/common/winjs.base';
import Severity from 'vs/base/common/severity';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
export interface IConfirmation {
title?: string;
type?: 'none' | 'info' | 'error' | 'question' | 'warning';
message: string;
detail?: string;
primaryButton?: string;
secondaryButton?: string;
checkbox?: {
label: string;
checked?: boolean;
};
}
export interface IConfirmationResult {
confirmed: boolean;
checkboxChecked?: boolean;
}
export const IConfirmationService = createDecorator<IConfirmationService>('confirmationService');
export interface IConfirmationService {
_serviceBrand: any;
/**
* Ask the user for confirmation with a modal dialog.
*/
confirm(confirmation: IConfirmation): TPromise<boolean>;
/**
* Ask the user for confirmation with a checkbox in a modal dialog.
*/
confirmWithCheckbox(confirmation: IConfirmation): TPromise<IConfirmationResult>;
}
export const IChoiceService = createDecorator<IChoiceService>('choiceService');
/**
* The choices to present to the user. The `ISecondaryChoice` hint allows to control where
* choices appear when the `modal` option is set to `false`. In that case, the choices
* are presented as part of a notification and secondary choices will appear less
* prominent.
*/
export interface SecondaryChoice {
label: string;
keepOpen?: boolean;
}
export type PrimaryChoice = string;
export type Choice = PrimaryChoice | SecondaryChoice;
export interface IChoiceService {
_serviceBrand: any;
/**
* Prompt the user for a choice between multiple choices.
*
* @param choices the choices to present to the user. The `isSecondary` hint allows
* to control where are presented as part of a notification and secondary choices will
* appear less choices appear when the `modal` option is set to `false`. In that case,
* the choices prominent.
*
* @param when `modal` is true, this will block the user until chooses.
*
* @returns A promise with the selected choice index. The promise is cancellable
* which hides the message. The promise can return an error, meaning that
* the user refused to choose.
*
* When `modal` is true and user refused to choose, then promise with index of
* `Cancel` option is returned. If there is no such option then promise with
* `0` index is returned.
*/
choose(severity: Severity, message: string, choices: Choice[], cancelId?: number, modal?: boolean): TPromise<number>;
}

View File

@@ -0,0 +1,58 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as readline from 'readline';
import { TPromise } from 'vs/base/common/winjs.base';
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
import Severity from 'vs/base/common/severity';
export class ChoiceCliService implements IChoiceService {
_serviceBrand: any;
choose(severity: Severity, message: string, options: string[]): TPromise<number> {
const promise = new TPromise<number>((c, e) => {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: true
});
rl.prompt();
rl.write(this.toQuestion(message, options));
rl.prompt();
rl.once('line', (answer) => {
rl.close();
c(this.toOption(answer, options));
});
rl.once('SIGINT', () => {
rl.close();
promise.cancel();
});
});
return promise;
}
private toQuestion(message: string, options: string[]): string {
return options.reduce((previousValue: string, currentValue: string, currentIndex: number) => {
return previousValue + currentValue + '(' + currentIndex + ')' + (currentIndex < options.length - 1 ? ' | ' : '\n');
}, message + ' ');
}
private toOption(answer: string, options: string[]): number {
const value = parseInt(answer);
if (!isNaN(value)) {
return value;
}
answer = answer.toLocaleLowerCase();
for (let i = 0; i < options.length; i++) {
if (options[i].toLocaleLowerCase() === answer) {
return i;
}
}
return -1;
}
}