Pick up ts 2.1.4 (#18061)

This commit is contained in:
Matt Bierner 2017-01-05 12:30:42 -08:00 committed by GitHub
parent 94f30c3e8b
commit 97ba3fddce
8 changed files with 56 additions and 47 deletions

View file

@ -188,21 +188,21 @@ function format(text) {
}
function getDefaultOptions() {
return {
IndentSize: 4,
TabSize: 4,
NewLineCharacter: '\r\n',
ConvertTabsToSpaces: true,
IndentStyle: ts.IndentStyle.Block,
InsertSpaceAfterCommaDelimiter: true,
InsertSpaceAfterSemicolonInForStatements: true,
InsertSpaceBeforeAndAfterBinaryOperators: true,
InsertSpaceAfterKeywordsInControlFlowStatements: true,
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: true,
PlaceOpenBraceOnNewLineForFunctions: false,
PlaceOpenBraceOnNewLineForControlBlocks: false,
indentSize: 4,
tabSize: 4,
newLineCharacter: '\r\n',
convertTabsToSpaces: true,
indentStyle: ts.IndentStyle.Block,
insertSpaceAfterCommaDelimiter: true,
insertSpaceAfterSemicolonInForStatements: true,
insertSpaceBeforeAndAfterBinaryOperators: true,
insertSpaceAfterKeywordsInControlFlowStatements: true,
insertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: true,
placeOpenBraceOnNewLineForFunctions: false,
placeOpenBraceOnNewLineForControlBlocks: false,
};
}
}

View file

@ -217,22 +217,22 @@ function format(text:string): string {
function getDefaultOptions(): ts.FormatCodeOptions {
return {
IndentSize: 4,
TabSize: 4,
NewLineCharacter: '\r\n',
ConvertTabsToSpaces: true,
IndentStyle: ts.IndentStyle.Block,
indentSize: 4,
tabSize: 4,
newLineCharacter: '\r\n',
convertTabsToSpaces: true,
indentStyle: ts.IndentStyle.Block,
InsertSpaceAfterCommaDelimiter: true,
InsertSpaceAfterSemicolonInForStatements: true,
InsertSpaceBeforeAndAfterBinaryOperators: true,
InsertSpaceAfterKeywordsInControlFlowStatements: true,
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: true,
PlaceOpenBraceOnNewLineForFunctions: false,
PlaceOpenBraceOnNewLineForControlBlocks: false,
insertSpaceAfterCommaDelimiter: true,
insertSpaceAfterSemicolonInForStatements: true,
insertSpaceBeforeAndAfterBinaryOperators: true,
insertSpaceAfterKeywordsInControlFlowStatements: true,
insertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: true,
placeOpenBraceOnNewLineForFunctions: false,
placeOpenBraceOnNewLineForControlBlocks: false,
};
}
}

View file

