[geany/geany] 968188: Merge pull request #1014 from b4n/streamline-builtin-tags
Colomban Wendling
git-noreply at xxxxx
Sun May 15 13:58:05 UTC 2016
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Sun, 15 May 2016 13:58:05 UTC
Commit: 96818888069f8c5d7a1b5d3e1d3f9a4d73c7ffb7
https://github.com/geany/geany/commit/96818888069f8c5d7a1b5d3e1d3f9a4d73c7ffb7
Log Message:
-----------
Merge pull request #1014 from b4n/streamline-builtin-tags
Streamline builtin tags
Modified Paths:
--------------
data/Makefile.am
data/tags/entities.html.tags
data/tags/std.pas.tags
data/tags/std.php.tags
data/tags/std.py.tags
data/tags/std99.c.tags
src/editor.c
src/symbols.c
src/symbols.h
src/utils.c
src/utils.h
Modified: data/Makefile.am
10 lines changed, 5 insertions(+), 5 deletions(-)
===================================================================
@@ -73,11 +73,11 @@ filetypes = \
filedefs/filetypes.zephir
tagfiles = \
- tags/c99.tags \
- tags/php.tags \
- tags/python.tags \
- tags/pascal.tags \
- tags/html_entities.tags
+ tags/std99.c.tags \
+ tags/std.php.tags \
+ tags/std.py.tags \
+ tags/std.pas.tags \
+ tags/entities.html.tags
template_files = \
templates/files/file.html \
Modified: data/tags/entities.html.tags
3 lines changed, 1 insertions(+), 2 deletions(-)
===================================================================
@@ -1,5 +1,4 @@
-# each of the following lines represent a html entity
-# used in HTML and PHP files when typing &...
+#format=tagmanager
Á
á
Â
Modified: data/tags/std.pas.tags
0 lines changed, 0 insertions(+), 0 deletions(-)
===================================================================
No diff available, check online
Modified: data/tags/std.php.tags
0 lines changed, 0 insertions(+), 0 deletions(-)
===================================================================
No diff available, check online
Modified: data/tags/std.py.tags
0 lines changed, 0 insertions(+), 0 deletions(-)
===================================================================
No diff available, check online
Modified: data/tags/std99.c.tags
0 lines changed, 0 insertions(+), 0 deletions(-)
===================================================================
No diff available, check online
Modified: src/editor.c
48 lines changed, 4 insertions(+), 44 deletions(-)
===================================================================
@@ -2076,56 +2076,16 @@ gchar *editor_get_calltip_text(GeanyEditor *editor, const TMTag *tag)
}
-/* HTML entities auto completion from html_entities.tags text file */
-static gboolean
-autocomplete_html(ScintillaObject *sci, const gchar *root, gsize rootlen)
-{
- guint i;
- gboolean found = FALSE;
- GString *words;
- const gchar **entities = symbols_get_html_entities();
-
- if (*root != '&' || entities == NULL)
- return FALSE;
-
- words = g_string_sized_new(500);
- for (i = 0; ; i++)
- {
- if (entities[i] == NULL)
- break;
- else if (entities[i][0] == '#')
- continue;
-
- if (! strncmp(entities[i], root, rootlen))
- {
- if (words->len)
- g_string_append_c(words, '\n');
-
- g_string_append(words, entities[i]);
- found = TRUE;
- }
- }
- if (found)
- show_autocomplete(sci, rootlen, words);
-
- g_string_free(words, TRUE);
- return found;
-}
-
-
/* Current document & global tags autocompletion */
static gboolean
-autocomplete_tags(GeanyEditor *editor, const gchar *root, gsize rootlen)
+autocomplete_tags(GeanyEditor *editor, GeanyFiletype *ft, const gchar *root, gsize rootlen)
{
GPtrArray *tags;
- GeanyDocument *doc;
gboolean found;
g_return_val_if_fail(editor, FALSE);
- doc = editor->document;
-
- tags = tm_workspace_find_prefix(root, doc->file_type->lang, editor_prefs.autocompletion_max_entries);
+ tags = tm_workspace_find_prefix(root, ft->lang, editor_prefs.autocompletion_max_entries);
found = tags->len > 0;
if (found)
show_tags_list(editor, tags, rootlen);
@@ -2164,7 +2124,7 @@ static gboolean autocomplete_check_html(GeanyEditor *editor, gint style, gint po
tmp = strchr(root, '&');
if (tmp != NULL)
{
- return autocomplete_html(editor->sci, tmp, strlen(tmp));
+ return autocomplete_tags(editor, filetypes_index(GEANY_FILETYPES_HTML), tmp, strlen(tmp));
}
}
return FALSE;
@@ -2338,7 +2298,7 @@ gboolean editor_start_auto_complete(GeanyEditor *editor, gint pos, gboolean forc
{
/* complete tags, except if forcing when completion is already visible */
if (!(force && SSM(sci, SCI_AUTOCACTIVE, 0, 0)))
- ret = autocomplete_tags(editor, root, rootlen);
+ ret = autocomplete_tags(editor, editor->document->file_type, root, rootlen);
/* If forcing and there's nothing else to show, complete from words in document */
if (!ret && (force || editor_prefs.autocomplete_doc_words))
Modified: src/symbols.c
93 lines changed, 4 insertions(+), 89 deletions(-)
===================================================================
@@ -64,36 +64,6 @@
#include <stdlib.h>
-static gchar **html_entities = NULL;
-
-typedef struct
-{
- gboolean tags_loaded;
- const gchar *tag_file;
-} TagFileInfo;
-
-/* Check before adding any more tags files, usually they should be downloaded separately. */
-enum /* Geany tag files */
-{
- GTF_C,
- GTF_PASCAL,
- GTF_PHP,
- GTF_HTML_ENTITIES,
- GTF_LATEX,
- GTF_PYTHON,
- GTF_MAX
-};
-
-static TagFileInfo tag_file_info[GTF_MAX] =
-{
- {FALSE, "c99.tags"},
- {FALSE, "pascal.tags"},
- {FALSE, "php.tags"},
- {FALSE, "html_entities.tags"},
- {FALSE, "latex.tags"},
- {FALSE, "python.tags"}
-};
-
static GPtrArray *top_level_iter_names = NULL;
enum
@@ -138,7 +108,6 @@ static struct
}
symbol_menu;
-static void html_tags_loaded(void);
static void load_user_tags(GeanyFiletypeID ft_id);
/* get the tags_ignore list, exported by tagmanager's options.c */
@@ -201,9 +170,6 @@ static gboolean symbols_load_global_tags(const gchar *tags_file, GeanyFiletype *
* This provides autocompletion, calltips, etc. */
void symbols_global_tags_loaded(guint file_type_idx)
{
- TagFileInfo *tfi;
- gint tag_type;
-
/* load ignore list for C/C++ parser */
if ((file_type_idx == GEANY_FILETYPES_C || file_type_idx == GEANY_FILETYPES_CPP) &&
c_tags_ignore == NULL)
@@ -221,53 +187,12 @@ void symbols_global_tags_loaded(guint file_type_idx)
switch (file_type_idx)
{
- case GEANY_FILETYPES_PHP:
- case GEANY_FILETYPES_HTML:
- html_tags_loaded();
- }
- switch (file_type_idx)
- {
case GEANY_FILETYPES_CPP:
symbols_global_tags_loaded(GEANY_FILETYPES_C); /* load C global tags */
- /* no C++ tagfile yet */
- return;
- case GEANY_FILETYPES_C: tag_type = GTF_C; break;
- case GEANY_FILETYPES_PASCAL:tag_type = GTF_PASCAL; break;
- case GEANY_FILETYPES_PHP: tag_type = GTF_PHP; break;
- case GEANY_FILETYPES_LATEX: tag_type = GTF_LATEX; break;
- case GEANY_FILETYPES_PYTHON:tag_type = GTF_PYTHON; break;
- default:
- return;
- }
- tfi = &tag_file_info[tag_type];
-
- if (! tfi->tags_loaded)
- {
- gchar *fname = g_build_filename(app->datadir, GEANY_TAGS_SUBDIR, tfi->tag_file, NULL);
-
- symbols_load_global_tags(fname, filetypes[file_type_idx]);
- tfi->tags_loaded = TRUE;
- g_free(fname);
- }
-}
-
-
-/* HTML tagfile is just a list of entities for autocompletion (e.g. '&') */
-static void html_tags_loaded(void)
-{
- TagFileInfo *tfi;
-
- if (cl_options.ignore_global_tags)
- return;
-
- tfi = &tag_file_info[GTF_HTML_ENTITIES];
- if (! tfi->tags_loaded)
- {
- gchar *file = g_build_filename(app->datadir, GEANY_TAGS_SUBDIR, tfi->tag_file, NULL);
-
- html_entities = utils_read_file_in_array(file);
- tfi->tags_loaded = TRUE;
- g_free(file);
+ break;
+ case GEANY_FILETYPES_PHP:
+ symbols_global_tags_loaded(GEANY_FILETYPES_HTML); /* load HTML global tags */
+ break;
}
}
@@ -326,15 +251,6 @@ const gchar *symbols_get_context_separator(gint ft_id)
}
-const gchar **symbols_get_html_entities(void)
-{
- if (html_entities == NULL)
- html_tags_loaded(); /* if not yet created, force creation of the array but shouldn't occur */
-
- return (const gchar **) html_entities;
-}
-
-
/* sort by name, then line */
static gint compare_symbol(const TMTag *tag_a, const TMTag *tag_b)
{
@@ -2634,7 +2550,6 @@ void symbols_finalize(void)
{
guint i;
- g_strfreev(html_entities);
g_strfreev(c_tags_ignore);
for (i = 0; i < G_N_ELEMENTS(symbols_icons); i++)
Modified: src/symbols.h
2 lines changed, 0 insertions(+), 2 deletions(-)
===================================================================
@@ -52,8 +52,6 @@ void symbols_global_tags_loaded(guint file_type_idx);
GString *symbols_find_typenames_as_string(TMParserType lang, gboolean global);
-const gchar **symbols_get_html_entities(void);
-
gboolean symbols_recreate_tag_list(GeanyDocument *doc, gint sort_mode);
gint symbols_generate_global_tags(gint argc, gchar **argv, gboolean want_preprocess);
Modified: src/utils.c
19 lines changed, 0 insertions(+), 19 deletions(-)
===================================================================
@@ -1060,25 +1060,6 @@ GIOChannel *utils_set_up_io_channel(
}
-gchar **utils_read_file_in_array(const gchar *filename)
-{
- gchar **result = NULL;
- gchar *data;
-
- g_return_val_if_fail(filename != NULL, NULL);
-
- g_file_get_contents(filename, &data, NULL, NULL);
-
- if (data != NULL)
- {
- result = g_strsplit_set(data, "\r\n", -1);
- g_free(data);
- }
-
- return result;
-}
-
-
/* Contributed by Stefan Oltmanns, thanks.
* Replaces \\, \r, \n, \t and \uXXX by their real counterparts.
* keep_backslash is used for regex strings to leave '\\' and '\?' in place */
Modified: src/utils.h
2 lines changed, 0 insertions(+), 2 deletions(-)
===================================================================
@@ -289,8 +289,6 @@ gchar *utils_get_current_time_string(void);
GIOChannel *utils_set_up_io_channel(gint fd, GIOCondition cond, gboolean nblock,
GIOFunc func, gpointer data);
-gchar **utils_read_file_in_array(const gchar *filename);
-
gboolean utils_str_replace_escape(gchar *string, gboolean keep_backslash);
gboolean utils_wrap_string(gchar *string, gint wrapstart);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list