Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
visitAttribute: function (ast) {
if (!ast.valueSpan || !utils_1.inSpan(templatePosition_1, utils_1.spanOf(ast.valueSpan))) {
// We are in the name of an attribute. Show attribute completions.
result = attributeCompletions(templateInfo, path_1);
}
else if (ast.valueSpan && utils_1.inSpan(templatePosition_1, utils_1.spanOf(ast.valueSpan))) {
result = attributeValueCompletions(templateInfo, templatePosition_1, ast);
}
},
visitText: function (ast) {
visitElement: function (ast) {
var startTagSpan = utils_1.spanOf(ast.sourceSpan);
var tagLen = ast.name.length;
if (templatePosition_1 <=
startTagSpan.start + tagLen + 1 /* 1 for the opening angle bracked */) {
// If we are in the tag then return the element completions.
result = elementCompletions(templateInfo, path_1);
}
else if (templatePosition_1 < startTagSpan.end) {
// We are in the attribute section of the element (but not in an attribute).
// Return the attribute completions.
result = attributeCompletions(templateInfo, path_1);
}
},
visitAttribute: function (ast) {
visitEvent: function (ast) {
if (!attributeValueSymbol_1(ast.handler, /* inEvent */ true)) {
symbol_1 = findOutputBinding(info, path, ast);
symbol_1 = symbol_1 && new OverrideKindSymbol(symbol_1, 'event');
span_1 = utils_1.spanOf(ast);
}
},
visitElementProperty: function (ast) { attributeValueSymbol_1(ast.value); },
visitText: function (ast) {
// Check if we are in a entity.
result = entityCompletions(getSourceText(template, utils_1.spanOf(ast)), astPosition_1);
if (result)
return result;
result = interpolationCompletions(templateInfo, templatePosition_1);
if (result)
return result;
var element = path_1.first(compiler_1.Element);
if (element) {
var definition = compiler_1.getHtmlTagDefinition(element.name);
if (definition.contentType === compiler_1.TagContentType.PARSABLE_DATA) {
result = voidElementAttributeCompletions(templateInfo, path_1);
if (!result) {
// If the element can hold content Show element completions.
result = elementCompletions(templateInfo, path_1);
}
}
}
var attributeValueSymbol_1 = function (ast, inEvent) {
if (inEvent === void 0) { inEvent = false; }
var attribute = findAttribute(info);
if (attribute) {
if (utils_1.inSpan(templatePosition, utils_1.spanOf(attribute.valueSpan))) {
var dinfo = utils_1.diagnosticInfoFromTemplateInfo(info);
var scope = language_services_1.getExpressionScope(dinfo, path, inEvent);
if (attribute.valueSpan) {
var expressionOffset = attribute.valueSpan.start.offset + 1;
var result = expressions_1.getExpressionSymbol(scope, ast, templatePosition - expressionOffset, info.template.query);
if (result) {
symbol_1 = result.symbol;
span_1 = utils_1.offsetSpan(result.span, expressionOffset);
}
}
return true;
}
}
return false;
};
path.tail.visit({
visitDirectiveProperty: function (ast) {
if (!attributeValueSymbol_1(ast.value)) {
symbol_1 = findInputBinding(info, path, ast);
span_1 = utils_1.spanOf(ast);
}
}
}, null);
visitReference: function (ast) {
symbol_1 = ast.value && info.template.query.getTypeSymbol(compiler_1.tokenReference(ast.value));
span_1 = utils_1.spanOf(ast);
},
visitVariable: function (ast) { },
visitDirective: function (ast) {
symbol_1 = info.template.query.getTypeSymbol(ast.directive.type.reference);
span_1 = utils_1.spanOf(ast);
},
visitDirectiveProperty: function (ast) {