Auto merge of #2054 - vheon:rename-python-interpreter-options, r=Valloric

[READY] Rename ycmd python option

# PR Prelude

Thank you for working on YCM! :)

**Please complete these steps and check these boxes (by putting an `x` inside
the brackets) _before_ filing your PR:**

- [x] I have read and understood YCM's [CONTRIBUTING][cont] document.
- [x] I have read and understood YCM's [CODE_OF_CONDUCT][code] document.
- [x] I have included tests for the changes in my PR. If not, I have included a
  rationale for why I haven't.
- [x] **I understand my PR may be closed if it becomes obvious I didn't
  actually perform all of these steps.**

# Why this change is necessary and useful

[Please explain **in detail** why the changes in this PR are needed.]

[cont]: https://github.com/Valloric/YouCompleteMe/blob/master/CONTRIBUTING.md
[code]: https://github.com/Valloric/YouCompleteMe/blob/master/CODE_OF_CONDUCT.md

As requested in https://github.com/Valloric/YouCompleteMe/issues/2052#issuecomment-195631106 I'm sending this PR. I've marked it as WIP because I've renamed only the `ycmd` option and that is because keeping the backward compatibility here was straight forward since is a client only option. For the jedihttp option instead I would like some opinion on how to procede: should we keep the backward compatibility here on the client or should we make the backward compatibility layer on the ycmd side? Keeping it here would be easier but it would mean that other clients should implement this theirself. Thoughts?

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2054)
<!-- Reviewable:end -->
This commit is contained in:
Homu 2016-03-27 03:16:07 +09:00
commit 0648068b37
5 changed files with 14 additions and 13 deletions

View File

@ -1906,7 +1906,7 @@ Default: `[]`
let g:ycm_extra_conf_vim_data = [] let g:ycm_extra_conf_vim_data = []
``` ```
### The `g:ycm_path_to_python_interpreter` option ### The `g:ycm_server_python_interpreter` option
YCM will by default search for an appropriate Python interpreter on your system. YCM will by default search for an appropriate Python interpreter on your system.
You can use this option to override that behavior and force the use of a You can use this option to override that behavior and force the use of a
@ -1919,7 +1919,7 @@ Vim.
Default: `''` Default: `''`
```viml ```viml
let g:ycm_path_to_python_interpreter = '' let g:ycm_server_python_interpreter = ''
``` ```
### The `g:ycm_server_keep_logfiles` option ### The `g:ycm_server_keep_logfiles` option
@ -2359,7 +2359,7 @@ If building for Python 3 but loading in Python 2:
ImportError: dynamic module does not define init function (initycm_core) ImportError: dynamic module does not define init function (initycm_core)
``` ```
Setting the `g:ycm_path_to_python_interpreter` option to force the use of a Setting the `g:ycm_server_python_interpreter` option to force the use of a
specific Python interpreter for `ycmd` is usually the easiest way to solve the specific Python interpreter for `ycmd` is usually the easiest way to solve the
problem. Common values for that option are `/usr/bin/python` and problem. Common values for that option are `/usr/bin/python` and
`/usr/bin/python3`. `/usr/bin/python3`.

View File

