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

Function getContextualKeywords

test/fixtures/snapshot/typescript.js:135139–135166  ·  view source on GitHub ↗
(contextToken, position)

Source from the content-addressed store, hash-verified

135137 return ts.isIdentifier(node) ? node.originalKeywordKind || 0 /* SyntaxKind.Unknown */ : node.kind;
135138 }
135139 function getContextualKeywords(contextToken, position) {
135140 var entries = [];
135141 /**
135142 * An `AssertClause` can come after an import declaration:
135143 * import * from "foo" |
135144 * import "foo" |
135145 * or after a re-export declaration that has a module specifier:
135146 * export { foo } from "foo" |
135147 * Source: https://tc39.es/proposal-import-attributes/
135148 */
135149 if (contextToken) {
135150 var file = contextToken.getSourceFile();
135151 var parent = contextToken.parent;
135152 var tokenLine = file.getLineAndCharacterOfPosition(contextToken.end).line;
135153 var currentLine = file.getLineAndCharacterOfPosition(position).line;
135154 if ((ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent) && parent.moduleSpecifier)
135155 && contextToken === parent.moduleSpecifier
135156 && tokenLine === currentLine) {
135157 entries.push({
135158 name: ts.tokenToString(129 /* SyntaxKind.AssertKeyword */),
135159 kind: "keyword" /* ScriptElementKind.keyword */,
135160 kindModifiers: "" /* ScriptElementKindModifier.none */,
135161 sortText: Completions.SortText.GlobalsOrKeywords,
135162 });
135163 }
135164 }
135165 return entries;
135166 }
135167 /** Get the corresponding JSDocTag node if the position is in a jsDoc comment */
135168 function getJsDocTagAtPosition(node, position) {
135169 return ts.findAncestor(node, function (n) {

Callers 1

completionInfoFromDataFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected