Commits

abudden committed 863ad4b

Debug output improvements.

Comments (0)

Files changed (5)

autoload/TagHighlight/Debug.vim

 " Tag Highlighter:
 "   Author:  A. S. Budden <abudden _at_ gmail _dot_ com>
-"   Date:    02/08/2011
+"   Date:    05/08/2011
 " Copyright: Copyright (C) 2009-2011 A. S. Budden
 "            Permission is hereby granted to use and distribute this code,
 "            with or without modifications, provided that this copyright
 	return g:TagHighlight#Debug#DebugLevels[debug_level_num]
 endfunction
 
+function! TagHighlight#Debug#DebugLevelIncludes(level)
+	let level_index = index(g:TagHighlight#Debug#DebugLevels, a:level)
+	if level_index == -1
+		let level_index = index(g:TagHighlight#Debug#DebugLevels, 'Critical')
+	endif
+	if level_index <= TagHighlight#Debug#GetDebugLevel()
+		return 1
+	else
+		return 0
+	endif
+endfunction
+
 function! TagHighlight#Debug#DebugUpdateTypesFile(filename)
 	" Update the types file with debugging turned on
 	if a:filename ==? 'None'
 		let debug_file = a:filename
 	endif
 
+	let debug_options = ["DebugFile","DebugLevel"]
+
+	" Store the old debug options
+	for dbg_option in debug_options
+		let stored_option_name = 'Stored'.dbg_option
+		if has_key(g:TagHighlightSettings, dbg_option)
+			let g:TagHighlightSettings[stored_option_name] = g:TagHighlightSettings[dbg_option]
+		else
+			let g:TagHighlightSettings[stored_option_name] = 'None'
+		endif
+	endfor
+
 	let g:TagHighlightSettings['DebugFile'] = debug_file
 	let g:TagHighlightSettings['DebugLevel'] = 'Information'
 
+	call TagHLDebug("========================================================", "Information")
 	call TagHighlight#Generation#UpdateTypesFile(1, 0)
 	let s:SavedTabNr = tabpagenr()
 	let s:SavedWinNr = winnr()
 	tabdo windo call TagHighlight#ReadTypes#ReadTypesAutoDetect()
 	exe 'tabn' s:SavedTabNr
 	exe s:SavedWinNr . "wincmd w"
+
+	" Get rid of the 'stored' versions of the debug options
+	for dbg_option in debug_options
+		let stored_option_name = 'Stored'.dbg_option
+		if g:TagHighlightSettings[stored_option_name] == 'None'
+			unlet g:TagHighlightSettings[dbg_option]
+		else
+			let g:TagHighlightSettings[dbg_option] = g:TagHighlightSettings[stored_option_name]
+		endif
+		unlet g:TagHighlightSettings[stored_option_name]
+	endfor
 endfunction

autoload/TagHighlight/Generation.vim

 function! TagHighlight#Generation#UpdateTypesFile(recurse, skiptags)
 	" Load the version information if we haven't already
 	call TagHighlight#Version#LoadVersionInfo()
-	call TagHLDebug("Release Info:" . string(g:TagHighlightPrivate['PluginVersion']), "Information")
+
+	" Debug information for configuration
+	if TagHighlight#Debug#DebugLevelIncludes('Information')
+		call TagHLDebug("Release Info:" . string(g:TagHighlightPrivate['PluginVersion']), "Information")
+		call TagHLDebug("Global options (g:TagHighlightSettings): " . string(g:TagHighlightSettings), "Information")
+		if exists('b:TagHighlightSettings')
+			call TagHLDebug("Buffer options (b:TagHighlightSettings): " . string(b:TagHighlightSettings), "Information")
+		else
+			call TagHLDebug("No buffer options set", "Information")
+		endif
+	endif
 	
 	" Load the option file
 	let option_file_info = TagHighlight#Option#LoadOptionFileIfPresent()
+	" Debug information for configuration
+	if TagHighlight#Debug#DebugLevelIncludes('Information') && option_file_info['Exists']
+		call TagHLDebug("Project config file options: " . string(b:TagHighlightConfigFileOptions), "Information")
+	else
+		call TagHLDebug("Project config file does not exist", "Information")
+	endif
 	
 	" Call any PreUpdate hooks
 	let preupdate_hooks = TagHighlight#Option#GetOption('PreUpdateHooks')

autoload/TagHighlight/Option.vim

 " Tag Highlighter:
 "   Author:  A. S. Budden <abudden _at_ gmail _dot_ com>
-"   Date:    25/07/2011
+"   Date:    05/08/2011
 " Copyright: Copyright (C) 2009-2011 A. S. Budden
 "            Permission is hereby granted to use and distribute this code,
 "            with or without modifications, provided that this copyright

doc/TagHighlight.txt

 ==============================================================================
 7. TagHighlight History                *TagHighlight-history*               {{{1
 
+2.0.15: 5th August 2011    : Debug output improvements.
+
 2.0.14: 5th August 2011    : Bug fix for selection of source directory.  If
                              one of the explicit locations was set to 'None',
                              it was using 'None' as the source dir location.

plugin/TagHighlight.vim

 " Tag Highlighter:
 "   Author:  A. S. Budden <abudden _at_ gmail _dot_ com>
-"   Date:    02/08/2011
+"   Date:    05/08/2011
 " Copyright: Copyright (C) 2009-2011 A. S. Budden
 "            Permission is hereby granted to use and distribute this code,
 "            with or without modifications, provided that this copyright
 endfunction
 
 function! TagHLDebug(str, level)
-	let level_index = index(g:TagHighlight#Debug#DebugLevels, a:level)
-	if level_index == -1
-		level_index = index(g:TagHighlight#Debug#DebugLevels, 'Critical')
-	endif
-	if level_index <= TagHighlight#Debug#GetDebugLevel()
+	if TagHighlight#Debug#DebugLevelIncludes(a:level)
 		try
 			let debug_file = TagHighlight#Option#GetOption('DebugFile')
 			let print_time = TagHighlight#Option#GetOption('DebugPrintTime')