MCPcopy Index your code
hub / github.com/nodejs/node / getQuickInfoAtPosition

Function getQuickInfoAtPosition

test/fixtures/snapshot/typescript.js:165287–165320  ·  view source on GitHub ↗
(fileName, position)

Source from the content-addressed store, hash-verified

165285 return ts.Completions.getCompletionEntrySymbol(program, log, getValidSourceFile(fileName), position, { name: name, source: source }, host, preferences);
165286 }
165287 function getQuickInfoAtPosition(fileName, position) {
165288 synchronizeHostData();
165289 var sourceFile = getValidSourceFile(fileName);
165290 var node = ts.getTouchingPropertyName(sourceFile, position);
165291 if (node === sourceFile) {
165292 // Avoid giving quickInfo for the sourceFile as a whole.
165293 return undefined;
165294 }
165295 var typeChecker = program.getTypeChecker();
165296 var nodeForQuickInfo = getNodeForQuickInfo(node);
165297 var symbol = getSymbolAtLocationForQuickInfo(nodeForQuickInfo, typeChecker);
165298 if (!symbol || typeChecker.isUnknownSymbol(symbol)) {
165299 var type_2 = shouldGetType(sourceFile, nodeForQuickInfo, position) ? typeChecker.getTypeAtLocation(nodeForQuickInfo) : undefined;
165300 return type_2 && {
165301 kind: "" /* ScriptElementKind.unknown */,
165302 kindModifiers: "" /* ScriptElementKindModifier.none */,
165303 textSpan: ts.createTextSpanFromNode(nodeForQuickInfo, sourceFile),
165304 displayParts: typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return ts.typeToDisplayParts(typeChecker, type_2, ts.getContainerNode(nodeForQuickInfo)); }),
165305 documentation: type_2.symbol ? type_2.symbol.getDocumentationComment(typeChecker) : undefined,
165306 tags: type_2.symbol ? type_2.symbol.getJsDocTags(typeChecker) : undefined
165307 };
165308 }
165309 var _a = typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) {
165310 return ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, ts.getContainerNode(nodeForQuickInfo), nodeForQuickInfo);
165311 }), symbolKind = _a.symbolKind, displayParts = _a.displayParts, documentation = _a.documentation, tags = _a.tags;
165312 return {
165313 kind: symbolKind,
165314 kindModifiers: ts.SymbolDisplay.getSymbolModifiers(typeChecker, symbol),
165315 textSpan: ts.createTextSpanFromNode(nodeForQuickInfo, sourceFile),
165316 displayParts: displayParts,
165317 documentation: documentation,
165318 tags: tags,
165319 };
165320 }
165321 function getNodeForQuickInfo(node) {
165322 if (ts.isNewExpression(node.parent) && node.pos === node.parent.pos) {
165323 return node.parent.expression;

Callers

nothing calls this directly

Calls 5

synchronizeHostDataFunction · 0.85
getValidSourceFileFunction · 0.85
getNodeForQuickInfoFunction · 0.85
shouldGetTypeFunction · 0.85

Tested by

no test coverage detected