Browse Source

Updating to latest ycmd

This includes the using the new API for OmniCompleter.
Val Markovic 9 years ago
parent
commit
fd0c2cc1d8
5 changed files with 50 additions and 60 deletions
  1. 8 12
      README.md
  2. 17 35
      doc/youcompleteme.txt
  3. 8 12
      plugin/youcompleteme.vim
  4. 16 0
      python/ycm/omni_completer.py
  5. 1 1
      third_party/ycmd

+ 8 - 12
README.md

@@ -146,7 +146,7 @@ local binary folder (for example `/usr/local/bin/mvim`) and then symlink it:
 Install YouCompleteMe with [Vundle][].
 
 **Remember:** YCM is a plugin with a compiled component. If you **update** YCM
-using Vundle and the ycm_support_libs library APIs have changed (happens
+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.
 
@@ -211,7 +211,7 @@ from source][vim-build] (don't worry, it's easy).
 Install YouCompleteMe with [Vundle][].
 
 **Remember:** YCM is a plugin with a compiled component. If you **update** YCM
-using Vundle and the ycm_support_libs library APIs have changed (happens
+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.
 
@@ -269,7 +269,7 @@ from source][vim-build] (don't worry, it's easy).
 Install YouCompleteMe with [Vundle][].
 
 **Remember:** YCM is a plugin with a compiled component. If you **update** YCM
