Remove editor_lexer_get_type_keyword_idx() function
It was used only in one place in document_update_type_keywords() which already did a similar check using the file type before calling this function. Update HACKING file and very minor cleanup of other code in document_update_type_keywords().
This commit is contained in:
parent
de559ef5d4
commit
6ceb5ac164
2
HACKING
2
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
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -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)
|
||||
{
|
||||
|
16
src/editor.c
16
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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user