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

Function getCompletionEntryDisplayNameForSymbol

test/fixtures/snapshot/typescript.js:134993–135023  ·  view source on GitHub ↗
(symbol, target, origin, kind, jsxIdentifierExpected)

Source from the content-addressed store, hash-verified

134991 return { symbol: symbol, origin: completionEntryDataToSymbolOriginInfo(data, name, moduleSymbol) };
134992 }
134993 function getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind, jsxIdentifierExpected) {
134994 var name = originIncludesSymbolName(origin) ? origin.symbolName : symbol.name;
134995 if (name === undefined
134996 // If the symbol is external module, don't show it in the completion list
134997 // (i.e declare module "http" { const x; } | // <= request completion here, "http" should not be there)
134998 || symbol.flags & 1536 /* SymbolFlags.Module */ && ts.isSingleOrDoubleQuote(name.charCodeAt(0))
134999 // If the symbol is the internal name of an ES symbol, it is not a valid entry. Internal names for ES symbols start with "__@"
135000 || ts.isKnownSymbol(symbol)) {
135001 return undefined;
135002 }
135003 var validNameResult = { name: name, needsConvertPropertyAccess: false };
135004 if (ts.isIdentifierText(name, target, jsxIdentifierExpected ? 1 /* LanguageVariant.JSX */ : 0 /* LanguageVariant.Standard */) || symbol.valueDeclaration && ts.isPrivateIdentifierClassElementDeclaration(symbol.valueDeclaration)) {
135005 return validNameResult;
135006 }
135007 switch (kind) {
135008 case 3 /* CompletionKind.MemberLike */:
135009 return undefined;
135010 case 0 /* CompletionKind.ObjectPropertyDeclaration */:
135011 // TODO: GH#18169
135012 return { name: JSON.stringify(name), needsConvertPropertyAccess: false };
135013 case 2 /* CompletionKind.PropertyAccess */:
135014 case 1 /* CompletionKind.Global */: // For a 'this.' completion it will be in a global context, but may have a non-identifier name.
135015 // Don't add a completion for a name starting with a space. See https://github.com/Microsoft/TypeScript/pull/20547
135016 return name.charCodeAt(0) === 32 /* CharacterCodes.space */ ? undefined : { name: name, needsConvertPropertyAccess: true };
135017 case 5 /* CompletionKind.None */:
135018 case 4 /* CompletionKind.String */:
135019 return validNameResult;
135020 default:
135021 ts.Debug.assertNever(kind);
135022 }
135023 }
135024 // A cache of completion entries for keywords, these do not change between sessions
135025 var _keywordCompletions = [];
135026 var allKeywordsCompletions = ts.memoize(function () {

Calls 1

originIncludesSymbolNameFunction · 0.85

Tested by

no test coverage detected