src/language/XMLUtils.js
function getTagInfo(editor, pos) {
        var ctx, offset, tagAttrs, tagAttrValue;

        ctx = TokenUtils.getInitialContext(editor._codeMirror, pos);
        offset = TokenUtils.offsetInToken(ctx);

        if (ctx.token && ctx.token.type === "tag bracket" && ctx.token.string === "<") {
            // Returns tagInfo when an angle bracket is created.
            return _createTagInfo(ctx.token, TOKEN_TAG);
        } else if (ctx.token && ctx.token.type === "tag") {
            // Return tagInfo when a tag is created.
            if (TokenUtils.movePrevToken(ctx)) {
                if (ctx.token.type === "tag bracket" && ctx.token.string === "<") {
                    TokenUtils.moveNextToken(ctx);
                    return _createTagInfo(ctx.token, TOKEN_TAG, offset);
                }
            }
        } else if (ctx.token && (ctx.token.type === "attribute" ||
                                 (ctx.token.type === null && regexWhitespace.test(ctx.token.string)))) {
            // Return tagInfo when an attribute is created.
            tagAttrs = _getTagAttributes(editor, pos);
            if (tagAttrs && tagAttrs.tagName) {
                return _createTagInfo(ctx.token, TOKEN_ATTR, offset, tagAttrs.exclusionList, tagAttrs.tagName, null, tagAttrs.shouldReplace);
            }
        } else if (ctx.token && ((ctx.token.type === null && ctx.token.string === "=") ||
                                 (ctx.token.type === "string" && /^['"]$/.test(ctx.token.string.charAt(0))))) {
            // Return tag info when an attribute value is created.
            // Allow no hints if the cursor is outside the value.
            if (ctx.token.type === "string" &&
                    /^['"]$/.test(ctx.token.string.substr(-1, 1)) &&
                    ctx.token.string.length !== 1 &&
                    ctx.token.end === pos.ch) {
                return _createTagInfo();
            }

            tagAttrValue = _getTagAttributeValue(editor, pos);
            if (tagAttrValue && tagAttrValue.tagName && tagAttrValue.attrName) {
                return _createTagInfo(ctx.token, TOKEN_VALUE, offset, tagAttrValue.exclusionList, tagAttrValue.tagName, tagAttrValue.attrName);
            }
        }
        return _createTagInfo();
    }
function getTagInfo(editor, pos) {
        var ctx, offset, tagAttrs, tagAttrValue;

        ctx = TokenUtils.getInitialContext(editor._codeMirror, pos);
        offset = TokenUtils.offsetInToken(ctx);

        if (ctx.token && ctx.token.type === "tag bracket" && ctx.token.string === "<") {
            // Returns tagInfo when an angle bracket is created.
            return _createTagInfo(ctx.token, TOKEN_TAG);
        } else if (ctx.token && ctx.token.type === "tag") {
            // Return tagInfo when a tag is created.
            if (TokenUtils.movePrevToken(ctx)) {
                if (ctx.token.type === "tag bracket" && ctx.token.string === "<") {
                    TokenUtils.moveNextToken(ctx);
                    return _createTagInfo(ctx.token, TOKEN_TAG, offset);
                }
            }
        } else if (ctx.token && (ctx.token.type === "attribute" ||
                                 (ctx.token.type === null && regexWhitespace.test(ctx.token.string)))) {
            // Return tagInfo when an attribute is created.
            tagAttrs = _getTagAttributes(editor, pos);
            if (tagAttrs && tagAttrs.tagName) {
                return _createTagInfo(ctx.token, TOKEN_ATTR, offset, tagAttrs.exclusionList, tagAttrs.tagName, null, tagAttrs.shouldReplace);
            }
        } else if (ctx.token && ((ctx.token.type === null && ctx.token.string === "=") ||
                                 (ctx.token.type === "string" && /^['"]$/.test(ctx.token.string.charAt(0))))) {
            // Return tag info when an attribute value is created.
            // Allow no hints if the cursor is outside the value.
            if (ctx.token.type === "string" &&
                    /^['"]$/.test(ctx.token.string.substr(-1, 1)) &&
                    ctx.token.string.length !== 1 &&
                    ctx.token.end === pos.ch) {
                return _createTagInfo();
            }

            tagAttrValue = _getTagAttributeValue(editor, pos);
            if (tagAttrValue && tagAttrValue.tagName && tagAttrValue.attrName) {
                return _createTagInfo(ctx.token, TOKEN_VALUE, offset, tagAttrValue.exclusionList, tagAttrValue.tagName, tagAttrValue.attrName);
            }
        }
        return _createTagInfo();
    }
function getTagInfo ( editor , pos ) { var ctx , offset , tagAttrs , tagAttrValue ; ctx = TokenUtils . getInitialContext ( editor . _codeMirror , pos ) ; offset = TokenUtils . offsetInToken ( ctx ) ; if ( ctx . token && ctx . token . type === "tag bracket" && ctx . token . string === "<" ) { // Returns tagInfo when an angle bracket is created. return _createTagInfo ( ctx . token , TOKEN_TAG ) ; } else if ( ctx . token && ctx . token . type === "tag" ) { // Return tagInfo when a tag is created. if ( TokenUtils . movePrevToken ( ctx ) ) { if ( ctx . token . type === "tag bracket" && ctx . token . string === "<" ) { TokenUtils . moveNextToken ( ctx ) ; return _createTagInfo ( ctx . token , TOKEN_TAG , offset ) ; } } } else if ( ctx . token && ( ctx . token . type === "attribute" || ( ctx . token . type === null && regexWhitespace . test ( ctx . token . string ) ) ) ) { // Return tagInfo when an attribute is created. tagAttrs = _getTagAttributes ( editor , pos ) ; if ( tagAttrs && tagAttrs . tagName ) { return _createTagInfo ( ctx . token , TOKEN_ATTR , offset , tagAttrs . exclusionList , tagAttrs . tagName , null , tagAttrs . shouldReplace ) ; } } else if ( ctx . token && ( ( ctx . token . type === null && ctx . token . string === "=" ) || ( ctx . token . type === "string" && / ^['"]$ / . test ( ctx . token . string . charAt ( 0 ) ) ) ) ) { // Return tag info when an attribute value is created. // Allow no hints if the cursor is outside the value. if ( ctx . token . type === "string" && / ^['"]$ / . test ( ctx . token . string . substr ( - 1 , 1 ) ) && ctx . token . string . length !== 1 && ctx . token . end === pos . ch ) { return _createTagInfo ( ) ; } tagAttrValue = _getTagAttributeValue ( editor , pos ) ; if ( tagAttrValue && tagAttrValue . tagName && tagAttrValue . attrName ) { return _createTagInfo ( ctx . token , TOKEN_VALUE , offset , tagAttrValue . exclusionList , tagAttrValue . tagName , tagAttrValue . attrName ) ; } } return _createTagInfo ( ) ; }
Return the tag info at a given position in the active editor

@param {!Editor} editor Instance of active editor
@param {!{line: number, ch: number}} pos Position of cursor in the editor
@return {!{token: Object, tokenType: number, offset: number, exclusionList: Array.<string>, tagName: string, attrName: string, shouldReplace: boolean}}
Return the tag info at a given position in the active editor