diff options
Diffstat (limited to 'editor/plugins/script_text_editor.h')
-rw-r--r-- | editor/plugins/script_text_editor.h | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index 5e167af51a..808a6417e4 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -259,51 +259,4 @@ public: ~ScriptTextEditor(); }; -const int KIND_COUNT = 10; -// The order in which to sort code completion options. -const ScriptLanguage::CodeCompletionKind KIND_SORT_ORDER[KIND_COUNT] = { - ScriptLanguage::CODE_COMPLETION_KIND_VARIABLE, - ScriptLanguage::CODE_COMPLETION_KIND_MEMBER, - ScriptLanguage::CODE_COMPLETION_KIND_FUNCTION, - ScriptLanguage::CODE_COMPLETION_KIND_ENUM, - ScriptLanguage::CODE_COMPLETION_KIND_SIGNAL, - ScriptLanguage::CODE_COMPLETION_KIND_CONSTANT, - ScriptLanguage::CODE_COMPLETION_KIND_CLASS, - ScriptLanguage::CODE_COMPLETION_KIND_NODE_PATH, - ScriptLanguage::CODE_COMPLETION_KIND_FILE_PATH, - ScriptLanguage::CODE_COMPLETION_KIND_PLAIN_TEXT, -}; - -// The custom comparer which will sort completion options. -struct CodeCompletionOptionCompare { - _FORCE_INLINE_ bool operator()(const ScriptLanguage::CodeCompletionOption &l, const ScriptLanguage::CodeCompletionOption &r) const { - if (l.location == r.location) { - // If locations are same, sort on kind - if (l.kind == r.kind) { - // If kinds are same, sort alphanumeric - return l.display < r.display; - } - - // Sort kinds based on the const sorting array defined above. Lower index = higher priority. - int l_index = -1; - int r_index = -1; - for (int i = 0; i < KIND_COUNT; i++) { - const ScriptLanguage::CodeCompletionKind kind = KIND_SORT_ORDER[i]; - l_index = kind == l.kind ? i : l_index; - r_index = kind == r.kind ? i : r_index; - - if (l_index != -1 && r_index != -1) { - return l_index < r_index; - } - } - - // This return should never be hit unless something goes wrong. - // l and r should always have a Kind which is in the sort order array. - return l.display < r.display; - } - - return l.location < r.location; - } -}; - #endif // SCRIPT_TEXT_EDITOR_H |