<commit_before>/*
 * Created by IntelliJ IDEA.
 * User: mike
 * Date: Jul 23, 2002
 * Time: 3:15:07 PM
 * To change template for new class use 
 * Code Style | Class Templates options (Tools | IDE Options).
 */
package com.intellij.codeInsight.completion;

import com.intellij.codeInsight.lookup.CharFilter;

public class XmlCharFilter implements CharFilter {
  private boolean myWithinTag;

  public XmlCharFilter(boolean withinTag) {
    myWithinTag = withinTag;
  }

  public int accept(char c, final String prefix) {
    if (Character.isJavaIdentifierPart(c)) return CharFilter.ADD_TO_PREFIX;
    switch(c){
      case ':':
      case '.':
      case '-':
        return CharFilter.ADD_TO_PREFIX;
      case ',':
      case ';':
      case '=':
      case '(':

      case '>': if (prefix != null && prefix.length() > 0) {
        return CharFilter.SELECT_ITEM_AND_FINISH_LOOKUP;
      }
      case '/':
        return myWithinTag ? CharFilter.SELECT_ITEM_AND_FINISH_LOOKUP:CharFilter.ADD_TO_PREFIX;
      default:
        return CharFilter.HIDE_LOOKUP;
      case ' ':
        return SELECT_ITEM_AND_FINISH_LOOKUP;
    }
  }
}<commit_msg>Unexpected HTML tag completion (IDEADEV-14332)<commit_after>/*
 * Created by IntelliJ IDEA.
 * User: mike
 * Date: Jul 23, 2002
 * Time: 3:15:07 PM
 * To change template for new class use 
 * Code Style | Class Templates options (Tools | IDE Options).
 */
package com.intellij.codeInsight.completion;

import com.intellij.codeInsight.lookup.CharFilter;

public class XmlCharFilter implements CharFilter {
  private boolean myWithinTag;

  public XmlCharFilter(boolean withinTag) {
    myWithinTag = withinTag;
  }

  public int accept(char c, final String prefix) {
    if (Character.isJavaIdentifierPart(c)) return CharFilter.ADD_TO_PREFIX;
    switch(c){
      case ':':
      case '.':
      case '-':
        return CharFilter.ADD_TO_PREFIX;
      case ',':
      case ';':
      case '=':
      case '(':

      case '/':
        return myWithinTag && prefix != null && prefix.length() > 0 ? CharFilter.SELECT_ITEM_AND_FINISH_LOOKUP:CharFilter.ADD_TO_PREFIX;
        
      case '>': if (prefix != null && prefix.length() > 0) {
        return CharFilter.SELECT_ITEM_AND_FINISH_LOOKUP;
      }

      default:
        return CharFilter.HIDE_LOOKUP;
      case ' ':
        return SELECT_ITEM_AND_FINISH_LOOKUP;
    }
  }
}
{'fraction_non_alphanumeric': 0.10928270042194092, 'fraction_numerical': 0.012658227848101266, 'mean_word_length': 2.9060955518945635, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4265511', 'n_tokens_mistral': 806, 'n_tokens_neox': 750, 'n_words': 178}