Rename variables to be consistent.

This commit is contained in:
Cyrus Najmabadi 2015-04-03 16:55:54 -07:00
parent 1178e84a68
commit 766d34d0dc
2 changed files with 74 additions and 74 deletions

View file

@ -2722,7 +2722,7 @@ module ts {
}
function getCompletionData(fileName: string, position: number) {
let typeInfoResolver = program.getTypeChecker();
let typeChecker = program.getTypeChecker();
let syntacticStart = new Date().getTime();
let sourceFile = getValidSourceFile(fileName);
@ -2806,29 +2806,29 @@ module ts {
isNewIdentifierLocation = false;
if (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName || node.kind === SyntaxKind.PropertyAccessExpression) {
let symbol = typeInfoResolver.getSymbolAtLocation(node);
let symbol = typeChecker.getSymbolAtLocation(node);
// This is an alias, follow what it aliases
if (symbol && symbol.flags & SymbolFlags.Alias) {
symbol = typeInfoResolver.getAliasedSymbol(symbol);
symbol = typeChecker.getAliasedSymbol(symbol);
}
if (symbol && symbol.flags & SymbolFlags.HasExports) {
// Extract module or enum members
let exportedSymbols = typeInfoResolver.getExportsOfModule(symbol);
let exportedSymbols = typeChecker.getExportsOfModule(symbol);
forEach(exportedSymbols, symbol => {
if (typeInfoResolver.isValidPropertyAccess(<PropertyAccessExpression>(node.parent), symbol.name)) {
if (typeChecker.isValidPropertyAccess(<PropertyAccessExpression>(node.parent), symbol.name)) {
symbols.push(symbol);
}
});
}
}
let type = typeInfoResolver.getTypeAtLocation(node);
let type = typeChecker.getTypeAtLocation(node);
if (type) {
// Filter private properties
forEach(type.getApparentProperties(), symbol => {
if (typeInfoResolver.isValidPropertyAccess(<PropertyAccessExpression>(node.parent), symbol.name)) {
if (typeChecker.isValidPropertyAccess(<PropertyAccessExpression>(node.parent), symbol.name)) {
symbols.push(symbol);
}
});
@ -2842,12 +2842,12 @@ module ts {
isMemberCompletion = true;
isNewIdentifierLocation = true;
let contextualType = typeInfoResolver.getContextualType(containingObjectLiteral);
let contextualType = typeChecker.getContextualType(containingObjectLiteral);
if (!contextualType) {
return false;
}
let contextualTypeMembers = typeInfoResolver.getPropertiesOfType(contextualType);
let contextualTypeMembers = typeChecker.getPropertiesOfType(contextualType);
if (contextualTypeMembers && contextualTypeMembers.length > 0) {
// Add filtered items to the completion list
symbols = filterContextualMembersList(contextualTypeMembers, containingObjectLiteral.properties);
@ -2864,9 +2864,9 @@ module ts {
let exports: Symbol[];
if (importDeclaration.moduleSpecifier) {
let moduleSpecifierSymbol = typeInfoResolver.getSymbolAtLocation(importDeclaration.moduleSpecifier);
let moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importDeclaration.moduleSpecifier);
if (moduleSpecifierSymbol) {
exports = typeInfoResolver.getExportsOfModule(moduleSpecifierSymbol);
exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol);
}
}
@ -2915,7 +2915,7 @@ module ts {
/// TODO filter meaning based on the current context
let symbolMeanings = SymbolFlags.Type | SymbolFlags.Value | SymbolFlags.Namespace | SymbolFlags.Alias;
symbols = typeInfoResolver.getSymbolsInScope(scopeNode, symbolMeanings);
symbols = typeChecker.getSymbolsInScope(scopeNode, symbolMeanings);
}
return true;
@ -3388,12 +3388,12 @@ module ts {
}
function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol: Symbol, flags: SymbolFlags, location: Node) {
let typeResolver = program.getTypeChecker();
let typeChecker = program.getTypeChecker();
if (typeResolver.isUndefinedSymbol(symbol)) {
if (typeChecker.isUndefinedSymbol(symbol)) {
return ScriptElementKind.variableElement;
}
if (typeResolver.isArgumentsSymbol(symbol)) {
if (typeChecker.isArgumentsSymbol(symbol)) {
return ScriptElementKind.localVariableElement;
}
if (flags & SymbolFlags.Variable) {
@ -3417,7 +3417,7 @@ module ts {
if (flags & SymbolFlags.Property) {
if (flags & SymbolFlags.UnionProperty) {
// If union property is result of union of non method (property/accessors/variables), it is labeled as property
let unionPropertyKind = forEach(typeResolver.getRootSymbols(symbol), rootSymbol => {
let unionPropertyKind = forEach(typeChecker.getRootSymbols(symbol), rootSymbol => {
let rootSymbolFlags = rootSymbol.getFlags();
if (rootSymbolFlags & (SymbolFlags.PropertyOrAccessor | SymbolFlags.Variable)) {
return ScriptElementKind.memberVariableElement;
@ -3427,7 +3427,7 @@ module ts {
if (!unionPropertyKind) {
// If this was union of all methods,
//make sure it has call signatures before we can label it as method
let typeOfUnionProperty = typeResolver.getTypeOfSymbolAtLocation(symbol, location);
let typeOfUnionProperty = typeChecker.getTypeOfSymbolAtLocation(symbol, location);
if (typeOfUnionProperty.getCallSignatures().length) {
return ScriptElementKind.memberFunctionElement;
}
@ -3464,7 +3464,7 @@ module ts {
function getSymbolDisplayPartsDocumentationAndSymbolKind(symbol: Symbol, sourceFile: SourceFile, enclosingDeclaration: Node,
location: Node, semanticMeaning = getMeaningFromLocation(location)) {
let typeResolver = program.getTypeChecker();
let typeChecker = program.getTypeChecker();
let displayParts: SymbolDisplayPart[] = [];
let documentation: SymbolDisplayPart[];
@ -3481,7 +3481,7 @@ module ts {
}
let signature: Signature;
type = typeResolver.getTypeOfSymbolAtLocation(symbol, location);
type = typeChecker.getTypeOfSymbolAtLocation(symbol, location);
if (type) {
if (location.parent && location.parent.kind === SyntaxKind.PropertyAccessExpression) {
let right = (<PropertyAccessExpression>location.parent).name;
@ -3502,7 +3502,7 @@ module ts {
if (callExpression) {
let candidateSignatures: Signature[] = [];
signature = typeResolver.getResolvedSignature(callExpression, candidateSignatures);
signature = typeChecker.getResolvedSignature(callExpression, candidateSignatures);
if (!signature && candidateSignatures.length) {
// Use the first candidate:
signature = candidateSignatures[0];
@ -3551,7 +3551,7 @@ module ts {
displayParts.push(spacePart());
}
if (!(type.flags & TypeFlags.Anonymous)) {
displayParts.push.apply(displayParts, symbolToDisplayParts(typeResolver, type.symbol, enclosingDeclaration, /*meaning*/ undefined, SymbolFormatFlags.WriteTypeParametersOrArguments));
displayParts.push.apply(displayParts, symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, SymbolFormatFlags.WriteTypeParametersOrArguments));
}
addSignatureDisplayParts(signature, allSignatures, TypeFormatFlags.WriteArrowStyleSignature);
break;
@ -3568,8 +3568,8 @@ module ts {
// get the signature from the declaration and write it
let functionDeclaration = <FunctionLikeDeclaration>location.parent;
let allSignatures = functionDeclaration.kind === SyntaxKind.Constructor ? type.getConstructSignatures() : type.getCallSignatures();
if (!typeResolver.isImplementationOfOverload(functionDeclaration)) {
signature = typeResolver.getSignatureFromDeclaration(functionDeclaration);
if (!typeChecker.isImplementationOfOverload(functionDeclaration)) {
signature = typeChecker.getSignatureFromDeclaration(functionDeclaration);
}
else {
signature = allSignatures[0];
@ -3612,7 +3612,7 @@ module ts {
displayParts.push(spacePart());
displayParts.push(operatorPart(SyntaxKind.EqualsToken));
displayParts.push(spacePart());
displayParts.push.apply(displayParts, typeToDisplayParts(typeResolver, typeResolver.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration));
displayParts.push.apply(displayParts, typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration));
}
if (symbolFlags & SymbolFlags.Enum) {
addNewLineIfDisplayPartsExist();
@ -3648,7 +3648,7 @@ module ts {
else {
// Method/function type parameter
let signatureDeclaration = <SignatureDeclaration>getDeclarationOfKind(symbol, SyntaxKind.TypeParameter).parent;
let signature = typeResolver.getSignatureFromDeclaration(signatureDeclaration);
let signature = typeChecker.getSignatureFromDeclaration(signatureDeclaration);
if (signatureDeclaration.kind === SyntaxKind.ConstructSignature) {
displayParts.push(keywordPart(SyntaxKind.NewKeyword));
displayParts.push(spacePart());
@ -3656,14 +3656,14 @@ module ts {
else if (signatureDeclaration.kind !== SyntaxKind.CallSignature && signatureDeclaration.name) {
addFullSymbolName(signatureDeclaration.symbol);
}
displayParts.push.apply(displayParts, signatureToDisplayParts(typeResolver, signature, sourceFile, TypeFormatFlags.WriteTypeArgumentsOfSignature));
displayParts.push.apply(displayParts, signatureToDisplayParts(typeChecker, signature, sourceFile, TypeFormatFlags.WriteTypeArgumentsOfSignature));
}
}
if (symbolFlags & SymbolFlags.EnumMember) {
addPrefixForAnyFunctionOrVar(symbol, "enum member");
let declaration = symbol.declarations[0];
if (declaration.kind === SyntaxKind.EnumMember) {
let constantValue = typeResolver.getConstantValue(<EnumMember>declaration);
let constantValue = typeChecker.getConstantValue(<EnumMember>declaration);
if (constantValue !== undefined) {
displayParts.push(spacePart());
displayParts.push(operatorPart(SyntaxKind.EqualsToken));
@ -3690,7 +3690,7 @@ module ts {
displayParts.push(punctuationPart(SyntaxKind.CloseParenToken));
}
else {
let internalAliasSymbol = typeResolver.getSymbolAtLocation(importEqualsDeclaration.moduleReference);
let internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference);
if (internalAliasSymbol) {
displayParts.push(spacePart());
displayParts.push(operatorPart(SyntaxKind.EqualsToken));
@ -3715,12 +3715,12 @@ module ts {
// If the type is type parameter, format it specially
if (type.symbol && type.symbol.flags & SymbolFlags.TypeParameter) {
let typeParameterParts = mapToDisplayParts(writer => {
typeResolver.getSymbolDisplayBuilder().buildTypeParameterDisplay(<TypeParameter>type, writer, enclosingDeclaration);
typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplay(<TypeParameter>type, writer, enclosingDeclaration);
});
displayParts.push.apply(displayParts, typeParameterParts);
}
else {
displayParts.push.apply(displayParts, typeToDisplayParts(typeResolver, type, enclosingDeclaration));
displayParts.push.apply(displayParts, typeToDisplayParts(typeChecker, type, enclosingDeclaration));
}
}
else if (symbolFlags & SymbolFlags.Function ||
@ -3752,7 +3752,7 @@ module ts {
}
function addFullSymbolName(symbol: Symbol, enclosingDeclaration?: Node) {
let fullSymbolDisplayParts = symbolToDisplayParts(typeResolver, symbol, enclosingDeclaration || sourceFile, /*meaning*/ undefined,
let fullSymbolDisplayParts = symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration || sourceFile, /*meaning*/ undefined,
SymbolFormatFlags.WriteTypeParametersOrArguments | SymbolFormatFlags.UseOnlyExternalAliasing);
displayParts.push.apply(displayParts, fullSymbolDisplayParts);
}
@ -3784,7 +3784,7 @@ module ts {
}
function addSignatureDisplayParts(signature: Signature, allSignatures: Signature[], flags?: TypeFormatFlags) {
displayParts.push.apply(displayParts, signatureToDisplayParts(typeResolver, signature, enclosingDeclaration, flags | TypeFormatFlags.WriteTypeArgumentsOfSignature));
displayParts.push.apply(displayParts, signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, flags | TypeFormatFlags.WriteTypeArgumentsOfSignature));
if (allSignatures.length > 1) {
displayParts.push(spacePart());
displayParts.push(punctuationPart(SyntaxKind.OpenParenToken));
@ -3799,7 +3799,7 @@ module ts {
function writeTypeParametersOfSymbol(symbol: Symbol, enclosingDeclaration: Node) {
let typeParameterParts = mapToDisplayParts(writer => {
typeResolver.getSymbolDisplayBuilder().buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration);
typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration);
});
displayParts.push.apply(displayParts, typeParameterParts);
}
@ -3814,8 +3814,8 @@ module ts {
return undefined;
}
let typeInfoResolver = program.getTypeChecker();
let symbol = typeInfoResolver.getSymbolAtLocation(node);
let typeChecker = program.getTypeChecker();
let symbol = typeChecker.getSymbolAtLocation(node);
if (!symbol) {
// Try getting just type at this position and show
switch (node.kind) {
@ -3825,13 +3825,13 @@ module ts {
case SyntaxKind.ThisKeyword:
case SyntaxKind.SuperKeyword:
// For the identifiers/this/super etc get the type at position
let type = typeInfoResolver.getTypeAtLocation(node);
let type = typeChecker.getTypeAtLocation(node);
if (type) {
return {
kind: ScriptElementKind.unknown,
kindModifiers: ScriptElementKindModifier.none,
textSpan: createTextSpan(node.getStart(), node.getWidth()),
displayParts: typeToDisplayParts(typeInfoResolver, type, getContainerNode(node)),
displayParts: typeToDisplayParts(typeChecker, type, getContainerNode(node)),
documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined
};
}
@ -3896,8 +3896,8 @@ module ts {
return undefined;
}
let typeInfoResolver = program.getTypeChecker();
let symbol = typeInfoResolver.getSymbolAtLocation(node);
let typeChecker = program.getTypeChecker();
let symbol = typeChecker.getSymbolAtLocation(node);
// Could not find a symbol e.g. node is string or number keyword,
// or the symbol was an internal symbol and does not have a declaration e.g. undefined symbol
@ -3912,7 +3912,7 @@ module ts {
if (symbol.flags & SymbolFlags.Alias) {
let declaration = symbol.declarations[0];
if (node.kind === SyntaxKind.Identifier && node.parent === declaration) {
symbol = typeInfoResolver.getAliasedSymbol(symbol);
symbol = typeChecker.getAliasedSymbol(symbol);
}
}
@ -3922,25 +3922,25 @@ module ts {
// is performed at the location of property access, we would like to go to definition of the property in the short-hand
// assignment. This case and others are handled by the following code.
if (node.parent.kind === SyntaxKind.ShorthandPropertyAssignment) {
let shorthandSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
let shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
if (!shorthandSymbol) {
return [];
}
let shorthandDeclarations = shorthandSymbol.getDeclarations();
let shorthandSymbolKind = getSymbolKind(shorthandSymbol, node);
let shorthandSymbolName = typeInfoResolver.symbolToString(shorthandSymbol);
let shorthandContainerName = typeInfoResolver.symbolToString(symbol.parent, node);
let shorthandSymbolName = typeChecker.symbolToString(shorthandSymbol);
let shorthandContainerName = typeChecker.symbolToString(symbol.parent, node);
return map(shorthandDeclarations,
declaration => createDefinitionInfo(declaration, shorthandSymbolKind, shorthandSymbolName, shorthandContainerName));
}
let result: DefinitionInfo[] = [];
let declarations = symbol.getDeclarations();
let symbolName = typeInfoResolver.symbolToString(symbol); // Do not get scoped name, just the name of the symbol
let symbolName = typeChecker.symbolToString(symbol); // Do not get scoped name, just the name of the symbol
let symbolKind = getSymbolKind(symbol, node);
let containerSymbol = symbol.parent;
let containerName = containerSymbol ? typeInfoResolver.symbolToString(containerSymbol, node) : "";
let containerName = containerSymbol ? typeChecker.symbolToString(containerSymbol, node) : "";
if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) &&
!tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) {
@ -4608,7 +4608,7 @@ module ts {
}
function getReferencesForNode(node: Node, sourceFiles: SourceFile[], searchOnlyInCurrentFile: boolean, findInStrings: boolean, findInComments: boolean): ReferencedSymbol[]{
let typeInfoResolver = program.getTypeChecker();
let typeChecker = program.getTypeChecker();
// Labels
if (isLabelName(node)) {
@ -4632,7 +4632,7 @@ module ts {
return getReferencesForSuperKeyword(node);
}
let symbol = typeInfoResolver.getSymbolAtLocation(node);
let symbol = typeChecker.getSymbolAtLocation(node);
// Could not find a symbol e.g. unknown identifier
if (!symbol) {
@ -4740,7 +4740,7 @@ module ts {
return location.getText();
}
name = typeInfoResolver.symbolToString(symbol);
name = typeChecker.symbolToString(symbol);
return stripQuotes(name);
}
@ -4976,10 +4976,10 @@ module ts {
return;
}
let referenceSymbol = typeInfoResolver.getSymbolAtLocation(referenceLocation);
let referenceSymbol = typeChecker.getSymbolAtLocation(referenceLocation);
if (referenceSymbol) {
let referenceSymbolDeclaration = referenceSymbol.valueDeclaration;
let shorthandValueSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration);
let shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration);
var relatedSymbol = getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation);
if (relatedSymbol) {
@ -5204,7 +5204,7 @@ module ts {
// If the symbol is an alias, add what it alaises to the list
if (isImportOrExportSpecifierImportSymbol(symbol)) {
result.push(typeInfoResolver.getAliasedSymbol(symbol));
result.push(typeChecker.getAliasedSymbol(symbol));
}
// If the location is in a context sensitive location (i.e. in an object literal) try
@ -5212,7 +5212,7 @@ module ts {
// type to the search set
if (isNameOfPropertyAssignment(location)) {
forEach(getPropertySymbolsFromContextualType(location), contextualSymbol => {
result.push.apply(result, typeInfoResolver.getRootSymbols(contextualSymbol));
result.push.apply(result, typeChecker.getRootSymbols(contextualSymbol));
});
/* Because in short-hand property assignment, location has two meaning : property name and as value of the property
@ -5226,7 +5226,7 @@ module ts {
* so that when matching with potential reference symbol, both symbols from property declaration and variable declaration
* will be included correctly.
*/
let shorthandValueSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(location.parent);
let shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent);
if (shorthandValueSymbol) {
result.push(shorthandValueSymbol);
}
@ -5234,7 +5234,7 @@ module ts {
// If this is a union property, add all the symbols from all its source symbols in all unioned types.
// If the symbol is an instantiation from a another symbol (e.g. widened symbol) , add the root the list
forEach(typeInfoResolver.getRootSymbols(symbol), rootSymbol => {
forEach(typeChecker.getRootSymbols(symbol), rootSymbol => {
if (rootSymbol !== symbol) {
result.push(rootSymbol);
}
@ -5264,9 +5264,9 @@ module ts {
function getPropertySymbolFromTypeReference(typeReference: HeritageClauseElement) {
if (typeReference) {
let type = typeInfoResolver.getTypeAtLocation(typeReference);
let type = typeChecker.getTypeAtLocation(typeReference);
if (type) {
let propertySymbol = typeInfoResolver.getPropertyOfType(type, propertyName);
let propertySymbol = typeChecker.getPropertyOfType(type, propertyName);
if (propertySymbol) {
result.push(propertySymbol);
}
@ -5286,7 +5286,7 @@ module ts {
// If the reference symbol is an alias, check if what it is aliasing is one of the search
// symbols.
if (isImportOrExportSpecifierImportSymbol(referenceSymbol)) {
var aliasedSymbol = typeInfoResolver.getAliasedSymbol(referenceSymbol);
var aliasedSymbol = typeChecker.getAliasedSymbol(referenceSymbol);
if (searchSymbols.indexOf(aliasedSymbol) >= 0) {
return aliasedSymbol;
}
@ -5297,13 +5297,13 @@ module ts {
// compare to our searchSymbol
if (isNameOfPropertyAssignment(referenceLocation)) {
return forEach(getPropertySymbolsFromContextualType(referenceLocation), contextualSymbol => {
return forEach(typeInfoResolver.getRootSymbols(contextualSymbol), s => searchSymbols.indexOf(s) >= 0 ? s : undefined);
return forEach(typeChecker.getRootSymbols(contextualSymbol), s => searchSymbols.indexOf(s) >= 0 ? s : undefined);
});
}
// Unwrap symbols to get to the root (e.g. transient symbols as a result of widening)
// Or a union property, use its underlying unioned symbols
return forEach(typeInfoResolver.getRootSymbols(referenceSymbol), rootSymbol => {
return forEach(typeChecker.getRootSymbols(referenceSymbol), rootSymbol => {
// if it is in the list, then we are done
if (searchSymbols.indexOf(rootSymbol) >= 0) {
return rootSymbol;
@ -5324,7 +5324,7 @@ module ts {
function getPropertySymbolsFromContextualType(node: Node): Symbol[] {
if (isNameOfPropertyAssignment(node)) {
let objectLiteral = <ObjectLiteralExpression>node.parent.parent;
let contextualType = typeInfoResolver.getContextualType(objectLiteral);
let contextualType = typeChecker.getContextualType(objectLiteral);
let name = (<Identifier>node).text;
if (contextualType) {
if (contextualType.flags & TypeFlags.Union) {
@ -5697,7 +5697,7 @@ module ts {
synchronizeHostData();
let sourceFile = getValidSourceFile(fileName);
let typeInfoResolver = program.getTypeChecker();
let typeChecker = program.getTypeChecker();
let result: ClassifiedSpan[] = [];
processNode(sourceFile);
@ -5750,7 +5750,7 @@ module ts {
// Only walk into nodes that intersect the requested span.
if (node && textSpanIntersectsWith(span, node.getStart(), node.getWidth())) {
if (node.kind === SyntaxKind.Identifier && node.getWidth() > 0) {
let symbol = typeInfoResolver.getSymbolAtLocation(node);
let symbol = typeChecker.getSymbolAtLocation(node);
if (symbol) {
let type = classifySymbol(symbol, getMeaningFromLocation(node));
if (type) {
@ -6232,13 +6232,13 @@ module ts {
synchronizeHostData();
let sourceFile = getValidSourceFile(fileName);
let typeInfoResolver = program.getTypeChecker();
let typeChecker = program.getTypeChecker();
let node = getTouchingWord(sourceFile, position);
// Can only rename an identifier.
if (node && node.kind === SyntaxKind.Identifier) {
let symbol = typeInfoResolver.getSymbolAtLocation(node);
let symbol = typeChecker.getSymbolAtLocation(node);
// Only allow a symbol to be renamed if it actually has at least one declaration.
if (symbol) {
@ -6261,7 +6261,7 @@ module ts {
canRename: true,
localizedErrorMessage: undefined,
displayName: symbol.name,
fullDisplayName: typeInfoResolver.getFullyQualifiedName(symbol),
fullDisplayName: typeChecker.getFullyQualifiedName(symbol),
kind: kind,
kindModifiers: getSymbolModifiers(symbol),
triggerSpan: createTextSpan(node.getStart(), node.getWidth())

View file

@ -179,7 +179,7 @@ module ts.SignatureHelp {
}
export function getSignatureHelpItems(program: Program, sourceFile: SourceFile, position: number, cancellationToken: CancellationTokenObject): SignatureHelpItems {
let typeInfoResolver = program.getTypeChecker();
let typeChecker = program.getTypeChecker();
// Decide whether to show signature help
let startingToken = findTokenOnLeftOfPosition(sourceFile, position);
@ -198,7 +198,7 @@ module ts.SignatureHelp {
let call = argumentInfo.invocation;
let candidates = <Signature[]>[];
let resolvedSignature = typeInfoResolver.getResolvedSignature(call, candidates);
let resolvedSignature = typeChecker.getResolvedSignature(call, candidates);
cancellationToken.throwIfCancellationRequested();
if (!candidates.length) {
@ -496,8 +496,8 @@ module ts.SignatureHelp {
let invocation = argumentListInfo.invocation;
let callTarget = getInvokedExpression(invocation)
let callTargetSymbol = typeInfoResolver.getSymbolAtLocation(callTarget);
let callTargetDisplayParts = callTargetSymbol && symbolToDisplayParts(typeInfoResolver, callTargetSymbol, /*enclosingDeclaration*/ undefined, /*meaning*/ undefined);
let callTargetSymbol = typeChecker.getSymbolAtLocation(callTarget);
let callTargetDisplayParts = callTargetSymbol && symbolToDisplayParts(typeChecker, callTargetSymbol, /*enclosingDeclaration*/ undefined, /*meaning*/ undefined);
let items: SignatureHelpItem[] = map(candidates, candidateSignature => {
let signatureHelpParameters: SignatureHelpParameter[];
let prefixDisplayParts: SymbolDisplayPart[] = [];
@ -513,12 +513,12 @@ module ts.SignatureHelp {
signatureHelpParameters = typeParameters && typeParameters.length > 0 ? map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray;
suffixDisplayParts.push(punctuationPart(SyntaxKind.GreaterThanToken));
let parameterParts = mapToDisplayParts(writer =>
typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation));
typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation));
suffixDisplayParts.push.apply(suffixDisplayParts, parameterParts);
}
else {
let typeParameterParts = mapToDisplayParts(writer =>
typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation));
typeChecker.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation));
prefixDisplayParts.push.apply(prefixDisplayParts, typeParameterParts);
prefixDisplayParts.push(punctuationPart(SyntaxKind.OpenParenToken));
@ -528,7 +528,7 @@ module ts.SignatureHelp {
}
let returnTypeParts = mapToDisplayParts(writer =>
typeInfoResolver.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation));
typeChecker.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation));
suffixDisplayParts.push.apply(suffixDisplayParts, returnTypeParts);
return {
@ -563,7 +563,7 @@ module ts.SignatureHelp {
function createSignatureHelpParameterForParameter(parameter: Symbol): SignatureHelpParameter {
let displayParts = mapToDisplayParts(writer =>
typeInfoResolver.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation));
typeChecker.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation));
let isOptional = hasQuestionToken(parameter.valueDeclaration);
@ -577,7 +577,7 @@ module ts.SignatureHelp {
function createSignatureHelpParameterForTypeParameter(typeParameter: TypeParameter): SignatureHelpParameter {
let displayParts = mapToDisplayParts(writer =>
typeInfoResolver.getSymbolDisplayBuilder().buildTypeParameterDisplay(typeParameter, writer, invocation));
typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplay(typeParameter, writer, invocation));
return {
name: typeParameter.symbol.name,