How to reduce clang_complete search time via boost

I like to use clang with vim.

The only problem that I always run into is that whenever I turn on boost, clang goes through the boost library every time I put ".". after the name of the object. It takes 5-10 seconds.

Since I am not making changes to the header headers, is there a way to cache the search through boost? If not, is there a way to remove boost from automatic search completion?

update (1) in response to adaszko answer after: let g: clang_use_library = 1

  • I am typing a variable name.
  • I press ^ N. Vim starts a search on the bogey tree. it automatically completes the variable.
  • I press "." and get the following errors:
Error detected while processing function ClangComplete: line 35: Traceback (most recent call last): Press ENTER or type command to continue Error detected while processing function ClangComplete: line 35: File "<string>", line 1, in <module> Press ENTER or type command to continue Error detected while processing function ClangComplete: line 35: NameError: name 'vim' is not defined Press ENTER or type command to continue Error detected while processing function ClangComplete: line 40: E121: Undefined variable: l:res Press ENTER or type command to continue Error detected while processing function ClangComplete: line 40: E15: Invalid expression: l:res Press ENTER or type command to continue Error detected while processing function ClangComplete: line 58: E121: Undefined variable: l:res Press ENTER or type command to continue Error detected while processing function ClangComplete: line 58: E15: Invalid expression: l:res Press ENTER or type command to continue 

... and there is no automatic confirmation

update (2) is not sure that clang_complete should take care of the boost problem. vim without plugins searches through boost. superuser has an answer to comment on a search through boost dirs with set include=^\\s*#\\s*include\ \\(<boost/\\)\\@!

+6
source share
3 answers

from here , you can add the following to your .vimrc :

 :set include=^\\s*#\\s*include\ \\(<boost/\\)\\@! 

(the question of caching search through boost is still open)

0
source

So, you have at least two options. Option # 1 is to set g:clang_use_library to 1 . Here's what it says :help g:clang_use_library :

 Instead of calling the clang/clang++ tool use libclang directly. This gives access to many more clang features. Furthermore it automatically caches all includes in memory. Updates after changes in the same file will therefore be a lot faster. 

This requires a working setup for Python Vim integration.

Option number 2 is to set g:clang_complete_auto to 0 , with which you disable automatic completion after -> g:clang_complete_auto , :: and can use <Cx> <Co> instead of manually calling clang_complete whenever you want.

I use both.

+3
source

I have made many performance improvements for clang_complete, you can check this in question # 187 . Most of the problem was just poor script performance due to non-optimized code.

0
source

Source: https://habr.com/ru/post/915435/


All Articles