Merge branch 'master' into fork_master

This commit is contained in:
Andrey Pikas 2017-03-30 20:26:11 +03:00
commit ebc3856121
39 changed files with 356 additions and 264 deletions

View File

@ -376,8 +376,7 @@ _Windows x86-64_ for a 64-bit Vim. We recommend installing Python 3.
- [CMake][cmake-download]. Add CMake executable to the PATH environment
variable.
- [Visual Studio][visual-studio-download]. Download the community edition.
During setup, choose _Custom_ as the installation type and select the _Visual
C++_ component.
During setup, select _Desktop development with C++_ in _Workloads_.
- [7-zip][7z-download]. Required to build YCM with semantic support for
C-family languages.
@ -412,8 +411,8 @@ install with all language features, ensure `msbuild`, `go`, `tsserver`, `node`,
python install.py --all
You can specify the Microsoft Visual C++ (MSVC) version using the `--msvc`
option. YCM officially supports MSVC 11 (Visual Studio 2012), 12 (2013), and 14
(2015).
option. YCM officially supports MSVC 12 (Visual Studio 2013), 14 (2015), and 15
(2017).
That's it. You're done. Refer to the _User Guide_ section on how to use YCM.
Don't forget that if you want the C-family semantic completion engine to work,
@ -573,7 +572,7 @@ process.
Python 3][python-win-download]. Pick the version corresponding to your Vim
architecture. You will also need Microsoft Visual C++ (MSVC) to build YCM.
You can obtain it by installing [Visual Studio][visual-studio-download].
MSVC 11 (Visual Studio 2012), 12 (2013), and 14 (2015) are officially
MSVC 12 (Visual Studio 2013), 14 (2015), and 15 (2017) are officially
supported.
Here we'll assume you installed YCM with Vundle. That means that the
@ -730,6 +729,7 @@ Quick Feature Summary
### TypeScript
* Semantic auto-completion
* Real-time diagnostic display
* Renaming symbols (`RefactorRename <new name>`)
* Go to definition, find references (`GoToDefinition`, `GoToReferences`)
* Semantic type information for identifiers (`GetType`)
@ -1132,9 +1132,10 @@ Completer API.
### Diagnostic Display
YCM will display diagnostic notifications for C-family and C# languages if you
compiled YCM with Clang and Omnisharp support, respectively. Since YCM continuously
recompiles your file as you type, you'll get notified of errors and warnings
in your file as fast as possible.
compiled YCM with Clang and Omnisharp support, respectively. Diagnostics will
also be displayed for TypeScript. Since YCM continuously recompiles your file as
you type, you'll get notified of errors and warnings in your file as fast as
possible.
Here are the various pieces of the diagnostic UI:
@ -2563,11 +2564,6 @@ But fear not, you should be able to tweak your extra conf files to continue
working by using the `g:ycm_extra_conf_vim_data` option. See the docs on that
option for details.
### On very rare occasions Vim crashes when I tab through the completion menu
That's a very rare Vim bug most users never encounter. It's fixed in Vim
7.4.72. Update to that version (or above) to resolve the issue.
### I get `ImportError` exceptions that mention `PyInit_ycm_core` or `initycm_core`
These errors are caused by building the YCM native libraries for Python 2 and
@ -3092,7 +3088,7 @@ This software is licensed under the [GPL v3 license][gpl].
[TSServer]: https://github.com/Microsoft/TypeScript/tree/master/src/server
[vim-win-download]: https://bintray.com/micbou/generic/vim
[python-win-download]: https://www.python.org/downloads/windows/
[visual-studio-download]: https://www.visualstudio.com/products/free-developer-offers-vs.aspx
[visual-studio-download]: https://www.visualstudio.com/downloads/
[7z-download]: http://www.7-zip.org/download.html
[mono-install-osx]: http://www.mono-project.com/docs/getting-started/install/mac/
[mono-install-ubuntu]: http://www.mono-project.com/docs/getting-started/install/linux/#debian-ubuntu-and-derivatives

View File

@ -1,4 +1,5 @@
version: '{build}'
image: Visual Studio 2017
environment:
COVERAGE: true
matrix:

View File

