diff --git a/HACKING b/HACKING index a50c179e..43671416 100644 --- a/HACKING +++ b/HACKING @@ -459,7 +459,7 @@ For brace indentation, update lexer_has_braces() in editor.c; indentation after ':' is done from on_new_line_added(). If the Scintilla lexer supports user type keyword highlighting (e.g. -SCLEX_CPP), update editor_lexer_get_type_keyword_idx() in editor.c. +SCLEX_CPP), update document_update_type_keywords() in document.c. Adding a TagManager parser ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/document.c b/src/document.c index b0faa26c..b1a0f2c4 100644 --- a/src/document.c +++ b/src/document.c @@ -72,6 +72,8 @@ #include "search.h" #include "filetypesprivate.h" +#include "SciLexer.h" + GeanyFilePrefs file_prefs; @@ -2352,33 +2354,26 @@ void document_update_tag_list_in_idle(GeanyDocument *doc) void document_update_type_keywords(GeanyDocument *doc) { gint keyword_idx; - gchar *keywords = NULL; + gchar *keywords; GString *str; GPtrArray *tags_array; g_return_if_fail(DOC_VALID(doc)); + g_return_if_fail(app->tm_workspace != NULL); - switch (doc->file_type->id) + switch (sci_get_lexer(doc->editor->sci)) { - /* continue working with the following languages, skip on all others */ - case GEANY_FILETYPES_C: - case GEANY_FILETYPES_CPP: - case GEANY_FILETYPES_CS: - case GEANY_FILETYPES_D: - case GEANY_FILETYPES_JAVA: - case GEANY_FILETYPES_VALA: + case SCLEX_CPP: + case SCLEX_D: + /* index of the keyword set in the Scintilla lexer, for + * example in LexCPP.cxx, see "cppWordLists" global array. */ + keyword_idx = 3; break; + /* early out if the lexer doesn't support user type keywords */ default: return; } - keyword_idx = editor_lexer_get_type_keyword_idx(sci_get_lexer(doc->editor->sci)); - if (keyword_idx == -1) - return; - - if (app->tm_workspace == NULL) - return; - tags_array = app->tm_workspace->work_object.tags_array; if (tags_array) { diff --git a/src/editor.c b/src/editor.c index 36c26644..492b477b 100644 --- a/src/editor.c +++ b/src/editor.c @@ -3486,22 +3486,6 @@ static gboolean editor_lexer_is_c_like(gint lexer) #endif -/* Returns: -1 if lexer doesn't support type keywords. - * @see document_update_type_keywords(). */ -gint editor_lexer_get_type_keyword_idx(gint lexer) -{ - switch (lexer) - { - case SCLEX_CPP: - case SCLEX_D: - return 3; - - default: - return -1; - } -} - - /* inserts a three-line comment at one line above current cursor position */ void editor_insert_multiline_comment(GeanyEditor *editor) { diff --git a/src/editor.h b/src/editor.h index b9722f70..1a5c2b36 100644 --- a/src/editor.h +++ b/src/editor.h @@ -206,8 +206,6 @@ void editor_do_comment(GeanyEditor *editor, gint line, gboolean allow_empty_line gint editor_do_uncomment(GeanyEditor *editor, gint line, gboolean toggle); -gint editor_lexer_get_type_keyword_idx(gint lexer); - void editor_insert_multiline_comment(GeanyEditor *editor); void editor_insert_alternative_whitespace(GeanyEditor *editor);