Skip to content

Commit

Permalink
- Changed variables name.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Jul 16, 2011
1 parent f77d32a commit 56091e6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
47 changes: 25 additions & 22 deletions autoload/neocomplcache/sources/clang_complete.vim
Expand Up @@ -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 = {
Expand All @@ -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.
Expand All @@ -59,7 +62,7 @@ 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()
Expand All @@ -82,25 +85,25 @@ 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
Expand All @@ -109,7 +112,7 @@ endfunction
function! 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)

Expand Down Expand Up @@ -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
Expand All @@ -278,7 +281,7 @@ function! s:complete_from_clang_binary(cur_keyword_pos)
\ . ' -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)
Expand Down
8 changes: 3 additions & 5 deletions autoload/neocomplcache/sources/clang_complete/libclang.py
Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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('.')"))
Expand Down

0 comments on commit 56091e6

Please sign in to comment.