@ -90,8 +90,7 @@ function! youcompleteme#Enable()
" We also need to trigger buf init code on the FileType event because when
" the user does :enew and then :set ft=something, we need to run buf init
" code again.
autocmd BufRead,FileType * call s:OnBufferRead()
autocmd BufEnter * call s:OnBufferEnter()
autocmd BufRead,BufEnter,FileType * call s:OnBufferVisit()
autocmd BufUnload * call s:OnBufferUnload()
autocmd CursorHold,CursorHoldI * call s:OnCursorHold()
autocmd InsertLeave * call s:OnInsertLeave()
@ -101,11 +100,9 @@ function! youcompleteme#Enable()
augroup END
" BufRead/FileType events are not triggered for the first loaded file.
" However, we don't directly call the s:OnBufferRead function because it would
" send requests that can't succeed as the server is not ready yet and would
" slow down startup.
call s:DisableOnLargeFile( expand( '%' ) )
" However, we don't directly call the s:OnBufferVisit function because it
" would send requests that can't succeed as the server is not ready yet and
" would slow down startup.
if s:AllowedToCompleteInCurrentBuffer()
call s:SetCompleteFunc()
endif
@ -313,6 +310,23 @@ function! s:TurnOffSyntasticForCFamily()
endfunction
function! s:DisableOnLargeFile( buffer )
if exists( 'b:ycm_largefile' )
return b:ycm_largefile
endif
let threshold = g:ycm_disable_for_files_larger_than_kb * 1024
let b:ycm_largefile =
\ threshold > 0 && getfsize( expand( a:buffer ) ) > threshold
if b:ycm_largefile
exec s:python_command "vimsupport.PostVimMessage(" .
\ "'YouCompleteMe is disabled in this buffer; " .
\ "the file exceeded the max size (see YCM options).' )"
endif
return b:ycm_largefile
endfunction
function! s:AllowedToCompleteInBuffer( buffer )
let buffer_filetype = getbufvar( a:buffer, '&filetype' )
@ -322,7 +336,7 @@ function! s:AllowedToCompleteInBuffer( buffer )
return 0
endif
if exists( 'b:ycm_largefile' )
if s:DisableOnLargeFile( a:buffer )
return 0
endif
@ -401,22 +415,6 @@ function! s:SetUpYcmChangedTick()
endfunction
function! s:DisableOnLargeFile( filename )
if exists( 'b:ycm_largefile' )
return
endif
let threshold = g:ycm_disable_for_files_larger_than_kb * 1024
if threshold > 0 && getfsize( a:filename ) > threshold
exec s:python_command "vimsupport.PostVimMessage(" .
\ "'YouCompleteMe is disabled in this buffer; " .
\ "the file exceeded the max size (see YCM options).' )"
let b:ycm_largefile = 1
endif
endfunction
function! s:OnVimLeave()
exec s:python_command "ycm_state.OnVimLeave()"
endfunction
@ -427,15 +425,13 @@ function! s:OnCompleteDone()
endfunction
function! s:OnBufferRead()
function! s:OnBufferVisit()
" We need to do this even when we are not allowed to complete in the current
" buffer because we might be allowed to complete in the future! The canonical
" example is creating a new buffer with :enew and then setting a filetype.
call s:SetUpYcmChangedTick()
call s:DisableOnLargeFile( expand( '<afile>:p' ) )
if !s:AllowedToCompleteInCurrentBuffer()
if !s:VisitedBufferRequiresReparse()
return
endif
@ -448,16 +444,6 @@ function! s:OnBufferRead()
endfunction
function! s:OnBufferEnter()
if !s:VisitedBufferRequiresReparse()
return
endif
exec s:python_command "ycm_state.OnBufferVisit()"
call s:OnFileReadyToParse()
endfunction
function! s:OnBufferUnload()
" Expanding <abuf> returns the unloaded buffer number as a string but we want
" it as a true number for the getbufvar function.

View File