@ -96,7 +96,7 @@ Contents ~
19. The |g:ycm_collect_identifiers_from_tags_files| option 19. The |g:ycm_collect_identifiers_from_tags_files| option
20. The |g:ycm_seed_identifiers_with_syntax| option 20. The |g:ycm_seed_identifiers_with_syntax| option
21. The |g:ycm_extra_conf_vim_data| option 21. The |g:ycm_extra_conf_vim_data| option
22. The |g:ycm_path_to_python_interpreter| option 22. The |g:ycm_server_python_interpreter| option
23. The |g:ycm_server_keep_logfiles| option 23. The |g:ycm_server_keep_logfiles| option
24. The |g:ycm_server_log_level| option 24. The |g:ycm_server_log_level| option
25. The |g:ycm_auto_start_csharp_server| option 25. The |g:ycm_auto_start_csharp_server| option
@ -2166,7 +2166,7 @@ Default: '[]'
let g:ycm_extra_conf_vim_data = [] let g:ycm_extra_conf_vim_data = []
< <
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
The *g:ycm_path_to_python_interpreter* option The *g:ycm_server_python_interpreter* option
YCM will by default search for an appropriate Python interpreter on your YCM will by default search for an appropriate Python interpreter on your
system. You can use this option to override that behavior and force the use of system. You can use this option to override that behavior and force the use of
@ -2178,7 +2178,7 @@ Vim.
Default: "''" Default: "''"
> >
let g:ycm_path_to_python_interpreter = '' let g:ycm_server_python_interpreter = ''
< <
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
The *g:ycm_server_keep_logfiles* option The *g:ycm_server_keep_logfiles* option
@ -2591,7 +2591,7 @@ If building for Python 3 but loading in Python 2:
> >
ImportError: dynamic module does not define init function (initycm_core) ImportError: dynamic module does not define init function (initycm_core)
< <
Setting the |g:ycm_path_to_python_interpreter| option to force the use of a Setting the |g:ycm_server_python_interpreter| option to force the use of a
specific Python interpreter for 'ycmd' is usually the easiest way to solve the specific Python interpreter for 'ycmd' is usually the easiest way to solve the
problem. Common values for that option are '/usr/bin/python' and problem. Common values for that option are '/usr/bin/python' and
'/usr/bin/python3'. '/usr/bin/python3'.

View File

@ -126,8 +126,9 @@ let g:ycm_server_keep_logfiles =
let g:ycm_extra_conf_vim_data = let g:ycm_extra_conf_vim_data =
\ get( g:, 'ycm_extra_conf_vim_data', [] ) \ get( g:, 'ycm_extra_conf_vim_data', [] )
let g:ycm_path_to_python_interpreter = let g:ycm_server_python_interpreter =
\ get( g:, 'ycm_path_to_python_interpreter', '' ) \ get( g:, 'ycm_server_python_interpreter',
\ get( g:, 'ycm_path_to_python_interpreter', '' ) )
let g:ycm_show_diagnostics_ui = let g:ycm_show_diagnostics_ui =
\ get( g:, 'ycm_show_diagnostics_ui', \ get( g:, 'ycm_show_diagnostics_ui',

View File

@ -54,13 +54,13 @@ def Memoize( obj ):
def PathToPythonInterpreter(): def PathToPythonInterpreter():
from ycmd import utils from ycmd import utils
python_interpreter = vim.eval( 'g:ycm_path_to_python_interpreter' ) python_interpreter = vim.eval( 'g:ycm_server_python_interpreter' )
if python_interpreter: if python_interpreter:
if IsPythonVersionCorrect( python_interpreter ): if IsPythonVersionCorrect( python_interpreter ):
return python_interpreter return python_interpreter
raise RuntimeError( "Path in 'g:ycm_path_to_python_interpreter' option " raise RuntimeError( "Path in 'g:ycm_server_python_interpreter' option "
"does not point to a valid Python 2.6+ or 3.3+." ) "does not point to a valid Python 2.6+ or 3.3+." )
# On UNIX platforms, we use sys.executable as the Python interpreter path. # On UNIX platforms, we use sys.executable as the Python interpreter path.
@ -86,7 +86,7 @@ def PathToPythonInterpreter():
return python_interpreter return python_interpreter
raise RuntimeError( "Cannot find Python 2.6+ or 3.3+. You can set its path " raise RuntimeError( "Cannot find Python 2.6+ or 3.3+. You can set its path "
"using the 'g:ycm_path_to_python_interpreter' " "using the 'g:ycm_server_python_interpreter' "
"option." ) "option." )

View File

@ -61,7 +61,7 @@ def MockGetBufferWindowNumber( buffer_number ):
def MockVimEval( value ): def MockVimEval( value ):
if value == "g:ycm_min_num_of_chars_for_completion": if value == "g:ycm_min_num_of_chars_for_completion":
return 0 return 0
if value == "g:ycm_path_to_python_interpreter": if value == "g:ycm_server_python_interpreter":
return '' return ''
if value == "tempname()": if value == "tempname()":
return '_TEMP_FILE_' return '_TEMP_FILE_'