MCPcopy Create free account
hub / github.com/nodejs/node / tryGetLocalNamedExportCompletionSymbols

Function tryGetLocalNamedExportCompletionSymbols

test/fixtures/snapshot/typescript.js:134437–134456  ·  view source on GitHub ↗

* Adds local declarations for completions in named exports: * * export { | }; * * Does not check for the absence of a module specifier (`export {} from "./other"`) * because `tryGetImportOrExportClauseCompletionSymbols` runs first an

()

Source from the content-addressed store, hash-verified

134435 * preventing this function from running.
134436 */
134437 function tryGetLocalNamedExportCompletionSymbols() {
134438 var _a;
134439 var namedExports = contextToken && (contextToken.kind === 18 /* SyntaxKind.OpenBraceToken */ || contextToken.kind === 27 /* SyntaxKind.CommaToken */)
134440 ? ts.tryCast(contextToken.parent, ts.isNamedExports)
134441 : undefined;
134442 if (!namedExports) {
134443 return 0 /* GlobalsSearch.Continue */;
134444 }
134445 var localsContainer = ts.findAncestor(namedExports, ts.or(ts.isSourceFile, ts.isModuleDeclaration));
134446 completionKind = 5 /* CompletionKind.None */;
134447 isNewIdentifierLocation = false;
134448 (_a = localsContainer.locals) === null || _a === void 0 ? void 0 : _a.forEach(function (symbol, name) {
134449 var _a, _b;
134450 symbols.push(symbol);
134451 if ((_b = (_a = localsContainer.symbol) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.has(name)) {
134452 symbolToSortTextMap[ts.getSymbolId(symbol)] = Completions.SortText.OptionalMember;
134453 }
134454 });
134455 return 1 /* GlobalsSearch.Success */;
134456 }
134457 /**
134458 * Aggregates relevant symbols for completion in class declaration
134459 * Relevant symbols are stored in the captured 'symbols' variable.

Callers 1

tryGetGlobalSymbolsFunction · 0.85

Calls 3

forEachMethod · 0.65
hasMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected