Browse files

Merge branch 'master' of github.com:Shougo/clang_complete

  • Loading branch information...
2 parents b43cfbe + 7468fd8 commit 143e64ec630a937fbfa0c6a731573ded1d986b30 @Shougo committed Aug 23, 2011
View
51 autoload/neocomplcache/sources/clang_complete.vim
@@ -19,20 +19,23 @@
"
" Variables initialize.
-if !exists('g:neocomplcache_clang_complete_use_library')
- let g:neocomplcache_clang_complete_use_library = 0
+if !exists('g:neocomplcache_clang_use_library')
+ let g:neocomplcache_clang_use_library = 0
endif
-if !exists('g:neocomplcache_clang_complete_macros')
- let g:neocomplcache_clang_complete_macros = 0
+if !exists('g:neocomplcache_clang_macros')
+ let g:neocomplcache_clang_macros = 0
endif
-if !exists('g:neocomplcache_clang_complete_patterns')
- let g:neocomplcache_clang_complete_patterns = 0
+if !exists('g:neocomplcache_clang_patterns')
+ let g:neocomplcache_clang_patterns = 0
endif
-if !exists('g:neocomplcache_clang_complete_auto_options')
- let g:neocomplcache_clang_complete_auto_options = 'path, .clang_complete'
+if !exists('g:neocomplcache_clang_auto_options')
+ let g:neocomplcache_clang_auto_options = 'path, .clang_complete'
endif
-if !exists('g:neocomplcache_clang_complete_user_options')
- let g:neocomplcache_clang_complete_user_options = ''
+if !exists('g:neocomplcache_clang_user_options')
+ let g:neocomplcache_clang_user_options = ''
+endif
+if !exists('g:neocomplcache_clang_debug')
+ let g:neocomplcache_clang_debug = 0
endif
let s:source = {
@@ -48,9 +51,9 @@ let s:plugin_path = escape(expand('<sfile>:p:h'), '\')
function! s:init_ClangCompletePython()
python import sys
- if exists('g:neocomplcache_clang_complete_library_path')
+ if exists('g:neocomplcache_clang_library_path')
" Load the library from the given library path.
- execute 'python sys.argv = ["' . escape(g:neocomplcache_clang_complete_library_path, '\') . '"]'
+ execute 'python sys.argv = ["' . escape(g:neocomplcache_clang_library_path, '\') . '"]'
else
" By setting argv[0] to '' force the python bindings to load the library
" from the normal system search path.
@@ -59,13 +62,13 @@ function! s:init_ClangCompletePython()
execute 'python sys.path = ["' . s:plugin_path . '/clang_complete"] + sys.path'
execute 'pyfile ' . s:plugin_path . '/clang_complete/libclang.py'
- python initClangComplete(vim.eval('g:neocomplcache_clang_complete_lib_flags'))
+ python initClangComplete(vim.eval('g:neocomplcache_clang_lib_flags'))
endfunction
function! s:init_ClangComplete()
let b:should_overload = 0
- call LoadUserOptions()
+ call s:loadUserOptions()
let b:clang_exec = 'clang'
let b:clang_parameters = '-x c'
@@ -82,34 +85,34 @@ function! s:init_ClangComplete()
let b:clang_parameters .= '-header'
endif
- let g:neocomplcache_clang_complete_lib_flags = 0
- if g:neocomplcache_clang_complete_macros
+ let g:neocomplcache_clang_lib_flags = 0
+ if g:neocomplcache_clang_macros
let b:clang_parameters .= ' -code-completion-macros'
- let g:neocomplcache_clang_complete_lib_flags = 1
+ let g:neocomplcache_clang_lib_flags = 1
endif
- if g:neocomplcache_clang_complete_patterns
+ if g:neocomplcache_clang_patterns
let b:clang_parameters .= ' -code-completion-patterns'
let g:clang_complete_lib_flags += 2
endif
" Load the python bindings of libclang.
- if g:neocomplcache_clang_complete_use_library
+ if g:neocomplcache_clang_use_library
if has('python')
call s:init_ClangCompletePython()
else
echoe 'clang_complete: No python support available.'
echoe 'Cannot use clang library, using executable'
echoe 'Compile vim with python support to use libclang'
- let g:neocomplcache_clang_complete_use_library = 0
+ let g:neocomplcache_clang_use_library = 0
return
endif
endif
endfunction
-function! LoadUserOptions()
+function! s:loadUserOptions()
let b:clang_user_options = ''
- let l:option_sources = split(g:neocomplcache_clang_complete_auto_options, ',')
+ let l:option_sources = split(g:neocomplcache_clang_auto_options, ',')
let l:remove_spaces_cmd = 'substitute(v:val, "\\s*\\(.*\\)\\s*", "\\1", "")'
let l:option_sources = map(l:option_sources, l:remove_spaces_cmd)
@@ -254,7 +257,7 @@ function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str)
return []
endif
- if g:neocomplcache_clang_complete_use_library
+ if g:neocomplcache_clang_use_library
python vim.command('let l:clang_output = ' + str(getCurrentCompletions(vim.eval('a:cur_keyword_str'), int(vim.eval('a:cur_keyword_pos+1')))))
" echomsg string(l:clang_output)
else
@@ -278,7 +281,7 @@ function! s:complete_from_clang_binary(cur_keyword_pos, cur_keyword_str)
\ . ' -code-completion-at='
\ . l:escaped_tempfile . ":" . line('.') . ":" . (a:cur_keyword_pos+1)
\ . ' ' . l:escaped_tempfile
- \ . ' ' . b:clang_parameters . ' ' . b:clang_user_options . ' ' . g:neocomplcache_clang_complete_user_options
+ \ . ' ' . b:clang_parameters . ' ' . b:clang_user_options . ' ' . g:neocomplcache_clang_user_options
let l:clang_output = split(neocomplcache#system(l:command), '\n')
call delete(l:tempfile)
View
8 autoload/neocomplcache/sources/clang_complete/libclang.py
@@ -46,7 +46,7 @@ def getCurrentFile():
return (vim.current.buffer.name, file)
def getCurrentTranslationUnit(update = False):
- userOptionsGlobal = splitOptions(vim.eval("g:neocomplcache_clang_complete_user_options"))
+ userOptionsGlobal = splitOptions(vim.eval("g:neocomplcache_clang_user_options"))
userOptionsLocal = splitOptions(vim.eval("b:clang_user_options"))
args = userOptionsGlobal + userOptionsLocal
@@ -174,8 +174,7 @@ def getCurrentQuickFixList():
def updateCurrentDiagnostics():
global debug
- # debug = int(vim.eval("g:clang_debug")) == 1
- debug = 0
+ debug = int(vim.eval("g:neocomplcache_clang_debug")) == 1
getCurrentTranslationUnit(update = True)
def getCurrentCompletionResults(line, column):
@@ -227,8 +226,7 @@ def formatResult(result):
def getCurrentCompletions(base, column):
global debug
- # debug = int(vim.eval("g:clang_debug")) == 1
- debug = False
+ debug = int(vim.eval("g:neocomplcache_clang_debug")) == 1
# priority = vim.eval("g:clang_sort_algo") == 'priority'
priority = True
line = int(vim.eval("line('.')"))

0 comments on commit 143e64e

Please sign in to comment.