-using Vundle and the ycm_support_libs library APIs have changed (happens
+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.
 
@@ -331,7 +331,7 @@ recommend using a 64-bit client. Don't worry, [a frequently updated copy of
 Install YouCompleteMe with [Vundle][].
 
 **Remember:** YCM is a plugin with a compiled component. If you **update** YCM
-using Vundle and the ycm_support_libs library APIs have changed (happens
+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.
 
@@ -408,7 +408,7 @@ FreeBSD 10.x comes with clang compiler but not the libraries needed to install.
 Install YouCompleteMe with [Vundle][].
 
 **Remember:** YCM is a plugin with a compiled component. If you **update** YCM
-using Vundle and the ycm_support_libs library APIs have changed (happens
+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.
 
@@ -464,7 +464,7 @@ the right Vim home directory. It should be `vimfiles` by default instead of
 See the _FAQ_ if you have any issues.
 
 **Remember:** YCM is a plugin with a compiled component. If you **update** YCM
-using Vundle and the ycm_support_libs library APIs have changed (happens
+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.
 
@@ -516,7 +516,7 @@ process.
     the upstream compiled binaries. Random things may break. Save yourself the
     hassle and use the upstream pre-built libclang.
 
-4.  **Compile the `ycm_support_libs` libraries** that YCM needs. These libs
+4.  **Compile the `ycm_core` libraries** that YCM needs. These libs
     are the C++ engines that YCM uses to get fast completions.
 
     You will need to have `cmake` installed in order to generate the required
@@ -589,7 +589,7 @@ process.
     Now that configuration files have been generated, compile the libraries
     using this command:
 
-        cmake --build . --target ycm_support_libs --config Release
+        cmake --build . --target ycm_core --config Release
 
     The `--config Release` part is specific to Windows and will be ignored on a
     Unix OS.
@@ -2692,10 +2692,6 @@ If this is still really annoying, and you have a good reason not to have a
 `.tern-project` file, create an empty `.tern-config` file in your home directory
 and YCM will stop complaining.
 
-### When I run install.py I get a LINK error saying `fatal error LNK1104: cannot open file '<path_to_vim_folder>\bundle\YouCompleteMe\third_party\ycmd\ycm_client_support.pyd'`
-
-Be sure to have closed all vim instances before you build YouCompleteMe.
-
 ### When I start vim I get a runtime error saying `R6034 An application has made an attempt to load the C runtime library incorrectly.`
 
 [CMake and other things seem to screw up the PATH with their own msvcrXX.dll versions.][identify-R6034-cause]

+ 17 - 35
doc/youcompleteme.txt

@@ -153,12 +153,9 @@ Contents ~
   28. Install YCM with NeoBundle [55] |youcompleteme-install-ycm-with-neobundle-55|
   29. When I open a JavaScript file, I get an annoying warning about '.tern-project'
 file |.tern-sub-project|
-  30. When I run install.py I get a LINK error saying "fatal error LNK1104: cannot
-open file '<path_to_vim_folder>\bundle\YouCompleteMe\third_party\ycmd\ycm_clien
-t_support.pyd'" |fatal-error-LNK1104:-cannot-open-file-path_to_vim_folder-bundle-YouCompleteMe-third_party-ycmd-ycm_client_support.pyd|
-  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.' |R6034-An-application-has-made-an-attempt-to-load-the-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|
  11. Contributor Code of Conduct    |youcompleteme-contributor-code-of-conduct|
  12. Contact                                            |youcompleteme-contact|
  13. License                                            |youcompleteme-license|
@@ -334,9 +331,8 @@ local binary folder (for example '/usr/local/bin/mvim') and then symlink it:
 Install YouCompleteMe with Vundle [19].
 
 **Remember:** YCM is a plugin with a compiled component. If you **update** YCM
-using Vundle and the ycm_support_libs library APIs have changed (happens
-rarely), YCM will notify you to recompile it. You should then rerun the install
-process.
+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.
 
 **NOTE:** If you want C-family completion, you MUST have the latest Xcode
 installed along with the latest Command Line Tools (they are installed
@@ -405,9 +401,8 @@ from source [24] (don't worry, it's easy).
 Install YouCompleteMe with Vundle [19].
 
 **Remember:** YCM is a plugin with a compiled component. If you **update** YCM
-using Vundle and the ycm_support_libs library APIs have changed (happens
-rarely), YCM will notify you to recompile it. You should then rerun the install
-process.
+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'
@@ -470,9 +465,8 @@ source [24] (don't worry, it's easy).
 Install YouCompleteMe with Vundle [19].
 
 **Remember:** YCM is a plugin with a compiled component. If you **update** YCM
-using Vundle and the ycm_support_libs library APIs have changed (happens
-rarely), YCM will notify you to recompile it. You should then rerun the install
-process.
+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'
@@ -539,9 +533,8 @@ recommend using a 64-bit client. Don't worry, a frequently updated copy of
 Install YouCompleteMe with Vundle [19].
 
 **Remember:** YCM is a plugin with a compiled component. If you **update** YCM
-using Vundle and the ycm_support_libs library APIs have changed (happens
-rarely), YCM will notify you to recompile it. You should then rerun the install
-process.
+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.
 
 Download and install the following software:
 
@@ -623,9 +616,8 @@ FreeBSD 10.x comes with clang compiler but not the libraries needed to install.
 Install YouCompleteMe with Vundle [19].
 
 **Remember:** YCM is a plugin with a compiled component. If you **update** YCM
-using Vundle and the ycm_support_libs library APIs have changed (happens
-rarely), YCM will notify you to recompile it. You should then rerun the install
-process.
+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 dependencies and CMake: 'sudo pkg_add llvm boost cmake'
 
@@ -685,9 +677,8 @@ use the right Vim home directory. It should be 'vimfiles' by default instead of
 See the _FAQ_ if you have any issues.
 
 **Remember:** YCM is a plugin with a compiled component. If you **update** YCM
-using Vundle and the ycm_support_libs library APIs have changed (happens
-rarely), YCM will notify you to recompile it. You should then rerun the install
-process.
+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.
 
 **Please follow the instructions carefully. Read EVERY WORD.**
 
@@ -737,8 +728,8 @@ process.
    the upstream compiled binaries. Random things may break. Save yourself
    the hassle and use the upstream pre-built libclang.
 
-4. **Compile the 'ycm_support_libs' libraries** that YCM needs. These libs
-   are the C++ engines that YCM uses to get fast completions.
+4. **Compile the 'ycm_core' libraries** that YCM needs. These libs are the
+   C++ engines that YCM uses to get fast completions.
 
    You will need to have 'cmake' installed in order to generate the required
    makefiles. Linux users can install cmake with their package manager
@@ -812,7 +803,7 @@ process.
    Now that configuration files have been generated, compile the libraries
    using this command:
 >
-   cmake --build . --target ycm_support_libs --config Release
+   cmake --build . --target ycm_core --config Release
 <
    The '--config Release' part is specific to Windows and will be ignored on
    a Unix OS.
@@ -2975,15 +2966,6 @@ If this is still really annoying, and you have a good reason not to have a
 '.tern-project' file, create an empty '.tern-config' file in your home
 directory and YCM will stop complaining.
 
--------------------------------------------------------------------------------
-*fatal-error-LNK1104:-cannot-open-file-path_to_vim_folder-bundle-YouCompleteMe-third_party-ycmd-ycm_client_support.pyd*
-When I run install.py I get a LINK error saying "fatal error LNK1104: cannot ~
-open file ~
-'<path_to_vim_folder>\bundle\YouCompleteMe\third_party\ycmd\ycm_clien ~
-t_support.pyd'" ~
-
-Be sure to have closed all vim instances before you build YouCompleteMe.
-
 -------------------------------------------------------------------------------
 *R6034-An-application-has-made-an-attempt-to-load-the-C-runtime-library-incorrectly.*
 When I start vim I get a runtime error saying 'R6034 An application has made ~

+ 8 - 12
plugin/youcompleteme.vim

@@ -47,14 +47,11 @@ let s:python_folder_path = s:script_folder_path . '/../python/'
 let s:ycmd_folder_path = s:script_folder_path . '/../third_party/ycmd/'
 
 function! s:YcmLibsPresentIn( path_prefix )
-  if filereadable(a:path_prefix . 'ycm_client_support.so') &&
-        \ filereadable(a:path_prefix . 'ycm_core.so')
+  if filereadable(a:path_prefix . 'ycm_core.so')
     return 1
-  elseif filereadable(a:path_prefix . 'ycm_client_support.pyd') &&
-        \ filereadable(a:path_prefix . 'ycm_core.pyd')
+  elseif filereadable(a:path_prefix . 'ycm_core.pyd')
     return 1
-  elseif filereadable(a:path_prefix . 'ycm_client_support.dll') &&
-        \ filereadable(a:path_prefix . 'ycm_core.dll')
+  elseif filereadable(a:path_prefix . 'ycm_core.dll')
     return 1
   endif
   return 0
@@ -75,8 +72,7 @@ let g:ycm_check_if_ycm_core_present =
 if g:ycm_check_if_ycm_core_present &&
       \ !s:YcmLibsPresentIn( s:ycmd_folder_path )
   echohl WarningMsg |
-        \ echomsg "ycm_client_support.[so|pyd|dll] and " .
-        \ "ycm_core.[so|pyd|dll] not detected; you need to compile " .
+        \ echomsg "ycm_core.[so|pyd|dll] not detected; you need to compile " .
         \ "YCM before using it. Read the docs!" |
         \ echohl None
   call s:restore_cpo()
@@ -85,11 +81,11 @@ endif
 
 let g:loaded_youcompleteme = 1
 
-" NOTE: Most defaults are in default_settings.json. They are loaded into Vim
-" global with the 'ycm_' prefix if such a key does not already exist; thus, the
-" user can override the defaults.
+" NOTE: Most defaults are in third_party/ycmd/ycmd/default_settings.json. They
+" are loaded into Vim globals with the 'ycm_' prefix if such a key does not
+" already exist; thus, the user can override the defaults.
 " The only defaults that are here are the ones that are only relevant to the YCM
-" Vim client and not the server.
+" Vim client and not the ycmd server.
 
 let g:ycm_allow_changing_updatetime =
       \ get( g:, 'ycm_allow_changing_updatetime', 1 )

+ 16 - 0
python/ycm/omni_completer.py

@@ -18,6 +18,7 @@
 import vim
 from ycm import vimsupport
 from ycmd.completers.completer import Completer
+from ycm.client.base_request import BaseRequest, ServerError
 
 OMNIFUNC_RETURNED_BAD_VALUE = 'Omnifunc returned bad value to YCM!'
 OMNIFUNC_NOT_LIST = ( 'Omnifunc did not return a list or a dict with a "words" '
@@ -92,3 +93,18 @@ class OmniCompleter( Completer ):
 
   def OnFileReadyToParse( self, request_data ):
     self._omnifunc = vim.eval( '&omnifunc' )
+
+
+  def FilterAndSortCandidatesInner( self, candidates, sort_property, query ):
+    request_data = {
+      'candidates': candidates,
+      'sort_property': sort_property,
+      'query': query
+    }
+
+    try:
+      return BaseRequest.PostDataToHandler( request_data,
+                                            'filter_and_sort_candidates' )
+    except ServerError as e:
+      vimsupport.PostMultiLineNotice( e )
+      return candidates

+ 1 - 1
third_party/ycmd

@@ -1 +1 @@
-Subproject commit 3ed1634afd7bfef872abde4e91bd012fbb08a9d8
+Subproject commit 37501c00baab54100c1e8c232e41a2aeaa43d51e