MCPcopy
hub / github.com/prettier/prettier / addTagDefinition

Function addTagDefinition

src/language-html/parse/postprocess.js:192–211  ·  view source on GitHub ↗

* @param {Ast.Node} node * @param {ParseOptions} parseOptions

(node, parseOptions)

Source from the content-addressed store, hash-verified

190 * @param {ParseOptions} parseOptions
191 */
192function addTagDefinition(node, parseOptions) {
193 if (node.kind === "element") {
194 const tagDefinition = getHtmlTagDefinition(
195 parseOptions.isTagNameCaseSensitive ? node.name : node.name.toLowerCase(),
196 );
197 if (
198 // @ts-expect-error -- we add it
199 !node.namespace ||
200 // @ts-expect-error -- we add it
201 node.namespace === tagDefinition.implicitNamespacePrefix ||
202 isUnknownNamespace(node)
203 ) {
204 // @ts-expect-error -- expected
205 node.tagDefinition = tagDefinition;
206 } else {
207 // @ts-expect-error -- expected
208 node.tagDefinition = getHtmlTagDefinition(""); // the default one
209 }
210 }
211}
212
213function fixSourceSpan(node) {
214 if (node.sourceSpan && node.endSourceSpan) {

Callers 1

visitMethod · 0.85

Calls 1

isUnknownNamespaceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…