(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position)
| 132293 | return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* SyntaxKind.Identifier */ ? ts.createTextSpanFromNode(location) : undefined; |
| 132294 | } |
| 132295 | function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) { |
| 132296 | var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importCompletionNode = completionData.importCompletionNode, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports; |
| 132297 | // Verify if the file is JSX language variant |
| 132298 | if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* LanguageVariant.JSX */) { |
| 132299 | var completionInfo = getJsxClosingTagCompletion(location, sourceFile); |
| 132300 | if (completionInfo) { |
| 132301 | return completionInfo; |
| 132302 | } |
| 132303 | } |
| 132304 | var entries = ts.createSortedArray(); |
| 132305 | if (isUncheckedFile(sourceFile, compilerOptions)) { |
| 132306 | var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, |
| 132307 | /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag); |
| 132308 | getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries); |
| 132309 | } |
| 132310 | else { |
| 132311 | if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* KeywordCompletionFilters.None */) { |
| 132312 | return undefined; |
| 132313 | } |
| 132314 | getCompletionEntriesFromSymbols(symbols, entries, |
| 132315 | /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag); |
| 132316 | } |
| 132317 | if (keywordFilters !== 0 /* KeywordCompletionFilters.None */) { |
| 132318 | var entryNames_1 = new ts.Set(entries.map(function (e) { return e.name; })); |
| 132319 | for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) { |
| 132320 | var keywordEntry = _a[_i]; |
| 132321 | if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !entryNames_1.has(keywordEntry.name)) { |
| 132322 | ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true); |
| 132323 | } |
| 132324 | } |
| 132325 | } |
| 132326 | var entryNames = new ts.Set(entries.map(function (e) { return e.name; })); |
| 132327 | for (var _b = 0, _c = getContextualKeywords(contextToken, position); _b < _c.length; _b++) { |
| 132328 | var keywordEntry = _c[_b]; |
| 132329 | if (!entryNames.has(keywordEntry.name)) { |
| 132330 | ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true); |
| 132331 | } |
| 132332 | } |
| 132333 | for (var _d = 0, literals_1 = literals; _d < literals_1.length; _d++) { |
| 132334 | var literal = literals_1[_d]; |
| 132335 | ts.insertSorted(entries, createCompletionEntryForLiteral(sourceFile, preferences, literal), compareCompletionEntries, /*allowDuplicates*/ true); |
| 132336 | } |
| 132337 | return { |
| 132338 | flags: completionData.flags, |
| 132339 | isGlobalCompletion: isInSnippetScope, |
| 132340 | isIncomplete: preferences.allowIncompleteCompletions && hasUnresolvedAutoImports ? true : undefined, |
| 132341 | isMemberCompletion: isMemberCompletionKind(completionKind), |
| 132342 | isNewIdentifierLocation: isNewIdentifierLocation, |
| 132343 | optionalReplacementSpan: getOptionalReplacementSpan(location), |
| 132344 | entries: entries, |
| 132345 | }; |
| 132346 | } |
| 132347 | function isUncheckedFile(sourceFile, compilerOptions) { |
| 132348 | return ts.isSourceFileJS(sourceFile) && !ts.isCheckJsEnabledForFile(sourceFile, compilerOptions); |
| 132349 | } |
no test coverage detected