GNOME Bugzilla – Bug 763271
editor should support ctrl+click to open included header
Last modified: 2016-03-25 18:29:44 UTC
when a C source or header has: #include "foo.h" we should be able to ctrl+click on the foo.h to jump to that file.
Created attachment 324533 [details] [review] Working Path I have added an initial Working patch. There seems to be a strange problem, I am not getting a CXCursor_InclusionDirective when hovering over any headers specified by <> e.g. <stdio.h>. However, hovering on the corresponding "#include" statement gives me the Correct CXCursor_InclusionDirective. This however works properly on any headers of the form #include "temp.h"
Created attachment 324534 [details] Picture describing the mismatch in alignment. Well, I again have this mismatch in alignment. See the content of the file when I open it in Builder vs when I do a diff here.
Created attachment 324535 [details] [review] Corrected Incorrect Alignment I have corrected the previous misalignment in this patch.
Review of attachment 324535 [details] [review]: + fix the coding style + when doing patches, look at build output warnings to be sure that you don't introduce new ones ::: libide/ide-source-view.c @@ +183,3 @@ + + GRegex *include_regex; + GError *include_regex_err; use spaces not tabs @@ +2537,3 @@ * are commonly used in the same word in code */ + *word_start = *iter; + *word_end = *iter; we don't align parameters in function body, only in structs and function definition/declation @@ +2541,1 @@ + do the 'do' is not aligned well @@ -2558,3 +2562,3 @@ } } - + return (!gtk_text_iter_equal (word_start, word_end)); keep the empty line after a curly braced block and align the return well @@ -2591,2 +2594,3 @@ } + IdeSymbolKind kind = ide_symbol_get_kind (symbol); please declare parameters at the top of its scope @@ +2620,3 @@ + GtkTextIter line_end = word_end; + gint line_number; + g_autofree gchar* line_text; set g_autofree and g_autoptr parameters to NULL should be written : g_autofree gchar *line_text = NULL; @@ +2621,3 @@ + gint line_number; + g_autofree gchar* line_text; + GMatchInfo *matchInfo; use g_autoptr here @@ +2627,3 @@ + gtk_text_iter_set_line (&line_start, line_number); + gtk_text_iter_set_line (&line_end, line_number); + gtk_text_iter_forward_to_line_end (&line_end); just use: gtk_text_iter_set_line_offset (&line_start, 0); gtk_text_iter_forward_to_line_end (&line_end); @@ -2612,0 +2617,31 @@ + if (kind == IDE_SYMBOL_HEADER) + { + GtkTextIter line_start = word_start; ... 28 more ... use gtk_text_iter_set_line_index @@ -2612,0 +2617,33 @@ + if (kind == IDE_SYMBOL_HEADER) + { + GtkTextIter line_start = word_start; ... 30 more ... tabs everywhere to remove @@ +6467,3 @@ + priv->include_regex = g_regex_new (INCLUDE_STATEMENTS, + 0, maybe use G_REGEX_OPTIMIZE GRegexCompileFlags @@ +6469,3 @@ + 0, + 0, + &priv->include_regex_err); we can use NULL instead of a GError here, should be stated in the GLib doc ( remove include_regex_err in the struct field too) @@ -6429,0 +6468,5 @@ + priv->include_regex = g_regex_new (INCLUDE_STATEMENTS, + 0, + 0, ... 2 more ... free it in ide_source_view_finalize
Created attachment 324554 [details] [review] Updated Patch Updated with the above suggested changes.
Created attachment 324562 [details] [review] Changed g_object_unref to g_regex_unref
Created attachment 324563 [details] [review] Corrected Incorrect Alignment after changing to g_regex_unref
thanks for your work