Display diagnostics asynchronously

Use the timers feature to display diagnostics asynchronously instead of waiting
for an autocommand to trigger.
Increase Vim version requirement to 7.4.1578.
Drop the CursorHold and CursorHoldI autocommands.
Parse buffer on the TextChanged autocommand instead of CursorMoved.
This commit is contained in:
micbou 2017-04-11 13:46:20 +02:00
parent 61b5aa76fe
commit d44ad0894b
No known key found for this signature in database
GPG Key ID: C7E8FD1F3BDA1E05
4 changed files with 118 additions and 165 deletions

View File

@ -216,7 +216,7 @@ YouCompleteMe, however they may not work for everyone. If the following
instructions don't work for you, check out the [full installation instructions don't work for you, check out the [full installation
guide](#full-installation-guide). guide](#full-installation-guide).
Make sure you have Vim 7.4.143 with Python 2 or Python 3 support. Ubuntu 14.10 Make sure you have Vim 7.4.1578 with Python 2 or Python 3 support. Ubuntu 16.04
and later have a Vim that's recent enough. You can see the version of Vim and later have a Vim that's recent enough. You can see the version of Vim
installed by running `vim --version`. If the version is too old, you may need to installed by running `vim --version`. If the version is too old, you may need to
[compile Vim from source][vim-build] (don't worry, it's easy). [compile Vim from source][vim-build] (don't worry, it's easy).
@ -283,7 +283,7 @@ YouCompleteMe, however they may not work for everyone. If the following
instructions don't work for you, check out the [full installation instructions don't work for you, check out the [full installation
guide](#full-installation-guide). guide](#full-installation-guide).
Make sure you have Vim 7.4.143 with Python 2 or Python 3 support. Fedora 21 and Make sure you have Vim 7.4.1578 with Python 2 or Python 3 support. Fedora 21 and
later have a Vim that's recent enough. You can see the version of Vim installed later have a Vim that's recent enough. You can see the version of Vim installed
by running `vim --version`. If the version is too old, you may need to [compile by running `vim --version`. If the version is too old, you may need to [compile
Vim from source][vim-build] (don't worry, it's easy). Vim from source][vim-build] (don't worry, it's easy).
@ -353,7 +353,7 @@ guide](#full-installation-guide).
**Important:** we assume that you are using the `cmd.exe` command prompt and **Important:** we assume that you are using the `cmd.exe` command prompt and
that you know how to add an executable to the PATH environment variable. that you know how to add an executable to the PATH environment variable.
Make sure you have at least Vim 7.4.143 with Python 2 or Python 3 support. You Make sure you have at least Vim 7.4.1578 with Python 2 or Python 3 support. You
can check the version and which Python is supported by typing `:version` inside can check the version and which Python is supported by typing `:version` inside
Vim. Look at the features included: `+python/dyn` for Python 2 and Vim. Look at the features included: `+python/dyn` for Python 2 and
`+python3/dyn` for Python 3. Take note of the Vim architecture, i.e. 32 or `+python3/dyn` for Python 3. Take note of the Vim architecture, i.e. 32 or
@ -432,7 +432,7 @@ guide](#full-installation-guide).
**NOTE:** OpenBSD / FreeBSD are not officially supported platforms by YCM. **NOTE:** OpenBSD / FreeBSD are not officially supported platforms by YCM.
Make sure you have Vim 7.4.143 with Python 2 or Python 3 support. Make sure you have Vim 7.4.1578 with Python 2 or Python 3 support.
OpenBSD 5.5 and later have a Vim that's recent enough. You can see the version of OpenBSD 5.5 and later have a Vim that's recent enough. You can see the version of
Vim installed by running `vim --version`. Vim installed by running `vim --version`.
@ -509,7 +509,7 @@ process.
**Please follow the instructions carefully. Read EVERY WORD.** **Please follow the instructions carefully. Read EVERY WORD.**
1. **Ensure that your version of Vim is _at least_ 7.4.143 _and_ that it has 1. **Ensure that your version of Vim is _at least_ 7.4.1578 _and_ that it has
support for Python 2 or Python 3 scripting**. support for Python 2 or Python 3 scripting**.
Inside Vim, type `:version`. Look at the first two to three lines of output; Inside Vim, type `:version`. Look at the first two to three lines of output;
@ -521,7 +521,7 @@ process.
If your version of Vim is not recent enough, you may need to [compile Vim If your version of Vim is not recent enough, you may need to [compile Vim
from source][vim-build] (don't worry, it's easy). from source][vim-build] (don't worry, it's easy).
After you have made sure that you have Vim 7.4.143+, type the following in After you have made sure that you have Vim 7.4.1578+, type the following in
Vim: `:echo has('python') || has('python3')`. The output should be 1. If Vim: `:echo has('python') || has('python3')`. The output should be 1. If
it's 0, then get a version of Vim with Python support. it's 0, then get a version of Vim with Python support.
@ -1995,26 +1995,6 @@ Default: `1`
let g:ycm_open_loclist_on_ycm_diags = 1 let g:ycm_open_loclist_on_ycm_diags = 1
``` ```
### The `g:ycm_allow_changing_updatetime` option
When this option is set to `1`, YCM will change the `updatetime` Vim option to
`2000` (see `:h updatetime`). This may conflict with some other plugins you have
(but it's unlikely). The `updatetime` option is the number of milliseconds that
have to pass before Vim's `CursorHold` (see `:h CursorHold`) event fires. YCM
runs the completion engines' "file comprehension" systems in the background on
every such event; the identifier-based engine collects the identifiers whereas
the semantic engine compiles the file to build an AST.
The Vim default of `4000` for `updatetime` is a bit long, so YCM reduces
this. Set this option to `0` to force YCM to leave your `updatetime` setting
alone.
Default: `1`
```viml
let g:ycm_allow_changing_updatetime = 1
```
### The `g:ycm_complete_in_comments` option ### The `g:ycm_complete_in_comments` option
When this option is set to `1`, YCM will show the completion menu even when When this option is set to `1`, YCM will show the completion menu even when
@ -2838,19 +2818,8 @@ current file and simple prefix-based filtering.
### Why does YCM demand such a recent version of Vim? ### Why does YCM demand such a recent version of Vim?
During YCM's development several show-stopper bugs were encountered in Vim. YCM needs a version of Vim with the timers feature to achieve full
Those needed to be fixed upstream (and were). A few months after those bugs were asynchronicity. This feature is available since Vim 7.4.1578.
fixed, Vim trunk landed the `pyeval()` function which improved YCM performance
even more since less time was spent serializing and deserializing data between
Vim and the embedded Python interpreter. A few critical bugfixes for `pyeval()`
landed in Vim 7.3.584 (and a few commits before that), and given the current
availability of Vim 7.4.143, which features improved events for text change
detection, it has been chosen.
### I get annoying messages in Vim's status area when I type
If you're referring to the `User defined completion <bla bla> back at original`
and similar, then just update to Vim 7.4.314 (or later) and they'll go away.
### Nasty bugs happen if I have the `vim-autoclose` plugin installed ### Nasty bugs happen if I have the `vim-autoclose` plugin installed

View File

@ -26,6 +26,12 @@ let s:omnifunc_mode = 0
let s:old_cursor_position = [] let s:old_cursor_position = []
let s:cursor_moved = 0 let s:cursor_moved = 0
let s:previous_allowed_buffer_number = 0 let s:previous_allowed_buffer_number = 0
let s:pollers = {
\ 'file_parse_response': {
\ 'id': -1,
\ 'wait_milliseconds': 100
\ }
\ }
" When both versions are available, we prefer Python 3 over Python 2: " When both versions are available, we prefer Python 3 over Python 2:
@ -75,10 +81,6 @@ function! youcompleteme#Enable()
call s:SetUpSigns() call s:SetUpSigns()
call s:SetUpSyntaxHighlighting() call s:SetUpSyntaxHighlighting()
if g:ycm_allow_changing_updatetime && &updatetime > 2000
set ut=2000
endif
call youcompleteme#EnableCursorMovedAutocommands() call youcompleteme#EnableCursorMovedAutocommands()
augroup youcompleteme augroup youcompleteme
autocmd! autocmd!
@ -93,7 +95,6 @@ function! youcompleteme#Enable()
autocmd FileType * call s:OnFileTypeSet() autocmd FileType * call s:OnFileTypeSet()
autocmd BufEnter * call s:OnBufferEnter() autocmd BufEnter * call s:OnBufferEnter()
autocmd BufUnload * call s:OnBufferUnload() autocmd BufUnload * call s:OnBufferUnload()
autocmd CursorHold,CursorHoldI * call s:OnCursorHold()
autocmd InsertLeave * call s:OnInsertLeave() autocmd InsertLeave * call s:OnInsertLeave()
autocmd InsertEnter * call s:OnInsertEnter() autocmd InsertEnter * call s:OnInsertEnter()
autocmd VimLeave * call s:OnVimLeave() autocmd VimLeave * call s:OnVimLeave()
@ -114,6 +115,7 @@ function! youcompleteme#EnableCursorMovedAutocommands()
augroup ycmcompletemecursormove augroup ycmcompletemecursormove
autocmd! autocmd!
autocmd CursorMoved * call s:OnCursorMovedNormalMode() autocmd CursorMoved * call s:OnCursorMovedNormalMode()
autocmd TextChanged * call s:OnTextChangedNormalMode()
autocmd TextChangedI * call s:OnTextChangedInsertMode() autocmd TextChangedI * call s:OnTextChangedInsertMode()
augroup END augroup END
endfunction endfunction
@ -373,10 +375,8 @@ function! s:SetUpCpoptions()
set cpoptions+=B set cpoptions+=B
" This prevents the display of "Pattern not found" & similar messages during " This prevents the display of "Pattern not found" & similar messages during
" completion. This is only available since Vim 7.4.314 " completion.
if s:Pyeval( 'vimsupport.VimVersionAtLeast("7.4.314")' ) set shortmess+=c
set shortmess+=c
endif
endfunction endfunction
@ -457,16 +457,6 @@ function! s:OnBufferUnload()
endfunction endfunction
function! s:OnCursorHold()
if !s:AllowedToCompleteInCurrentBuffer()
return
endif
call s:SetUpCompleteopt()
call s:OnFileReadyToParse()
endfunction
function! s:OnFileReadyToParse( ... ) function! s:OnFileReadyToParse( ... )
" Accepts an optional parameter that is either 0 or 1. If 1, send a " Accepts an optional parameter that is either 0 or 1. If 1, send a
" FileReadyToParse event notification, whether the buffer has changed or not; " FileReadyToParse event notification, whether the buffer has changed or not;
@ -486,21 +476,33 @@ function! s:OnFileReadyToParse( ... )
return return
endif endif
" Order is important here; we need to extract any information before
" reparsing the file again. If we sent the new parse request first, then
" the response would always be pending when we called
" HandleFileParseRequest.
exec s:python_command "ycm_state.HandleFileParseRequest()"
" We only want to send a new FileReadyToParse event notification if the buffer " We only want to send a new FileReadyToParse event notification if the buffer
" has changed since the last time we sent one, or if forced. " has changed since the last time we sent one, or if forced.
if force_parsing || b:changedtick != get( b:, 'ycm_changedtick', -1 ) if force_parsing || b:changedtick != get( b:, 'ycm_changedtick', -1 )
exec s:python_command "ycm_state.OnFileReadyToParse()" exec s:python_command "ycm_state.OnFileReadyToParse()"
call timer_stop( s:pollers.file_parse_response.id )
let s:pollers.file_parse_response.id = timer_start(
\ s:pollers.file_parse_response.wait_milliseconds,
\ function( 's:PollFileParseResponse' ) )
let b:ycm_changedtick = b:changedtick let b:ycm_changedtick = b:changedtick
endif endif
endfunction endfunction
function! s:PollFileParseResponse( ... )
if !s:Pyeval( "ycm_state.FileParseRequestReady()" )
let s:pollers.file_parse_response.id = timer_start(
\ s:pollers.file_parse_response.wait_milliseconds,
\ function( 's:PollFileParseResponse' ) )
return
endif
exec s:python_command "ycm_state.HandleFileParseRequest()"
endfunction
function! s:SetCompleteFunc() function! s:SetCompleteFunc()
let &completefunc = 'youcompleteme#Complete' let &completefunc = 'youcompleteme#Complete'
let &l:completefunc = 'youcompleteme#Complete' let &l:completefunc = 'youcompleteme#Complete'
@ -522,6 +524,24 @@ function! s:SetOmnicompleteFunc()
endfunction endfunction
function! s:OnCursorMovedNormalMode()
if !s:AllowedToCompleteInCurrentBuffer()
return
endif
exec s:python_command "ycm_state.OnCursorMoved()"
endfunction
function! s:OnTextChangedNormalMode()
if !s:AllowedToCompleteInCurrentBuffer()
return
endif
call s:OnFileReadyToParse()
endfunction
function! s:OnTextChangedInsertMode() function! s:OnTextChangedInsertMode()
if !s:AllowedToCompleteInCurrentBuffer() if !s:AllowedToCompleteInCurrentBuffer()
return return
@ -548,16 +568,6 @@ function! s:OnTextChangedInsertMode()
endfunction endfunction
function! s:OnCursorMovedNormalMode()
if !s:AllowedToCompleteInCurrentBuffer()
return
endif
call s:OnFileReadyToParse()
exec s:python_command "ycm_state.OnCursorMoved()"
endfunction
function! s:OnInsertLeave() function! s:OnInsertLeave()
if !s:AllowedToCompleteInCurrentBuffer() if !s:AllowedToCompleteInCurrentBuffer()
return return

View File

@ -96,38 +96,37 @@ Contents ~
13. The |g:ycm_filter_diagnostics| option 13. The |g:ycm_filter_diagnostics| option
14. The |g:ycm_always_populate_location_list| option 14. The |g:ycm_always_populate_location_list| option
15. The |g:ycm_open_loclist_on_ycm_diags| option 15. The |g:ycm_open_loclist_on_ycm_diags| option
16. The |g:ycm_allow_changing_updatetime| option 16. The |g:ycm_complete_in_comments| option
17. The |g:ycm_complete_in_comments| option 17. The |g:ycm_complete_in_strings| option
18. The |g:ycm_complete_in_strings| option 18. The |g:ycm_collect_identifiers_from_comments_and_strings| option
19. The |g:ycm_collect_identifiers_from_comments_and_strings| option 19. The |g:ycm_collect_identifiers_from_tags_files| option
20. The |g:ycm_collect_identifiers_from_tags_files| option 20. The |g:ycm_seed_identifiers_with_syntax| option
21. The |g:ycm_seed_identifiers_with_syntax| option 21. The |g:ycm_extra_conf_vim_data| option
22. The |g:ycm_extra_conf_vim_data| option 22. The |g:ycm_server_python_interpreter| option
23. The |g:ycm_server_python_interpreter| option 23. The |g:ycm_keep_logfiles| option
24. The |g:ycm_keep_logfiles| option 24. The |g:ycm_log_level| option
25. The |g:ycm_log_level| option 25. The |g:ycm_auto_start_csharp_server| option
26. The |g:ycm_auto_start_csharp_server| option 26. The |g:ycm_auto_stop_csharp_server| option
27. The |g:ycm_auto_stop_csharp_server| option 27. The |g:ycm_csharp_server_port| option
28. The |g:ycm_csharp_server_port| option 28. The |g:ycm_csharp_insert_namespace_expr| option
29. The |g:ycm_csharp_insert_namespace_expr| option 29. The |g:ycm_add_preview_to_completeopt| option
30. The |g:ycm_add_preview_to_completeopt| option 30. The |g:ycm_autoclose_preview_window_after_completion| option
31. The |g:ycm_autoclose_preview_window_after_completion| option 31. The |g:ycm_autoclose_preview_window_after_insertion| option
32. The |g:ycm_autoclose_preview_window_after_insertion| option 32. The |g:ycm_max_diagnostics_to_display| option
33. The |g:ycm_max_diagnostics_to_display| option 33. The |g:ycm_key_list_select_completion| option
34. The |g:ycm_key_list_select_completion| option 34. The |g:ycm_key_list_previous_completion| option
35. The |g:ycm_key_list_previous_completion| option 35. The |g:ycm_key_invoke_completion| option
36. The |g:ycm_key_invoke_completion| option 36. The |g:ycm_key_detailed_diagnostics| option
37. The |g:ycm_key_detailed_diagnostics| option 37. The |g:ycm_global_ycm_extra_conf| option
38. The |g:ycm_global_ycm_extra_conf| option 38. The |g:ycm_confirm_extra_conf| option
39. The |g:ycm_confirm_extra_conf| option 39. The |g:ycm_extra_conf_globlist| option
40. The |g:ycm_extra_conf_globlist| option 40. The |g:ycm_filepath_completion_use_working_dir| option
41. The |g:ycm_filepath_completion_use_working_dir| option 41. The |g:ycm_semantic_triggers| option
42. The |g:ycm_semantic_triggers| option 42. The |g:ycm_cache_omnifunc| option
43. The |g:ycm_cache_omnifunc| option 43. The |g:ycm_use_ultisnips_completer| option
44. The |g:ycm_use_ultisnips_completer| option 44. The |g:ycm_goto_buffer_command| option
45. The |g:ycm_goto_buffer_command| option 45. The |g:ycm_disable_for_files_larger_than_kb| option
46. The |g:ycm_disable_for_files_larger_than_kb| option 46. The |g:ycm_python_binary_path| option
47. The |g:ycm_python_binary_path| option
11. FAQ |youcompleteme-faq| 11. FAQ |youcompleteme-faq|
1. I used to be able to 'import vim' in '.ycm_extra_conf.py', but now can't |youcompleteme-i-used-to-be-able-to-import-vim-in-.ycm_extra_conf.py-but-now-cant| 1. I used to be able to 'import vim' in '.ycm_extra_conf.py', but now can't |youcompleteme-i-used-to-be-able-to-import-vim-in-.ycm_extra_conf.py-but-now-cant|
2. I get 'ImportError' exceptions that mention 'PyInit_ycm_core' or 'initycm_core' |youcompleteme-i-get-importerror-exceptions-that-mention-pyinit_ycm_core-or-initycm_core| 2. I get 'ImportError' exceptions that mention 'PyInit_ycm_core' or 'initycm_core' |youcompleteme-i-get-importerror-exceptions-that-mention-pyinit_ycm_core-or-initycm_core|
@ -151,23 +150,22 @@ Contents ~
20. Snippets added with ':UltiSnipsAddFiletypes' do not appear in the popup menu |youcompleteme-snippets-added-with-ultisnipsaddfiletypes-do-not-appear-in-popup-menu| 20. Snippets added with ':UltiSnipsAddFiletypes' do not appear in the popup menu |youcompleteme-snippets-added-with-ultisnipsaddfiletypes-do-not-appear-in-popup-menu|
21. Why isn't YCM just written in plain VimScript, FFS? |youcompleteme-why-isnt-ycm-just-written-in-plain-vimscript-ffs| 21. Why isn't YCM just written in plain VimScript, FFS? |youcompleteme-why-isnt-ycm-just-written-in-plain-vimscript-ffs|
22. Why does YCM demand such a recent version of Vim? |youcompleteme-why-does-ycm-demand-such-recent-version-of-vim| 22. Why does YCM demand such a recent version of Vim? |youcompleteme-why-does-ycm-demand-such-recent-version-of-vim|
23. I get annoying messages in Vim's status area when I type |youcompleteme-i-get-annoying-messages-in-vims-status-area-when-i-type| 23. Nasty bugs happen if I have the 'vim-autoclose' plugin installed |youcompleteme-nasty-bugs-happen-if-i-have-vim-autoclose-plugin-installed|
24. Nasty bugs happen if I have the 'vim-autoclose' plugin installed |youcompleteme-nasty-bugs-happen-if-i-have-vim-autoclose-plugin-installed| 24. Is there some sort of YCM mailing list? I have questions |youcompleteme-is-there-sort-of-ycm-mailing-list-i-have-questions|
25. Is there some sort of YCM mailing list? I have questions |youcompleteme-is-there-sort-of-ycm-mailing-list-i-have-questions| 25. I get an internal compiler error when installing |youcompleteme-i-get-an-internal-compiler-error-when-installing|
26. I get an internal compiler error when installing |youcompleteme-i-get-an-internal-compiler-error-when-installing| 26. I get weird errors when I press 'Ctrl-C' in Vim |youcompleteme-i-get-weird-errors-when-i-press-ctrl-c-in-vim|
27. I get weird errors when I press 'Ctrl-C' in Vim |youcompleteme-i-get-weird-errors-when-i-press-ctrl-c-in-vim| 27. Why did YCM stop using Syntastic for diagnostics display? |youcompleteme-why-did-ycm-stop-using-syntastic-for-diagnostics-display|
28. Why did YCM stop using Syntastic for diagnostics display? |youcompleteme-why-did-ycm-stop-using-syntastic-for-diagnostics-display| 28. Completion doesn't work with the C++ standard library headers |youcompleteme-completion-doesnt-work-with-c-standard-library-headers|
29. Completion doesn't work with the C++ standard library headers |youcompleteme-completion-doesnt-work-with-c-standard-library-headers| 29. When I open a JavaScript file, I get an annoying warning about '.tern-project'
30. When I open a JavaScript file, I get an annoying warning about '.tern-project'
file |youcompleteme-when-i-open-javascript-file-i-get-an-annoying-warning-about-.tern-project-file| file |youcompleteme-when-i-open-javascript-file-i-get-an-annoying-warning-about-.tern-project-file|
31. When I start vim I get a runtime error saying 'R6034 An application has made an 30. When I start vim I get a runtime error saying 'R6034 An application has made an
attempt to load the C runtime library incorrectly.' |youcompleteme-when-i-start-vim-i-get-runtime-error-saying-r6034-an-application-has-made-an-attempt-to-load-c-runtime-library-incorrectly.| attempt to load the C runtime library incorrectly.' |youcompleteme-when-i-start-vim-i-get-runtime-error-saying-r6034-an-application-has-made-an-attempt-to-load-c-runtime-library-incorrectly.|
32. I hear that YCM only supports Python 2, is that true? |youcompleteme-i-hear-that-ycm-only-supports-python-2-is-that-true| 31. I hear that YCM only supports Python 2, is that true? |youcompleteme-i-hear-that-ycm-only-supports-python-2-is-that-true|
33. On Windows I get "E887: Sorry, this command is disabled, the Python's site 32. On Windows I get "E887: Sorry, this command is disabled, the Python's site
module could not be loaded" |youcompleteme-on-windows-i-get-e887-sorry-this-command-is-disabled-pythons-site-module-could-not-be-loaded| module could not be loaded" |youcompleteme-on-windows-i-get-e887-sorry-this-command-is-disabled-pythons-site-module-could-not-be-loaded|
34. I can't complete python packages in a virtual environment. |youcompleteme-i-cant-complete-python-packages-in-virtual-environment.| 33. I can't complete python packages in a virtual environment. |youcompleteme-i-cant-complete-python-packages-in-virtual-environment.|
35. I want to defer loading of YouCompleteMe until after Vim finishes booting |i-want-to-defer-loading-of-youcompleteme-until-after-vim-finishes-booting| 34. I want to defer loading of YouCompleteMe until after Vim finishes booting |i-want-to-defer-loading-of-youcompleteme-until-after-vim-finishes-booting|
36. YCM does not shut down when I quit Vim |youcompleteme-ycm-does-not-shut-down-when-i-quit-vim| 35. YCM does not shut down when I quit Vim |youcompleteme-ycm-does-not-shut-down-when-i-quit-vim|
12. Contributor Code of Conduct |youcompleteme-contributor-code-of-conduct| 12. Contributor Code of Conduct |youcompleteme-contributor-code-of-conduct|
13. Contact |youcompleteme-contact| 13. Contact |youcompleteme-contact|
14. License |youcompleteme-license| 14. License |youcompleteme-license|
@ -413,7 +411,7 @@ These instructions (using 'install.py') are the quickest way to install
YouCompleteMe, however they may not work for everyone. If the following YouCompleteMe, however they may not work for everyone. If the following
instructions don't work for you, check out the full installation guide. instructions don't work for you, check out the full installation guide.
Make sure you have Vim 7.4.143 with Python 2 or Python 3 support. Ubuntu 14.10 Make sure you have Vim 7.4.1578 with Python 2 or Python 3 support. Ubuntu 16.04
and later have a Vim that's recent enough. You can see the version of Vim and later have a Vim that's recent enough. You can see the version of Vim
installed by running 'vim --version'. If the version is too old, you may need installed by running 'vim --version'. If the version is too old, you may need
to compile Vim from source [30] (don't worry, it's easy). to compile Vim from source [30] (don't worry, it's easy).
@ -484,10 +482,10 @@ These instructions (using 'install.py') are the quickest way to install
YouCompleteMe, however they may not work for everyone. If the following YouCompleteMe, however they may not work for everyone. If the following
instructions don't work for you, check out the full installation guide. instructions don't work for you, check out the full installation guide.
Make sure you have Vim 7.4.143 with Python 2 or Python 3 support. Fedora 21 and Make sure you have Vim 7.4.1578 with Python 2 or Python 3 support. Fedora 21
later have a Vim that's recent enough. You can see the version of Vim installed and later have a Vim that's recent enough. You can see the version of Vim
by running 'vim --version'. If the version is too old, you may need to compile installed by running 'vim --version'. If the version is too old, you may need
Vim from source [30] (don't worry, it's easy). to compile Vim from source [30] (don't worry, it's easy).
Install YouCompleteMe with Vundle [23]. Install YouCompleteMe with Vundle [23].
@ -558,7 +556,7 @@ instructions don't work for you, check out the full installation guide.
**Important:** we assume that you are using the 'cmd.exe' command prompt and **Important:** we assume that you are using the 'cmd.exe' command prompt and
that you know how to add an executable to the PATH environment variable. that you know how to add an executable to the PATH environment variable.
Make sure you have at least Vim 7.4.143 with Python 2 or Python 3 support. You Make sure you have at least Vim 7.4.1578 with Python 2 or Python 3 support. You
can check the version and which Python is supported by typing ':version' inside can check the version and which Python is supported by typing ':version' inside
Vim. Look at the features included: '+python/dyn' for Python 2 and Vim. Look at the features included: '+python/dyn' for Python 2 and
'+python3/dyn' for Python 3. Take note of the Vim architecture, i.e. 32 or '+python3/dyn' for Python 3. Take note of the Vim architecture, i.e. 32 or
@ -643,7 +641,7 @@ instructions don't work for you, check out the full installation guide.
**NOTE:** OpenBSD / FreeBSD are not officially supported platforms by YCM. **NOTE:** OpenBSD / FreeBSD are not officially supported platforms by YCM.
Make sure you have Vim 7.4.143 with Python 2 or Python 3 support. Make sure you have Vim 7.4.1578 with Python 2 or Python 3 support.
OpenBSD 5.5 and later have a Vim that's recent enough. You can see the version OpenBSD 5.5 and later have a Vim that's recent enough. You can see the version
of Vim installed by running 'vim --version'. of Vim installed by running 'vim --version'.
@ -724,8 +722,8 @@ will notify you to recompile it. You should then rerun the install process.
**Please follow the instructions carefully. Read EVERY WORD.** **Please follow the instructions carefully. Read EVERY WORD.**
1. **Ensure that your version of Vim is _at least_ 7.4.143 _and_ that it has 1. **Ensure that your version of Vim is _at least_ 7.4.1578 _and_ that it
support for Python 2 or Python 3 scripting**. has support for Python 2 or Python 3 scripting**.
Inside Vim, type ':version'. Look at the first two to three lines of Inside Vim, type ':version'. Look at the first two to three lines of
output; it should say 'Vi IMproved X.Y', where X.Y is the major version output; it should say 'Vi IMproved X.Y', where X.Y is the major version
@ -736,7 +734,7 @@ will notify you to recompile it. You should then rerun the install process.
If your version of Vim is not recent enough, you may need to compile Vim If your version of Vim is not recent enough, you may need to compile Vim
from source [30] (don't worry, it's easy). from source [30] (don't worry, it's easy).
After you have made sure that you have Vim 7.4.143+, type the following After you have made sure that you have Vim 7.4.1578+, type the following
in Vim: ":echo has('python') || has('python3')". The output should be 1. in Vim: ":echo has('python') || has('python3')". The output should be 1.
If it's 0, then get a version of Vim with Python support. If it's 0, then get a version of Vim with Python support.
@ -2275,24 +2273,6 @@ Default: '1'
let g:ycm_open_loclist_on_ycm_diags = 1 let g:ycm_open_loclist_on_ycm_diags = 1
< <
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
The *g:ycm_allow_changing_updatetime* option
When this option is set to '1', YCM will change the 'updatetime' Vim option to
'2000' (see ':h updatetime'). This may conflict with some other plugins you
have (but it's unlikely). The 'updatetime' option is the number of milliseconds
that have to pass before Vim's 'CursorHold' (see ':h CursorHold') event fires.
YCM runs the completion engines' "file comprehension" systems in the background
on every such event; the identifier-based engine collects the identifiers
whereas the semantic engine compiles the file to build an AST.
The Vim default of '4000' for 'updatetime' is a bit long, so YCM reduces this.
Set this option to '0' to force YCM to leave your 'updatetime' setting alone.
Default: '1'
>
let g:ycm_allow_changing_updatetime = 1
<
-------------------------------------------------------------------------------
The *g:ycm_complete_in_comments* option The *g:ycm_complete_in_comments* option
When this option is set to '1', YCM will show the completion menu even when When this option is set to '1', YCM will show the completion menu even when
@ -3102,21 +3082,8 @@ in the current file and simple prefix-based filtering.
*youcompleteme-why-does-ycm-demand-such-recent-version-of-vim* *youcompleteme-why-does-ycm-demand-such-recent-version-of-vim*
Why does YCM demand such a recent version of Vim? ~ Why does YCM demand such a recent version of Vim? ~
During YCM's development several show-stopper bugs were encountered in Vim. YCM needs a version of Vim with the timers feature to achieve full
Those needed to be fixed upstream (and were). A few months after those bugs asynchronicity. This feature is available since Vim 7.4.1578.
were fixed, Vim trunk landed the 'pyeval()' function which improved YCM
performance even more since less time was spent serializing and deserializing
data between Vim and the embedded Python interpreter. A few critical bugfixes
for 'pyeval()' landed in Vim 7.3.584 (and a few commits before that), and given
the current availability of Vim 7.4.143, which features improved events for
text change detection, it has been chosen.
-------------------------------------------------------------------------------
*youcompleteme-i-get-annoying-messages-in-vims-status-area-when-i-type*
I get annoying messages in Vim's status area when I type ~
If you're referring to the 'User defined completion <bla bla> back at original'
and similar, then just update to Vim 7.4.314 (or later) and they'll go away.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
*youcompleteme-nasty-bugs-happen-if-i-have-vim-autoclose-plugin-installed* *youcompleteme-nasty-bugs-happen-if-i-have-vim-autoclose-plugin-installed*

View File

@ -27,9 +27,16 @@ endfunction
if exists( "g:loaded_youcompleteme" ) if exists( "g:loaded_youcompleteme" )
call s:restore_cpo() call s:restore_cpo()
finish finish
elseif v:version < 704 || (v:version == 704 && !has('patch143')) elseif v:version < 704 || (v:version == 704 && !has( 'patch1578' ))
echohl WarningMsg | echohl WarningMsg |
\ echomsg "YouCompleteMe unavailable: requires Vim 7.4.143+" | \ echomsg "YouCompleteMe unavailable: requires Vim 7.4.1578+" |
\ echohl None
call s:restore_cpo()
finish
elseif !has( 'timers' )
echohl WarningMsg |
\ echomsg "YouCompleteMe unavailable: requires Vim compiled with " .
\ "the timers feature" |
\ echohl None \ echohl None
call s:restore_cpo() call s:restore_cpo()
finish finish