@ -130,44 +130,43 @@ Contents ~
47. The |g:ycm_python_binary_path| option
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|
2. On very rare occasions Vim crashes when I tab through the completion menu |youcompleteme-on-very-rare-occasions-vim-crashes-when-i-tab-through-completion-menu|
3. 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|
4. I get a linker warning regarding 'libpython' on Mac when compiling YCM |youcompleteme-i-get-linker-warning-regarding-libpython-on-mac-when-compiling-ycm|
5. I get a weird window at the top of my file when I use the semantic engine |youcompleteme-i-get-weird-window-at-top-of-my-file-when-i-use-semantic-engine|
6. It appears that YCM is not working |youcompleteme-it-appears-that-ycm-is-not-working|
7. Sometimes it takes much longer to get semantic completions than normal |youcompleteme-sometimes-it-takes-much-longer-to-get-semantic-completions-than-normal|
8. YCM auto-inserts completion strings I don't want! |youcompleteme-ycm-auto-inserts-completion-strings-i-dont-want|
9. I get a 'E227: mapping already exists for <blah>' error when I start Vim |youcompleteme-i-get-e227-mapping-already-exists-for-blah-error-when-i-start-vim|
10. I get "'GLIBC_2.XX' not found (required by libclang.so)" when starting Vim |youcompleteme-i-get-glibc_2.xx-not-found-when-starting-vim|
11. I'm trying to use a Homebrew Vim with YCM and I'm getting segfaults |youcompleteme-im-trying-to-use-homebrew-vim-with-ycm-im-getting-segfaults|
12. I have a Homebrew Python and/or MacVim; can't compile/SIGABRT when starting |youcompleteme-i-have-homebrew-python-and-or-macvim-cant-compile-sigabrt-when-starting|
13. I get 'LONG_BIT definition appears wrong for platform' when compiling |youcompleteme-i-get-long_bit-definition-appears-wrong-for-platform-when-compiling|
14. I get 'libpython2.7.a [...] relocation R_X86_64_32' when compiling |youcompleteme-i-get-libpython2.7.a-...-relocation-r_x86_64_32-when-compiling|
15. I get 'Vim: Caught deadly signal SEGV' on Vim startup |youcompleteme-i-get-vim-caught-deadly-signal-segv-on-vim-startup|
16. I get 'Fatal Python error: PyThreadState_Get: no current thread' on startup |youcompleteme-i-get-fatal-python-error-pythreadstate_get-no-current-thread-on-startup|
17. 'install.py' says python must be compiled with '--enable-framework'. Wat? |youcompleteme-install.py-says-python-must-be-compiled-with-enable-framework-.-wat|
18. YCM does not read identifiers from my tags files |youcompleteme-ycm-does-not-read-identifiers-from-my-tags-files|
19. 'CTRL-U' in insert mode does not work |youcompleteme-ctrl-u-in-insert-mode-does-not-work|
20. YCM conflicts with UltiSnips TAB key usage |youcompleteme-ycm-conflicts-with-ultisnips-tab-key-usage|
21. Snippets added with ':UltiSnipsAddFiletypes' do not appear in the popup menu |youcompleteme-snippets-added-with-ultisnipsaddfiletypes-do-not-appear-in-popup-menu|
22. Why isn't YCM just written in plain VimScript, FFS? |youcompleteme-why-isnt-ycm-just-written-in-plain-vimscript-ffs|
23. Why does YCM demand such a recent version of Vim? |youcompleteme-why-does-ycm-demand-such-recent-version-of-vim|
24. I get annoying messages in Vim's status area when I type |youcompleteme-i-get-annoying-messages-in-vims-status-area-when-i-type|
25. Nasty bugs happen if I have the 'vim-autoclose' plugin installed |youcompleteme-nasty-bugs-happen-if-i-have-vim-autoclose-plugin-installed|
26. Is there some sort of YCM mailing list? I have questions |youcompleteme-is-there-sort-of-ycm-mailing-list-i-have-questions|
27. I get an internal compiler error when installing |youcompleteme-i-get-an-internal-compiler-error-when-installing|
28. I get weird errors when I press 'Ctrl-C' in Vim |youcompleteme-i-get-weird-errors-when-i-press-ctrl-c-in-vim|
29. Why did YCM stop using Syntastic for diagnostics display? |youcompleteme-why-did-ycm-stop-using-syntastic-for-diagnostics-display|
30. Completion doesn't work with the C++ standard library headers |youcompleteme-completion-doesnt-work-with-c-standard-library-headers|
31. When I open a JavaScript file, I get an annoying warning about '.tern-project'
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|
3. I get a linker warning regarding 'libpython' on Mac when compiling YCM |youcompleteme-i-get-linker-warning-regarding-libpython-on-mac-when-compiling-ycm|
4. I get a weird window at the top of my file when I use the semantic engine |youcompleteme-i-get-weird-window-at-top-of-my-file-when-i-use-semantic-engine|
5. It appears that YCM is not working |youcompleteme-it-appears-that-ycm-is-not-working|
6. Sometimes it takes much longer to get semantic completions than normal |youcompleteme-sometimes-it-takes-much-longer-to-get-semantic-completions-than-normal|
7. YCM auto-inserts completion strings I don't want! |youcompleteme-ycm-auto-inserts-completion-strings-i-dont-want|
8. I get a 'E227: mapping already exists for <blah>' error when I start Vim |youcompleteme-i-get-e227-mapping-already-exists-for-blah-error-when-i-start-vim|
9. I get "'GLIBC_2.XX' not found (required by libclang.so)" when starting Vim |youcompleteme-i-get-glibc_2.xx-not-found-when-starting-vim|
10. I'm trying to use a Homebrew Vim with YCM and I'm getting segfaults |youcompleteme-im-trying-to-use-homebrew-vim-with-ycm-im-getting-segfaults|
11. I have a Homebrew Python and/or MacVim; can't compile/SIGABRT when starting |youcompleteme-i-have-homebrew-python-and-or-macvim-cant-compile-sigabrt-when-starting|
12. I get 'LONG_BIT definition appears wrong for platform' when compiling |youcompleteme-i-get-long_bit-definition-appears-wrong-for-platform-when-compiling|
13. I get 'libpython2.7.a [...] relocation R_X86_64_32' when compiling |youcompleteme-i-get-libpython2.7.a-...-relocation-r_x86_64_32-when-compiling|
14. I get 'Vim: Caught deadly signal SEGV' on Vim startup |youcompleteme-i-get-vim-caught-deadly-signal-segv-on-vim-startup|
15. I get 'Fatal Python error: PyThreadState_Get: no current thread' on startup |youcompleteme-i-get-fatal-python-error-pythreadstate_get-no-current-thread-on-startup|
16. 'install.py' says python must be compiled with '--enable-framework'. Wat? |youcompleteme-install.py-says-python-must-be-compiled-with-enable-framework-.-wat|
17. YCM does not read identifiers from my tags files |youcompleteme-ycm-does-not-read-identifiers-from-my-tags-files|
18. 'CTRL-U' in insert mode does not work |youcompleteme-ctrl-u-in-insert-mode-does-not-work|
19. YCM conflicts with UltiSnips TAB key usage |youcompleteme-ycm-conflicts-with-ultisnips-tab-key-usage|
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|
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|
24. Nasty bugs happen if I have the 'vim-autoclose' plugin installed |youcompleteme-nasty-bugs-happen-if-i-have-vim-autoclose-plugin-installed|
25. Is there some sort of YCM mailing list? I have questions |youcompleteme-is-there-sort-of-ycm-mailing-list-i-have-questions|
26. I get an internal compiler error when installing |youcompleteme-i-get-an-internal-compiler-error-when-installing|
27. I get weird errors when I press 'Ctrl-C' in Vim |youcompleteme-i-get-weird-errors-when-i-press-ctrl-c-in-vim|
28. Why did YCM stop using Syntastic for diagnostics display? |youcompleteme-why-did-ycm-stop-using-syntastic-for-diagnostics-display|
29. Completion doesn't work with the C++ standard library headers |youcompleteme-completion-doesnt-work-with-c-standard-library-headers|
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|
32. When I start vim I get a runtime error saying 'R6034 An application has made an
31. 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.|
33. I hear that YCM only supports Python 2, is that true? |youcompleteme-i-hear-that-ycm-only-supports-python-2-is-that-true|
34. On Windows I get "E887: Sorry, this command is disabled, the Python's site
32. 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
module could not be loaded" |youcompleteme-on-windows-i-get-e887-sorry-this-command-is-disabled-pythons-site-module-could-not-be-loaded|
35. I can't complete python packages in a virtual environment. |youcompleteme-i-cant-complete-python-packages-in-virtual-environment.|
36. 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 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|
12. Contributor Code of Conduct |youcompleteme-contributor-code-of-conduct|
13. Contact |youcompleteme-contact|
14. License |youcompleteme-license|
@ -424,12 +423,14 @@ Install YouCompleteMe with Vundle [23].
using Vundle and the ycm_core library APIs have changed (happens rarely), YCM
will notify you to recompile it. You should then rerun the install process.
Install development tools and CMake: 'sudo apt-get install build-essential
cmake'
Make sure you have Python headers installed: 'sudo apt-get install python-dev
python3-dev'.
Install development tools and CMake:
>
sudo apt-get install build-essential cmake
<
Make sure you have Python headers installed:
>
sudo apt-get install python-dev python3-dev
<
Compiling YCM **with** semantic support for C-family languages:
>
cd ~/.vim/bundle/YouCompleteMe
@ -493,12 +494,14 @@ Install YouCompleteMe with Vundle [23].
using Vundle and the ycm_core library APIs have changed (happens rarely), YCM
will notify you to recompile it. You should then rerun the install process.
Install development tools and CMake: 'sudo dnf install automake gcc gcc-c++
kernel-devel cmake'
Make sure you have Python headers installed: 'sudo dnf install python-devel
python3-devel'.
Install development tools and CMake:
>
sudo dnf install automake gcc gcc-c++ kernel-devel cmake
<
Make sure you have Python headers installed:
>
sudo dnf install python-devel python3-devel
<
Compiling YCM **with** semantic support for C-family languages:
>
cd ~/.vim/bundle/YouCompleteMe
@ -576,8 +579,8 @@ Download and install the following software:
- CMake [25]. Add CMake executable to the PATH environment variable.
- Visual Studio [35]. Download the community edition. During setup, choose
_Custom_ as the installation type and select the _Visual C++_ component.
- Visual Studio [35]. Download the community edition. During setup, select
_Desktop development with C++_ in _Workloads_.
- 7-zip [36]. Required to build YCM with semantic support for C-family
languages.
@ -617,8 +620,8 @@ install with all language features, ensure 'msbuild', 'go', 'tsserver', 'node',
python install.py --all
<
You can specify the Microsoft Visual C++ (MSVC) version using the '--msvc'
option. YCM officially supports MSVC 11 (Visual Studio 2012), 12 (2013), and 14
(2015).
option. YCM officially supports MSVC 12 (Visual Studio 2013), 14 (2015), and 15
(2017).
That's it. You're done. Refer to the _User Guide_ section on how to use YCM.
Don't forget that if you want the C-family semantic completion engine to work,
@ -782,8 +785,8 @@ will notify you to recompile it. You should then rerun the install process.
On Windows, you need to download and install Python 2 or Python 3 [34].
Pick the version corresponding to your Vim architecture. You will also
need Microsoft Visual C++ (MSVC) to build YCM. You can obtain it by
installing Visual Studio [35]. MSVC 11 (Visual Studio 2012), 12 (2013),
and 14 (2015) are officially supported.
installing Visual Studio [35]. MSVC 12 (Visual Studio 2013), 14 (2015),
and 15 (2017) are officially supported.
Here we'll assume you installed YCM with Vundle. That means that the top-
level YCM directory is in '~/.vim/bundle/YouCompleteMe'.
@ -954,6 +957,7 @@ Go ~
TypeScript ~
- Semantic auto-completion
- Real-time diagnostic display
- Renaming symbols ('RefactorRename <new name>')
- Go to definition, find references (|GoToDefinition|, |GoToReferences|)
- Semantic type information for identifiers (|GetType|)
@ -1389,9 +1393,10 @@ Completer API.
Diagnostic Display ~
YCM will display diagnostic notifications for C-family and C# languages if you
compiled YCM with Clang and Omnisharp support, respectively. Since YCM
continuously recompiles your file as you type, you'll get notified of errors
and warnings in your file as fast as possible.
compiled YCM with Clang and Omnisharp support, respectively. Diagnostics will
also be displayed for TypeScript. Since YCM continuously recompiles your file
as you type, you'll get notified of errors and warnings in your file as fast as
possible.
Here are the various pieces of the diagnostic UI:
@ -2797,13 +2802,6 @@ But fear not, you should be able to tweak your extra conf files to continue
working by using the |g:ycm_extra_conf_vim_data| option. See the docs on that
option for details.
-------------------------------------------------------------------------------
*youcompleteme-on-very-rare-occasions-vim-crashes-when-i-tab-through-completion-menu*
On very rare occasions Vim crashes when I tab through the completion menu ~
That's a very rare Vim bug most users never encounter. It's fixed in Vim
7.4.72. Update to that version (or above) to resolve the issue.
-------------------------------------------------------------------------------
*youcompleteme-i-get-importerror-exceptions-that-mention-pyinit_ycm_core-or-initycm_core*
I get 'ImportError' exceptions that mention 'PyInit_ycm_core' or ~
@ -3367,7 +3365,7 @@ References ~
[32] http://www.mono-project.com/docs/getting-started/install/linux/#centos-7-fedora-19-and-later-and-derivatives
[33] https://bintray.com/micbou/generic/vim
[34] https://www.python.org/downloads/windows/
[35] https://www.visualstudio.com/products/free-developer-offers-vs.aspx
[35] https://www.visualstudio.com/downloads/
[36] http://www.7-zip.org/download.html
[37] http://stackoverflow.com/questions/6319274/how-do-i-run-msbuild-from-the-command-line-using-windows-sdk-7-1
[38] https://github.com/tpope/vim-pathogen#pathogenvim

