Commits

abudden committed fc3b557

Should now use tag file searching correctly. Fixes #14.

Comments (0)

Files changed (6)

autoload/TagHighlight/Generation.vim

 		" in the path
 		let RunOptions['CtagsExeFull'] = TagHighlight#RunPythonScript#FindExePath(ctags_option)
 	endif
+
+	let tag_file_info = TagHighlight#Find#LocateFile('TAGS', '')
+	if tag_file_info['Found'] == 1
+		let RunOptions['CtagsFileLocation'] = tag_file_info['Directory']
+	endif
+
+	let types_file_info = TagHighlight#Find#LocateFile('TYPES', '*')
+	if types_file_info['Found'] == 1
+		let RunOptions['TypesFileLocation'] = types_file_info['Directory']
+	endif
 	
 	" Find the cscope path
 

autoload/TagHighlight/ReadTypes.vim

 	" TODO: Currently only searches for a single types file; doesn't look
 	"       for library files
 	let search_result = TagHighlight#Find#LocateFile('TYPES', a:suffix)
-	if result['Found'] == 1 && result['Exists'] == 1
-		let results += [result['FullPath']]
+	if search_result['Found'] == 1 && search_result['Exists'] == 1
+		let results += [search_result['FullPath']]
 	endif
 	return results
 endfunction

autoload/TagHighlight/RunPythonScript.vim

 		call TagHighlight#RunPythonScript#FindPython()
 	endif
 
+	echomsg "Using variant: " .s:python_variant
+
 	if index(["if_pyth","if_pyth3"], s:python_variant) != -1
 		let add_to_py_path = substitute(g:TagHighlightSettings['PluginPath'], '\\', '/','g')
 		let PY = s:python_cmd[0]
 		exe PY 'from module.utilities import TagHighlightOptionDict' 
 		exe PY 'from module.worker import RunWithOptions'
 		exe PY 'options = TagHighlightOptionDict()'
+		let handled_options = []
 		" We're using the custom interpreter: create an options object
 		for option in g:TagHighlightSettings['ScriptOptions']
 			if has_key(option, 'VimOptionMap') && has_key(a:options, option['VimOptionMap'])
 				" We can handle this one automatically
 				let pyoption = 'options["'.option['Destination'].'"]'
 				if option['Type'] == 'bool'
+					let handled_options += [option['VimOptionMap']]
 					if a:options[option['VimOptionMap']]
 						exe PY pyoption '= True'
 					else
 						exe PY pyoption '= False'
 					endif
 				elseif option['Type'] == 'string'
+					let handled_options += [option['VimOptionMap']]
 					exe PY pyoption '= """'.a:options[option['VimOptionMap']].'"""'
 				elseif option['Type'] == 'list'
+					let handled_options += [option['VimOptionMap']]
 					exe PY pyoption '= []'
 					for entry in a:options[option['VimOptionMap']]
 						exe PY pyoption '+= ["""' . entry . '"""]'
 				endif
 			endif
 		endfor
+		for check_opt in keys(a:options)
+			if index(handled_options, check_opt) == -1
+				echomsg "Unhandled run option: " . check_opt
+			endif
+		endfor
 		exe PY 'RunWithOptions(options)'
 	elseif index(["python","compiled"], s:python_variant) != -1
 		let args = s:python_cmd[:]

plugin/TagHighlight/data/options.txt

  
 ctags_file:
 	CommandLineSwitches:--ctags-file
-	VimOptionMapper:CtagsOutputFile
+	VimOptionMap:CtagsOutputFile
 	Type:string
 	Default:tags
 	Help:CTAGS output filename
- 
-types_prefix:
-	CommandLineSwitches:--types-prefix
+
+ctags_file_dir:
+	CommandLineSwitches:--ctags-file-dir
+	VimOptionMap:CtagsFileLocation
+	Type:string
+	Default:.
+	Help:Location in which to store or find CTAGS output file
+
+types_file_prefix:
+	CommandLineSwitches:--types-file-prefix
 	VimOptionMap:TypesFilePrefix
 	Type:string
 	Default:types
  
 languages:
 	CommandLineSwitches:--include-language
-	VimOptionMapper:Languages
+	VimOptionMap:Languages
 	Type:list
 	Default:[]
 	Help:Only include specified languages
 	Default:None
 	Help:CSCOPE Executable Directory
  
-type_file_prefix:
-	CommandLineSwitches:--type-prefix
-	Type:string
-	Default:types
-	Help:Specify the prefix for the generated types files
- 
-type_file_location:
-	CommandLineSwitches:--type-file-location
+types_file_location:
+	CommandLineSwitches:--types-file-location
+	VimOptionMap:TypesFileLocation
 	Type:string
 	Default:.
 	Help:Specify the location for the generated types files

plugin/TagHighlight/module/ctags.py

     process = subprocess.Popen(ctags_cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True)
     (sout, serr) = process.communicate()
 
-    tagFile = open(options['ctags_file'], 'r')
+    tagFile = open(os.path.join(options['ctags_file_dir'], options['ctags_file']), 'r')
     tagLines = [line.strip() for line in tagFile]
     tagFile.close()
 
     # Also sort the file a bit better (tag, then kind, then filename)
     tagLines.sort(key=ctags_key)
 
-    tagFile = open(options['ctags_file'], 'w')
+    tagFile = open(os.path.join(options['ctags_file_dir'],options['ctags_file']), 'w')
     for line in tagLines:
         tagFile.write(line + "\n")
     tagFile.close()
                 languages.GetLanguageHandler(key)['PythonExtensionMatcher'] +
                 ')\t')
 
-    p = open(options['ctags_file'], 'r')
+    p = open(os.path.join(options['ctags_file_dir'],options['ctags_file']), 'r')
     while 1:
         line = p.readline()
         if not line:
     args += ["--languages=" + ",".join(ctags_languages)]
 
     if options['ctags_file']:
-        args += ['-f', options['ctags_file']]
+        args += ['-f', os.path.join(options['ctags_file_dir'], options['ctags_file'])]
 
     if not options['include_docs']:
         args += ["--exclude=docs", "--exclude=Documentation"]

plugin/TagHighlight/module/generation.py

         vimtypes_entries.append('')
         vimtypes_entries.append('syn cluster javaTop ' + AddList + LocalTagType)
 
-    filename = os.path.join(options['type_file_location'],
-            options['type_file_prefix'] + '_' + language_handler['Suffix'] + '.vim')
+    filename = os.path.join(options['types_file_location'],
+            options['types_file_prefix'] + '_' + language_handler['Suffix'] + '.vim')
 
     try:
         # Have to open in binary mode as we want to write with Unix line endings