MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / get_option_characteristics

Method get_option_characteristics

core/object/script_language.cpp:620–648  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

618}
619
620TypedArray<int> ScriptLanguage::CodeCompletionOption::get_option_characteristics(const String &p_base) {
621 if (last_matches == matches) {
622 return charac;
623 }
624 charac.clear();
625 // Ensure base is not empty and at the same time that matches is not empty too.
626 if (p_base.length() == 0) {
627 last_matches = matches;
628 charac.push_back(location);
629 return charac;
630 }
631 charac.push_back(matches.size());
632 charac.push_back((matches[0].first == 0) ? 0 : 1);
633 const char32_t *target_char = &p_base[0];
634 int bad_case = 0;
635 for (const Pair<int, int> &match_segment : matches) {
636 const char32_t *string_to_complete_char = &display[match_segment.first];
637 for (int j = 0; j < match_segment.second; j++, string_to_complete_char++, target_char++) {
638 if (*string_to_complete_char != *target_char) {
639 bad_case++;
640 }
641 }
642 }
643 charac.push_back(bad_case);
644 charac.push_back(location);
645 charac.push_back(matches[0].first);
646 last_matches = matches;
647 return charac;
648}
649
650void ScriptLanguage::CodeCompletionOption::clear_characteristics() {
651 charac = TypedArray<int>();

Calls 4

sizeMethod · 0.65
clearMethod · 0.45
lengthMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected