Skip to content

Commit a6f212c

Browse files
committed
Merge branch 'master' into singatureInfo
Conflicts: src/services/services.ts src/services/shims.ts
2 parents 9885e59 + 5fb50d8 commit a6f212c

13 files changed

+395
-334
lines changed

src/compiler/tsc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ module ts {
409409
// Build up the list of examples.
410410
var padding = makePadding(marginLength);
411411
output += getDiagnosticText(Diagnostics.Examples_Colon_0, makePadding(marginLength - examplesLength) + "tsc hello.ts") + sys.newLine;
412-
output += padding + "tsc --out foo.js foo.ts" + sys.newLine;
412+
output += padding + "tsc --out file.js file.ts" + sys.newLine;
413413
output += padding + "tsc @args.txt" + sys.newLine;
414414
output += sys.newLine;
415415

src/harness/fourslash.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1633,7 +1633,7 @@ module FourSlash {
16331633

16341634
public verifyTodoComments(descriptors: string[], spans: TextSpan[]) {
16351635
var actual = this.languageService.getTodoComments(this.activeFile.fileName,
1636-
descriptors.map(d => new ts.TodoCommentDescriptor(d, 0)));
1636+
descriptors.map(d => { return { text: d, priority: 0 }; }));
16371637

16381638
if (actual.length !== spans.length) {
16391639
throw new Error('verifyTodoComments failed - expected total spans to be ' + spans.length + ', but was ' + actual.length);

src/services/breakpoints.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0.
22
// See LICENSE.txt in the project root for complete license information.
33

4-
///<reference path='references.ts' />
5-
64
module TypeScript.Services.Breakpoints {
75
function createBreakpointSpanInfo(parentElement: TypeScript.ISyntaxElement, ...childElements: TypeScript.ISyntaxElement[]): TextSpan {
86
if (!parentElement) {

src/services/formatting/formattingManager.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,11 @@ module TypeScript.Services.Formatting {
112112

113113
//
114114
// TODO: Change the ILanguageService interface to return TextEditInfo (with start, and length) instead of TextEdit (with minChar and limChar)
115-
formattingEdits.forEach((item) => {
116-
var edit = new ts.TextChange(new TextSpan(item.position, item.length), item.replaceWith);
117-
result.push(edit);
115+
formattingEdits.forEach(item => {
116+
result.push({
117+
span: new TextSpan(item.position, item.length),
118+
newText: item.replaceWith
119+
});
118120
});
119121

120122
return result;

src/services/getScriptLexicalStructureWalker.ts

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
///<reference path='references.ts' />
21

32
module TypeScript.Services {
43
export class NavigationBarItemGetter {
@@ -152,69 +151,82 @@ module TypeScript.Services {
152151
}
153152
}
154153

154+
private getNavigationBarItem(text: string, kind: string, kindModifiers: string, spans: TypeScript.TextSpan[], childItems?: ts.NavigationBarItem[], indent: number = 0): ts.NavigationBarItem {
155+
return {
156+
text: text,
157+
kind: kind,
158+
kindModifiers: kindModifiers,
159+
spans: spans,
160+
childItems: childItems,
161+
indent: indent,
162+
bolded: false,
163+
grayed: false
164+
};
165+
}
166+
155167
private createChildItem(node: ISyntaxNode): ts.NavigationBarItem {
156168
switch (node.kind()) {
157169
case SyntaxKind.Parameter:
158170
var parameter = <ParameterSyntax>node;
159171
if (parameter.modifiers.length === 0) {
160172
return null;
161173
}
162-
return new ts.NavigationBarItem(parameter.identifier.text(), ts.ScriptElementKind.memberVariableElement, this.getKindModifiers(parameter.modifiers), [TextSpan.fromBounds(start(node), end(node))]);
174+
return this.getNavigationBarItem(parameter.identifier.text(), ts.ScriptElementKind.memberVariableElement, this.getKindModifiers(parameter.modifiers), [TextSpan.fromBounds(start(node), end(node))]);
163175

164176
case SyntaxKind.MemberFunctionDeclaration:
165177
var memberFunction = <MemberFunctionDeclarationSyntax>node;
166-
return new ts.NavigationBarItem(memberFunction.propertyName.text(), ts.ScriptElementKind.memberFunctionElement, this.getKindModifiers(memberFunction.modifiers), [TextSpan.fromBounds(start(node), end(node))]);
178+
return this.getNavigationBarItem(memberFunction.propertyName.text(), ts.ScriptElementKind.memberFunctionElement, this.getKindModifiers(memberFunction.modifiers), [TextSpan.fromBounds(start(node), end(node))]);
167179

168180
case SyntaxKind.GetAccessor:
169181
var getAccessor = <GetAccessorSyntax>node;
170-
return new ts.NavigationBarItem(getAccessor.propertyName.text(), ts.ScriptElementKind.memberGetAccessorElement, this.getKindModifiers(getAccessor.modifiers), [TextSpan.fromBounds(start(node), end(node))]);
182+
return this.getNavigationBarItem(getAccessor.propertyName.text(), ts.ScriptElementKind.memberGetAccessorElement, this.getKindModifiers(getAccessor.modifiers), [TextSpan.fromBounds(start(node), end(node))]);
171183

172184
case SyntaxKind.SetAccessor:
173185
var setAccessor = <SetAccessorSyntax>node;
174-
return new ts.NavigationBarItem(setAccessor.propertyName.text(), ts.ScriptElementKind.memberSetAccessorElement, this.getKindModifiers(setAccessor.modifiers), [TextSpan.fromBounds(start(node), end(node))]);
186+
return this.getNavigationBarItem(setAccessor.propertyName.text(), ts.ScriptElementKind.memberSetAccessorElement, this.getKindModifiers(setAccessor.modifiers), [TextSpan.fromBounds(start(node), end(node))]);
175187

176188
case SyntaxKind.IndexSignature:
177189
var indexSignature = <IndexSignatureSyntax>node;
178-
return new ts.NavigationBarItem("[]", ts.ScriptElementKind.indexSignatureElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
190+
return this.getNavigationBarItem("[]", ts.ScriptElementKind.indexSignatureElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
179191

180192
case SyntaxKind.EnumElement:
181193
var enumElement = <EnumElementSyntax>node;
182-
return new ts.NavigationBarItem(enumElement.propertyName.text(), ts.ScriptElementKind.memberVariableElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
194+
return this.getNavigationBarItem(enumElement.propertyName.text(), ts.ScriptElementKind.memberVariableElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
183195

184196
case SyntaxKind.CallSignature:
185197
var callSignature = <CallSignatureSyntax>node;
186-
return new ts.NavigationBarItem("()", ts.ScriptElementKind.callSignatureElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
198+
return this.getNavigationBarItem("()", ts.ScriptElementKind.callSignatureElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
187199

188200
case SyntaxKind.ConstructSignature:
189201
var constructSignature = <ConstructSignatureSyntax>node;
190-
return new ts.NavigationBarItem("new()", ts.ScriptElementKind.constructSignatureElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
202+
return this.getNavigationBarItem("new()", ts.ScriptElementKind.constructSignatureElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
191203

192204
case SyntaxKind.MethodSignature:
193205
var methodSignature = <MethodSignatureSyntax>node;
194-
return new ts.NavigationBarItem(methodSignature.propertyName.text(), ts.ScriptElementKind.memberFunctionElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
206+
return this.getNavigationBarItem(methodSignature.propertyName.text(), ts.ScriptElementKind.memberFunctionElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
195207

196208
case SyntaxKind.PropertySignature:
197209
var propertySignature = <PropertySignatureSyntax>node;
198-
return new ts.NavigationBarItem(propertySignature.propertyName.text(), ts.ScriptElementKind.memberVariableElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
210+
return this.getNavigationBarItem(propertySignature.propertyName.text(), ts.ScriptElementKind.memberVariableElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
199211

200212
case SyntaxKind.FunctionDeclaration:
201213
var functionDeclaration = <FunctionDeclarationSyntax>node;
202214
if (!this.isTopLevelFunctionDeclaration(functionDeclaration)) {
203-
return new ts.NavigationBarItem(functionDeclaration.identifier.text(), ts.ScriptElementKind.functionElement, this.getKindModifiers(functionDeclaration.modifiers), [TextSpan.fromBounds(start(node), end(node))]);
215+
return this.getNavigationBarItem(functionDeclaration.identifier.text(), ts.ScriptElementKind.functionElement, this.getKindModifiers(functionDeclaration.modifiers), [TextSpan.fromBounds(start(node), end(node))]);
204216
}
205217
break;
206218

207219
case SyntaxKind.MemberVariableDeclaration:
208220
var memberVariableDeclaration = <MemberVariableDeclarationSyntax>node;
209-
return new ts.NavigationBarItem(memberVariableDeclaration.variableDeclarator.propertyName.text(), ts.ScriptElementKind.memberVariableElement, this.getKindModifiers(memberVariableDeclaration.modifiers), [TextSpan.fromBounds(start(memberVariableDeclaration.variableDeclarator), end(memberVariableDeclaration.variableDeclarator))]);
221+
return this.getNavigationBarItem(memberVariableDeclaration.variableDeclarator.propertyName.text(), ts.ScriptElementKind.memberVariableElement, this.getKindModifiers(memberVariableDeclaration.modifiers), [TextSpan.fromBounds(start(memberVariableDeclaration.variableDeclarator), end(memberVariableDeclaration.variableDeclarator))]);
210222

211223
case SyntaxKind.VariableDeclarator:
212224
var variableDeclarator = <VariableDeclaratorSyntax>node;
213-
return new ts.NavigationBarItem(variableDeclarator.propertyName.text(), ts.ScriptElementKind.variableElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(variableDeclarator), end(variableDeclarator))]);
225+
return this.getNavigationBarItem(variableDeclarator.propertyName.text(), ts.ScriptElementKind.variableElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(variableDeclarator), end(variableDeclarator))]);
214226

215227
case SyntaxKind.ConstructorDeclaration:
216228
var constructorDeclaration = <ConstructorDeclarationSyntax>node;
217-
return new ts.NavigationBarItem("constructor", ts.ScriptElementKind.constructorImplementationElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
229+
return this.getNavigationBarItem("constructor", ts.ScriptElementKind.constructorImplementationElement, ts.ScriptElementKindModifier.none, [TextSpan.fromBounds(start(node), end(node))]);
218230
}
219231

220232
return null;
@@ -273,7 +285,7 @@ module TypeScript.Services {
273285

274286
var childItems = this.getItemsWorker(() => this.getChildNodes(node.moduleElements), n => this.createChildItem(n));
275287

276-
return new ts.NavigationBarItem(moduleNames.join("."),
288+
return this.getNavigationBarItem(moduleNames.join("."),
277289
ts.ScriptElementKind.moduleElement,
278290
this.getKindModifiers(node.modifiers),
279291
[TextSpan.fromBounds(start(node), end(node))],
@@ -284,7 +296,7 @@ module TypeScript.Services {
284296
private createFunctionItem(node: FunctionDeclarationSyntax) {
285297
var childItems = this.getItemsWorker(() => node.block.statements, n => this.createChildItem(n));
286298

287-
return new ts.NavigationBarItem(node.identifier.text(),
299+
return this.getNavigationBarItem(node.identifier.text(),
288300
ts.ScriptElementKind.functionElement,
289301
this.getKindModifiers(node.modifiers),
290302
[TextSpan.fromBounds(start(node), end(node))],
@@ -300,7 +312,7 @@ module TypeScript.Services {
300312
}
301313

302314
this.hasGlobalNode = true;
303-
return new ts.NavigationBarItem("<global>",
315+
return this.getNavigationBarItem("<global>",
304316
ts.ScriptElementKind.moduleElement,
305317
ts.ScriptElementKindModifier.none,
306318
[TextSpan.fromBounds(start(node), end(node))],
@@ -317,7 +329,7 @@ module TypeScript.Services {
317329
: node.classElements;
318330

319331
var childItems = this.getItemsWorker(() => nodes, n => this.createChildItem(n));
320-
return new ts.NavigationBarItem(
332+
return this.getNavigationBarItem(
321333
node.identifier.text(),
322334
ts.ScriptElementKind.classElement,
323335
this.getKindModifiers(node.modifiers),
@@ -328,7 +340,7 @@ module TypeScript.Services {
328340

329341
private createEnumItem(node: TypeScript.EnumDeclarationSyntax): ts.NavigationBarItem {
330342
var childItems = this.getItemsWorker(() => node.enumElements, n => this.createChildItem(n));
331-
return new ts.NavigationBarItem(
343+
return this.getNavigationBarItem(
332344
node.identifier.text(),
333345
ts.ScriptElementKind.enumElement,
334346
this.getKindModifiers(node.modifiers),
@@ -339,7 +351,7 @@ module TypeScript.Services {
339351

340352
private createIterfaceItem(node: TypeScript.InterfaceDeclarationSyntax): ts.NavigationBarItem {
341353
var childItems = this.getItemsWorker(() => node.body.typeMembers, n => this.createChildItem(n));
342-
return new ts.NavigationBarItem(
354+
return this.getNavigationBarItem(
343355
node.identifier.text(),
344356
ts.ScriptElementKind.interfaceElement,
345357
this.getKindModifiers(node.modifiers),

src/services/indentation.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
///<reference path='references.ts' />
21

32
module TypeScript.Indentation {
43
export function columnForEndOfTokenAtPosition(syntaxTree: SyntaxTree, position: number, options: FormattingOptions): number {

src/services/outliningElementsCollector.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
// limitations under the License.
1414
//
1515

16-
///<reference path='references.ts' />
17-
1816
module ts {
1917

2018
export interface OutliningSpan {

src/services/references.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)