View File

@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from future.utils import iteritems

View File

@ -19,18 +19,16 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
import contextlib
import logging
import urllib.parse
import json
from future.utils import native
from base64 import b64decode, b64encode
from ycm import vimsupport
from ycmd.utils import ToBytes
from ycmd.utils import ToBytes, urljoin, urlparse
from ycmd.hmac_utils import CreateRequestHmac, CreateHmac, SecureBytesEqual
from ycmd.responses import ServerError, UnknownExtraConf
@ -120,7 +118,7 @@ class BaseRequest( object ):
headers = dict( _HEADERS )
headers[ _HMAC_HEADER ] = b64encode(
CreateRequestHmac( ToBytes( method ),
ToBytes( urllib.parse.urlparse( request_uri ).path ),
ToBytes( urlparse( request_uri ).path ),
request_body,
BaseRequest.hmac_secret ) )
return headers
@ -263,8 +261,7 @@ def _ValidateResponseObject( response ):
def _BuildUri( handler ):
return native( ToBytes( urllib.parse.urljoin( BaseRequest.server_location,
handler ) ) )
return native( ToBytes( urljoin( BaseRequest.server_location, handler ) ) )
def MakeServerException( data ):

View File

@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from ycm.client.base_request import ( BaseRequest, BuildRequestData,

View File

@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from ycm.client.base_request import ( BaseRequest, BuildRequestData,

View File

@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from ycmd.utils import ToUnicode

View File

@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from ycm.client.base_request import ( BaseRequest, BuildRequestData,

View File

@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from ycm.client.base_request import ( BaseRequest, BuildRequestData,

View File

@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from ycm.client.completion_request import CompletionRequest

View File

@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from ycm.client.base_request import BaseRequest, HandleServerException

View File

@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
import time

View File

@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from future.utils import iterkeys, iteritems

View File

@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from future.utils import itervalues, iteritems
@ -109,8 +108,9 @@ class DiagnosticInterface( object ):
self._diag_message_needs_clearing = False
return
text = diags[ 0 ][ 'text' ]
if diags[ 0 ].get( 'fixit_available', False ):
first_diag = diags[ 0 ]
text = first_diag[ 'text' ]
if first_diag.get( 'fixit_available', False ):
text += ' (FixIt)'
vimsupport.PostVimMessage( text, warning = False, truncate = True )
@ -133,7 +133,8 @@ def _UpdateSquiggles( buffer_number_to_line_to_diags ):
line_to_diags = buffer_number_to_line_to_diags[ vim.current.buffer.number ]
for diags in itervalues( line_to_diags ):
for diag in diags:
# Insert squiggles in reverse order so that errors overlap warnings.
for diag in reversed( diags ):
location_extent = diag[ 'location_extent' ]
is_error = _DiagnosticIsError( diag )
@ -202,23 +203,23 @@ def _GetKeptAndNewSigns( placed_signs, buffer_number_to_line_to_diags,
continue
for line, diags in iteritems( line_to_diags ):
for diag in diags:
# Only one sign is visible by line.
first_diag = diags[ 0 ]
sign = _DiagSignPlacement( next_sign_id,
line,
buffer_number,
_DiagnosticIsError( diag ) )
_DiagnosticIsError( first_diag ) )
if sign not in placed_signs:
new_signs += [ sign ]
new_signs.append( sign )
next_sign_id += 1
else:
# We use .index here because `sign` contains a new id, but
# we need the sign with the old id to unplace it later on.
# We won't be placing the new sign.
kept_signs += [ placed_signs[ placed_signs.index( sign ) ] ]
kept_signs.append( placed_signs[ placed_signs.index( sign ) ] )
return new_signs, kept_signs, next_sign_id
def _PlaceNewSigns( kept_signs, new_signs ):
placed_signs = kept_signs[:]
for sign in new_signs:
@ -248,10 +249,10 @@ def _ConvertDiagListToDict( diag_list ):
for line_to_diags in itervalues( buffer_to_line_to_diags ):
for diags in itervalues( line_to_diags ):
# We also want errors to be listed before warnings so that errors aren't
# hidden by the warnings; Vim won't place a sign oven an existing one.
diags.sort( key = lambda diag: ( diag[ 'location' ][ 'column_num' ],
diag[ 'kind' ] ) )
# We want errors to be listed before warnings so that errors aren't hidden
# by the warnings.
diags.sort( key = lambda diag: ( diag[ 'kind' ],
diag[ 'location' ][ 'column_num' ] ) )
return buffer_to_line_to_diags

View File

@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
import vim

View File

@ -1,4 +1,4 @@
# Copyright (C) 2015 YouCompleteMe contributors.
# Copyright (C) 2015-2017 YouCompleteMe contributors.
#
# This file is part of YouCompleteMe.
#
@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
import os
@ -35,7 +34,7 @@ DIR_OF_YCMD = os.path.join( DIR_OF_CURRENT_SCRIPT, '..', '..', 'third_party',
'ycmd' )
WIN_PYTHON_PATH = os.path.join( sys.exec_prefix, 'python.exe' )
PYTHON_BINARY_REGEX = re.compile(
r'python((2(\.[67])?)|(3(\.[3-9])?))?(.exe)?$' )
r'python((2(\.[67])?)|(3(\.[3-9])?))?(.exe)?$', re.IGNORECASE )
def Memoize( obj ):
@ -52,19 +51,20 @@ def Memoize( obj ):
@Memoize
def PathToPythonInterpreter():
# Not calling the Python interpreter to check its version as it significantly
# impacts startup time.
from ycmd import utils
python_interpreter = vim.eval( 'g:ycm_server_python_interpreter' )
if python_interpreter:
if IsPythonVersionCorrect( python_interpreter ):
if _EndsWithPython( python_interpreter ):
return python_interpreter
raise RuntimeError( "Path in 'g:ycm_server_python_interpreter' option "
"does not point to a valid Python 2.6+ or 3.3+." )
python_interpreter = _PathToPythonUsedDuringBuild()
if IsPythonVersionCorrect( python_interpreter ):
if _EndsWithPython( python_interpreter ):
return python_interpreter
# On UNIX platforms, we use sys.executable as the Python interpreter path.
@ -73,8 +73,7 @@ def PathToPythonInterpreter():
# interpreter path.
python_interpreter = ( WIN_PYTHON_PATH if utils.OnWindows() else
sys.executable )
if IsPythonVersionCorrect( python_interpreter ):
if _EndsWithPython( python_interpreter ):
return python_interpreter
# As a last resort, we search python in the PATH. We prefer Python 2 over 3
@ -85,8 +84,7 @@ def PathToPythonInterpreter():
python_interpreter = utils.PathToFirstExistingExecutable( [ 'python2',
'python',
'python3' ] )
if IsPythonVersionCorrect( python_interpreter ):
if python_interpreter:
return python_interpreter
raise RuntimeError( "Cannot find Python 2.6+ or 3.3+. You can set its path "
@ -105,34 +103,10 @@ def _PathToPythonUsedDuringBuild():
return None
def EndsWithPython( path ):
def _EndsWithPython( path ):
"""Check if given path ends with a python 2.6+ or 3.3+ name."""
return path and PYTHON_BINARY_REGEX.search( path ) is not None
def IsPythonVersionCorrect( path ):
"""Check if given path is the Python interpreter version 2.6+ or 3.3+."""
from ycmd import utils
if not EndsWithPython( path ):
return False
command = [ path,
# Disable site customize. Faster, and less likely to encounter
# issues with disconnected mounts (nfs, fuse, etc.)
'-S',
'-c',
"import sys;"
"major, minor = sys.version_info[ :2 ];"
"good_python = ( major == 2 and minor >= 6 ) "
"or ( major == 3 and minor >= 3 ) or major > 3;"
# If this looks weird, remember that:
# int( True ) == 1
# int( False ) == 0
"sys.exit( not good_python )" ]
return utils.SafePopen( command ).wait() == 0
def PathToServerScript():
return os.path.join( DIR_OF_YCMD, 'ycmd' )

View File

@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from future.utils import itervalues

View File

@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from ycm.tests.test_utils import MockVimModule

View File

@ -22,8 +22,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
import contextlib

View File

@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from ycm.tests.test_utils import ExtendedMock, MockVimModule

View File

@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from nose.tools import eq_

View File

@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from copy import deepcopy

View File

@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from mock import MagicMock

View File

@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from ycm.tests.test_utils import ( MockVimModule, MockVimBuffers, VimBuffer )

View File

@ -21,8 +21,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from ycm.tests.test_utils import ( CurrentWorkingDirectory, ExtendedMock,

View File

@ -19,8 +19,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from ycm.tests.test_utils import MockVimModule

View File

@ -21,8 +21,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from ycm.tests.test_utils import ( CurrentWorkingDirectory, ExtendedMock,
@ -49,8 +48,8 @@ def PresentDialog_Confirm_Call( message ):
def PlaceSign_Call( sign_id, line_num, buffer_num, is_error ):
sign_name = 'YcmError' if is_error else 'YcmWarning'
return call( 'sign place {0} line={1} name={2} buffer={3}'
.format( sign_id, line_num, sign_name, buffer_num ) )
return call( 'sign place {0} name={1} line={2} buffer={3}'
.format( sign_id, sign_name, line_num, buffer_num ) )
def UnplaceSign_Call( sign_id, buffer_num ):

View File

@ -21,11 +21,10 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from future.utils import PY2
from future.utils import PY2
from mock import patch, call
from nose.tools import eq_
from hamcrest import contains_string

View File

@ -1,4 +1,4 @@
# Copyright (C) 2016 YouCompleteMe contributors
# Copyright (C) 2016-2017 YouCompleteMe contributors
#
# This file is part of YouCompleteMe.
#
@ -19,23 +19,24 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from ycm.tests.test_utils import MockVimModule
MockVimModule()
from nose.tools import ok_
from ycm.paths import EndsWithPython
from ycm.paths import _EndsWithPython
def EndsWithPython_Good( path ):
ok_( EndsWithPython( path ) )
ok_( _EndsWithPython( path ),
'Path {0} does not end with a Python name.'.format( path ) )
def EndsWithPython_Bad( path ):
ok_( not EndsWithPython( path ) )
ok_( not _EndsWithPython( path ),
'Path {0} does end with a Python name.'.format( path ) )
def EndsWithPython_Python2Paths_test():
@ -44,14 +45,14 @@ def EndsWithPython_Python2Paths_test():
'python2',
'/usr/bin/python2.6',
'/home/user/.pyenv/shims/python2.7',
r'C:\Python26\python.exe'
r'C:\Python26\python.exe',
'/Contents/MacOS/Python'
]
for path in python_paths:
yield EndsWithPython_Good, path
def EndsWithPython_Python3Paths_test():
python_paths = [
'python3',

View File

@ -21,8 +21,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from ycm.tests.test_utils import MockVimModule

View File

@ -20,8 +20,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from ycm.tests.test_utils import MockVimModule

View File

@ -20,8 +20,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from mock import MagicMock, patch
@ -42,6 +41,9 @@ BWIPEOUT_REGEX = re.compile(
'^(?:silent! )bwipeout!? (?P<buffer_number>[0-9]+)$' )
GETBUFVAR_REGEX = re.compile(
'^getbufvar\((?P<buffer_number>[0-9]+), "&(?P<option>.+)"\)$' )
MATCHADD_REGEX = re.compile(
'^matchadd\(\'(?P<group>.+)\', \'(?P<pattern>.+)\'\)$' )
MATCHDELETE_REGEX = re.compile( '^matchdelete\((?P<id>)\)$' )
# One-and only instance of mocked Vim object. The first 'import vim' that is
# executed binds the vim module to the instance of MagicMock that is created,
@ -53,6 +55,8 @@ GETBUFVAR_REGEX = re.compile(
# https://github.com/Valloric/YouCompleteMe/pull/1694
VIM_MOCK = MagicMock()
VIM_MATCHES = []
@contextlib.contextmanager
def CurrentWorkingDirectory( path ):
@ -131,6 +135,30 @@ def _MockVimOptionsEval( value ):
return None
def _MockVimMatchEval( value ):
if value == 'getmatches()':
return VIM_MATCHES
match = MATCHADD_REGEX.search( value )
if match:
group = match.group( 'group' )
option = match.group( 'pattern' )
vim_match = VimMatch( group, option )
VIM_MATCHES.append( vim_match )
return vim_match.id
match = MATCHDELETE_REGEX.search( value )
if match:
identity = match.group( 'id' )
for index, vim_match in enumerate( VIM_MATCHES ):
if vim_match.id == identity:
VIM_MATCHES.pop( index )
return -1
return 0
return None
def _MockVimEval( value ):
if value == 'g:ycm_min_num_of_chars_for_completion':
return 0
@ -155,6 +183,10 @@ def _MockVimEval( value ):
if result is not None:
return result
result = _MockVimMatchEval( value )
if result is not None:
return result
raise ValueError( 'Unexpected evaluation: {0}'.format( value ) )
@ -218,6 +250,23 @@ class VimBuffer( object ):
return [ ToUnicode( x ) for x in self.contents ]
class VimMatch( object ):
def __init__( self, group, pattern ):
self.id = len( VIM_MATCHES )
self.group = group
self.pattern = pattern
def __eq__( self, other ):
return self.group == other.group and self.pattern == other.pattern
def __repr__( self ):
return "VimMatch( group = '{0}', pattern = '{1}' )".format( self.group,
self.pattern )
@contextlib.contextmanager
def MockVimBuffers( buffers, current_buffer, cursor_position = ( 1, 1 ) ):
"""Simulates the Vim buffers list |buffers| where |current_buffer| is the

View File

@ -21,8 +21,7 @@
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from ycm.tests import PathToTestFile

View File

@ -19,12 +19,11 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from ycm.tests.test_utils import ( ExtendedMock, MockVimBuffers, MockVimModule,
VimBuffer )
VimBuffer, VimMatch )
MockVimModule()
import os
@ -33,7 +32,7 @@ from hamcrest import ( assert_that, contains, empty, is_in, is_not, has_length,
matches_regexp )
from mock import call, MagicMock, patch
from ycm.tests import StopServer, YouCompleteMeInstance
from ycm.tests import StopServer, test_utils, YouCompleteMeInstance
from ycm.client.base_request import _LoadExtraConfFile
from ycmd.responses import ServerError
@ -360,8 +359,8 @@ def YouCompleteMe_ShowDiagnostics_DiagnosticsFound_DoNotOpenLocationList_test(
'text': 'error text',
'location': {
'filepath': 'buffer',
'column_num': 2,
'line_num': 19
'line_num': 19,
'column_num': 2
}
}
@ -400,8 +399,8 @@ def YouCompleteMe_ShowDiagnostics_DiagnosticsFound_OpenLocationList_test(
'text': 'error text',
'location': {
'filepath': 'buffer',
'column_num': 2,
'line_num': 19
'line_num': 19,
'column_num': 2
}
}
@ -425,3 +424,120 @@ def YouCompleteMe_ShowDiagnostics_DiagnosticsFound_OpenLocationList_test(
'valid': 1
} ] )
open_location_list.assert_called_once_with( focus = True )
@YouCompleteMeInstance( { 'echo_current_diagnostic': 1,
'enable_diagnostic_signs': 1,
'enable_diagnostic_highlighting': 1 } )
@patch( 'ycm.youcompleteme.YouCompleteMe.FiletypeCompleterExistsForFiletype',
return_value = True )
@patch( 'ycm.vimsupport.PostVimMessage', new_callable = ExtendedMock )
@patch( 'vim.command', new_callable = ExtendedMock )
def YouCompleteMe_UpdateDiagnosticInterface_PrioritizeErrorsOverWarnings_test(
ycm, vim_command, post_vim_message, *args ):
contents = """int main() {
int x, y;
x == y
}"""
# List of diagnostics returned by ycmd for the above code.
diagnostics = [ {
'kind': 'ERROR',
'text': "expected ';' after expression",
'location': {
'filepath': 'buffer',
'line_num': 3,
'column_num': 9
},
# Looks strange but this is really what ycmd is returning.
'location_extent': {
'start': {
'filepath': '',
'line_num': 0,
'column_num': 0,
},
'end': {
'filepath': '',
'line_num': 0,
'column_num': 0,
}
},
'ranges': [],
'fixit_available': True
}, {
'kind': 'WARNING',
'text': 'equality comparison result unused',
'location': {
'filepath': 'buffer',
'line_num': 3,
'column_num': 7,
},
'location_extent': {
'start': {
'filepath': 'buffer',
'line_num': 3,
'column_num': 5,
},
'end': {
'filepath': 'buffer',
'line_num': 3,
'column_num': 7,
}
},
'ranges': [ {
'start': {
'filepath': 'buffer',
'line_num': 3,
'column_num': 3,
},
'end': {
'filepath': 'buffer',
'line_num': 3,
'column_num': 9,
}
} ],
'fixit_available': True
} ]
current_buffer = VimBuffer( 'buffer',
filetype = 'c',
contents = contents.splitlines(),
number = 5,
window = 2 )
test_utils.VIM_MATCHES = []
with MockVimBuffers( [ current_buffer ], current_buffer, ( 3, 1 ) ):
with patch( 'ycm.client.event_notification.EventNotification.Response',
return_value = diagnostics ):
ycm.OnFileReadyToParse()
ycm.HandleFileParseRequest( block = True )
# Error match is added after warning matches.
assert_that(
test_utils.VIM_MATCHES,
contains(
VimMatch( 'YcmWarningSection', '\%3l\%5c\_.\{-}\%3l\%7c' ),
VimMatch( 'YcmWarningSection', '\%3l\%3c\_.\{-}\%3l\%9c' ),
# FIXME: match should be inserted at the end of line 3 (missing ";").
VimMatch( 'YcmErrorSection', '\%0l\%0c' )
)
)
# Only the error sign is placed.
vim_command.assert_has_exact_calls( [
call( 'sign define ycm_dummy_sign' ),
call( 'sign place 3 name=ycm_dummy_sign line=3 buffer=5' ),
call( 'sign place 1 name=YcmError line=3 buffer=5' ),
call( 'sign undefine ycm_dummy_sign' ),
call( 'sign unplace 3 buffer=5' )
] )
# When moving the cursor on the diagnostics, the error is displayed to the
# user, not the warning.
ycm.OnCursorMoved()
post_vim_message.assert_has_exact_calls( [
call( "expected ';' after expression (FixIt)",
truncate = True, warning = False )
] )

View File

@ -20,8 +20,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from future.utils import iterkeys
@ -176,8 +175,8 @@ def PlaceSign( sign_id, line_num, buffer_num, is_error = True ):
line_num = 1
sign_name = 'YcmError' if is_error else 'YcmWarning'
vim.command( 'sign place {0} line={1} name={2} buffer={3}'.format(
sign_id, line_num, sign_name, buffer_num ) )
vim.command( 'sign place {0} name={1} line={2} buffer={3}'.format(
sign_id, sign_name, line_num, buffer_num ) )
def PlaceDummySign( sign_id, buffer_num, line_num ):

View File

@ -20,8 +20,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from future.utils import iteritems
@ -101,7 +100,8 @@ CORE_OUTDATED_MESSAGE = (
'YCM core library too old; PLEASE RECOMPILE by running the install.py '
'script. See the documentation for more details.' )
SERVER_IDLE_SUICIDE_SECONDS = 10800 # 3 hours
DIAGNOSTIC_UI_FILETYPES = set( [ 'cpp', 'cs', 'c', 'objc', 'objcpp' ] )
DIAGNOSTIC_UI_FILETYPES = set( [ 'cpp', 'cs', 'c', 'objc', 'objcpp',
'typescript' ] )
CLIENT_LOGFILE_FORMAT = 'ycm_'
SERVER_LOGFILE_FORMAT = 'ycmd_{port}_{std}_'

2
third_party/ycmd vendored

@ -1 +1 @@
Subproject commit ec7a154f8fe50c071ecd0ac6841de8a50ce92f5d
Subproject commit 13da3d47255d559308b946242e508d3531dabda5