@ -46,7 +46,7 @@ export default class TypeScriptCodeActionProvider implements CodeActionProvider
public provideCodeActions(document: TextDocument, range: Range, context: CodeActionContext, token: CancellationToken): Thenable<Command[]> {
const file = this.client.asAbsolutePath(document.uri);
if (!file) {
return Promise.resolve(null);
return Promise.resolve<Command[]>([]);
}
const source: Source = {
@ -99,7 +99,7 @@ export default class TypeScriptCodeActionProvider implements CodeActionProvider
private onCodeAction(source: Source, workspaceEdit: WorkspaceEdit) {
workspace.applyEdit(workspaceEdit).then(success => {
if (!success) {
return Promise.reject(null);
return Promise.reject<boolean>(false);
}
// TODO: Workaround for https://github.com/Microsoft/TypeScript/issues/12249
// apply formatting to the source range until TS returns formatted results

View file

@ -119,7 +119,7 @@ export default class TypeScriptCompletionItemProvider implements CompletionItemP
public provideCompletionItems(document: TextDocument, position: Position, token: CancellationToken): Promise<CompletionItem[]> {
if (this.typingsStatus.isAcquiringTypings) {
return Promise.reject({
return Promise.reject<CompletionItem[]>({
label: localize('acquiringTypingsLabel', 'Acquiring typings...'),
detail: localize('acquiringTypingsDetail', 'Acquiring typings definitions for IntelliSense.')
});

View file

@ -48,6 +48,7 @@
"eslint": "^3.4.0",
"event-stream": "^3.1.7",
"express": "^4.13.1",
"flatpak-bundler": "^0.1.1",
"ghooks": "1.0.3",
"glob": "^5.0.13",
"gulp": "^3.8.9",
@ -59,6 +60,7 @@
"gulp-cssnano": "^2.1.0",
"gulp-filter": "^3.0.0",
"gulp-flatmap": "^1.0.0",
"gulp-image-resize": "^0.10.0",
"gulp-json-editor": "^2.2.1",
"gulp-mocha": "^2.1.3",
"gulp-remote-src": "^0.4.0",
@ -71,8 +73,6 @@
"gulp-uglify": "^2.0.0",
"gulp-util": "^3.0.6",
"gulp-vinyl-zip": "^1.2.2",
"gulp-image-resize": "^0.10.0",
"flatpak-bundler": "^0.1.1",
"innosetup-compiler": "^5.5.60",
"is": "^3.1.0",
"istanbul": "^0.3.17",
@ -91,8 +91,8 @@
"sinon": "^1.17.2",
"source-map": "^0.4.4",
"tslint": "^3.3.0",
"typescript": "2.0.3",
"typescript-formatter": "3.1.0",
"typescript": "^2.1.4",
"typescript-formatter": "4.0.1",
"uglify-js": "2.4.8",
"underscore": "^1.8.2",
"vinyl": "^0.4.5",

View file

@ -13,18 +13,21 @@ import URI from 'vs/base/common/uri';
export class DeferredTPromise<T> extends TPromise<T> {
public canceled = false;
public canceled: boolean;
private completeCallback: TValueCallback<T>;
private errorCallback: (err: any) => void;
private progressCallback: ProgressCallback;
constructor() {
let captured: any;
super((c, e, p) => {
this.completeCallback = c;
this.errorCallback = e;
this.progressCallback = p;
captured = { c, e, p };
}, () => this.oncancel());
this.canceled = false;
this.completeCallback = captured.c;
this.errorCallback = captured.e;
this.progressCallback = captured.p;
}
public complete(value: T) {
@ -51,7 +54,13 @@ export class DeferredPPromise<C, P> extends PPromise<C, P> {
private progressCallback: TProgressCallback<P>;
constructor(init: (complete: TValueCallback<C>, error: (err: any) => void, progress: TProgressCallback<P>) => void = (c, e, p) => { }, oncancel?: any) {
super((c, e, p) => { this.completeCallback = c; this.errorCallback = e; this.progressCallback = p; }, oncancel ? oncancel : () => this.oncancel);
let captured: any;
super((c, e, p) => {
captured = { c, e, p };
}, oncancel ? oncancel : () => this.oncancel);
this.completeCallback = captured.c;
this.errorCallback = captured.e;
this.progressCallback = captured.p;
}
private oncancel(): void {

View file

@ -125,7 +125,7 @@ const enum CharacterClass {
}
const classifier = (function () {
let result = new CharacterClassifier(CharacterClass.None);
let result = new CharacterClassifier<CharacterClass>(CharacterClass.None);
const FORCE_TERMINATION_CHARACTERS = ' \t<>\'\"、。。、,.:;?!@#$%&*‘“〈《「『【〔([{「」}])〕】』」》〉”’`~…';
for (let i = 0; i < FORCE_TERMINATION_CHARACTERS.length; i++) {

View file

@ -26,8 +26,8 @@ export class Resource {
private _path: string = null;
constructor(public uri: URI, public markers: Marker[],
public statistics: MarkerStatistics,
public matches: IMatch[] = []) {
public statistics: MarkerStatistics,
public matches: IMatch[] = []) {
}
public get path(): string {
@ -47,8 +47,8 @@ export class Resource {
export class Marker {
constructor(public id: string, public marker: IMarker,
public labelMatches: IMatch[] = [],
public sourceMatches: IMatch[] = []) { }
public labelMatches: IMatch[] = [],
public sourceMatches: IMatch[] = []) { }
public get resource(): URI {
return this.marker.resource;