SF.net SVN: geany:[4343] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Tue Oct 20 12:07:13 UTC 2009


Revision: 4343
          http://geany.svn.sourceforge.net/geany/?rev=4343&view=rev
Author:   ntrel
Date:     2009-10-20 12:07:12 +0000 (Tue, 20 Oct 2009)

Log Message:
-----------
Support loading global tags files for custom filetypes.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/doc/geany.html
    trunk/doc/geany.txt
    trunk/src/document.c
    trunk/src/filetypes.c
    trunk/src/highlighting.c
    trunk/src/symbols.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-10-19 18:28:46 UTC (rev 4342)
+++ trunk/ChangeLog	2009-10-20 12:07:12 UTC (rev 4343)
@@ -1,3 +1,10 @@
+2009-10-20  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/highlighting.c, src/filetypes.c, src/document.c, src/symbols.c,
+   doc/geany.txt, doc/geany.html:
+   Support loading global tags files for custom filetypes.
+
+
 2009-10-19  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
 
  * doc/geany.txt, doc/geany.html:

Modified: trunk/doc/geany.html
===================================================================
--- trunk/doc/geany.html	2009-10-19 18:28:46 UTC (rev 4342)
+++ trunk/doc/geany.html	2009-10-20 12:07:12 UTC (rev 4343)
@@ -3965,7 +3965,7 @@
 <p>At startup Geany looks for <tt class="docutils literal"><span class="pre">filetypes.*.conf</span></tt> files in the system and
 user filetype paths, adding any filetypes found with the name matching
 the '<tt class="docutils literal"><span class="pre">*</span></tt>' wildcard.</p>
-<p>Custom filetypes are not as powerful as built-in filetypes. The following
+<p>Custom filetypes are not as powerful as built-in filetypes, but the following
 have been implemented:</p>
 <ul>
 <li><p class="first">Recognizing and setting the filetype (after the user has manually edited
@@ -3982,6 +3982,9 @@
 </li>
 <li><p class="first">Build commands.</p>
 </li>
+<li><p class="first">Loading global tags files (namespace will be shared with tag_parser
+type).</p>
+</li>
 </ul>
 </div>
 <div class="section">
@@ -5764,7 +5767,7 @@
 <div class="footer">
 <hr class="footer" />
 <a class="reference" href="geany.txt">View document source</a>.
-Generated on: 2009-10-19 14:50 UTC.
+Generated on: 2009-10-20 12:00 UTC.
 Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
 
 </div>

Modified: trunk/doc/geany.txt
===================================================================
--- trunk/doc/geany.txt	2009-10-19 18:28:46 UTC (rev 4342)
+++ trunk/doc/geany.txt	2009-10-20 12:07:12 UTC (rev 4343)
@@ -3328,7 +3328,7 @@
 user filetype paths, adding any filetypes found with the name matching
 the '``*``' wildcard.
 
-Custom filetypes are not as powerful as built-in filetypes. The following
+Custom filetypes are not as powerful as built-in filetypes, but the following
 have been implemented:
 
 * Recognizing and setting the filetype (after the user has manually edited
@@ -3337,6 +3337,8 @@
     * Using existing tag parsing (``tag_parser`` key).
     * Using existing syntax highlighting (``lexer_filetype`` key).
 * Build commands.
+* Loading global tags files (namespace will be shared with tag_parser
+  type).
 
 System files
 ^^^^^^^^^^^^

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2009-10-19 18:28:46 UTC (rev 4342)
+++ trunk/src/document.c	2009-10-20 12:07:12 UTC (rev 4343)
@@ -2470,6 +2470,10 @@
 			tm_workspace_remove_object(doc->tm_file, TRUE, TRUE);
 			doc->tm_file = NULL;
 		}
+		/* load tags files before highlighting (some lexers highlight global typenames) */
+		if (type->id != GEANY_FILETYPES_NONE)
+			symbols_global_tags_loaded(type->id);
+
 		highlighting_set_styles(doc->editor->sci, type);
 		editor_set_indentation_guides(doc->editor);
 		build_menu_update(doc);

Modified: trunk/src/filetypes.c
===================================================================
--- trunk/src/filetypes.c	2009-10-19 18:28:46 UTC (rev 4342)
+++ trunk/src/filetypes.c	2009-10-20 12:07:12 UTC (rev 4343)
@@ -1420,7 +1420,8 @@
 }
 
 
-/* Indicates whether there is a tag parser for the filetype or not. */
+/* Indicates whether there is a tag parser for the filetype or not.
+ * Only works for custom filetypes if the filetype settings have been loaded. */
 gboolean filetype_has_tags(GeanyFiletype *ft)
 {
 	g_return_val_if_fail(ft != NULL, FALSE);

Modified: trunk/src/highlighting.c
===================================================================
--- trunk/src/highlighting.c	2009-10-19 18:28:46 UTC (rev 4342)
+++ trunk/src/highlighting.c	2009-10-20 12:07:12 UTC (rev 4343)
@@ -3250,10 +3250,6 @@
 		return;
 	}
 
-	/* load tags files (some lexers highlight global typenames) */
-	if (ft->id != GEANY_FILETYPES_NONE)
-		symbols_global_tags_loaded(ft->id);
-
 	switch (ft->id)
 	{
 		styleset_case(GEANY_FILETYPES_ADA,		styleset_ada);

Modified: trunk/src/symbols.c
===================================================================
--- trunk/src/symbols.c	2009-10-19 18:28:46 UTC (rev 4342)
+++ trunk/src/symbols.c	2009-10-20 12:07:12 UTC (rev 4343)
@@ -172,6 +172,9 @@
 	if (cl_options.ignore_global_tags || app->tm_workspace == NULL)
 		return;
 
+	/* load config in case of custom filetypes */
+	filetypes_load_config(file_type_idx, FALSE);
+
 	load_user_tags(file_type_idx);
 
 	switch (file_type_idx)
@@ -1299,10 +1302,6 @@
 		ft = filetypes_detect_from_extension(shortname);
 	}
 	g_free(shortname);
-
-	if (ft == NULL || ! filetype_has_tags(ft))
-		return NULL;
-
 	return ft;
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list