abudden  committed 57581f7

Rework priority list so that duplicates are removed completely.

  • Participants
  • Parent commits e591d4b

Comments (0)

Files changed (3)

File doc/TagHighlight.txt

 		SkipList -  Any specific ctags "kinds" (single characters referring
 					to types of tags) that you want to omit from the types
-					file.  For example, for C code, function prototypes are
-			       	omitted (function definitions are included) by setting
+					file.  For example, for C code, function prototypes can be
+					omitted (function definitions are included) by setting
 			       	SkipList to p.  To include multiple items, separate
 			       	each item with a comma.  To see a list of kinds for a
 			       	language, use:
 	* Corrected bug with SkipList operation (thanks to Bruno Jiménez for
 	  reporting this).
+	* Improved priority handling: remove duplicates rather than relying on
+	  Vim's priority handling.  This enables non-duplicated function
+	  prototypes (in C code) to be included.
 	Other changes:

File plugin/TagHighlight/data/languages/c.txt

 # Note that these keywords are for C++ - TagHighlight does not
 # distinguish between C and C++ so uses the (longer) C++ list here.

File plugin/TagHighlight/module/

         # Get the priority list from the language handler
+        # Highest priority is first
         priority = language_handler['Priority'][:]
-        # Reverse the priority such that highest priority
-        # is last.
-        priority.reverse()
-        fullTypeList = list(reversed(sorted(tags.keys())))
+        fullTypeList = list(sorted(tags.keys()))
         # Reorder type list according to priority sort order
         allTypes = []
         for thisType in priority:
         # Add the ones not specified in priority
-        allTypes = fullTypeList + allTypes
+        allTypes += fullTypeList
         Debug("Type priority list: " + repr(allTypes), "Information")
         for pattern in options['skip_patterns']:
+        all_keywords = []
         for thisType in allTypes:
             keystarter = 'syn keyword ' + thisType
             keycommand = keystarter
             for keyword in tags[thisType]:
                 skip_this = False
+                if keyword in all_keywords:
+                    # Duplicate: skip
+                    continue
+                all_keywords.append(keyword)
                 if options['skip_reserved_keywords']:
                     if keyword in language_handler['ReservedKeywords']:
                         Debug('Skipping reserved word ' + keyword, 'Information')
             # All keywords have been filtered out, give up
+        vimtypes_entries.reverse()
         vimtypes_entries += matchEntries