From edf7e600c84537fe090890232518bb94e8ed299d Mon Sep 17 00:00:00 2001 From: micbou Date: Sun, 12 Mar 2017 11:40:54 +0100 Subject: [PATCH 01/11] Update ycmd Release notes: - update racerd; - update Tern to 0.21.0; - fix finding node on Debian-based distributions; - add Visual Studio 2017 support; - drop Visual Studio 2012 support. --- README.md | 11 +++++------ appveyor.yml | 1 + doc/youcompleteme.txt | 14 +++++++------- third_party/ycmd | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index acedf9f1..02c13f1b 100644 --- a/README.md +++ b/README.md @@ -370,8 +370,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. @@ -406,8 +405,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, @@ -567,7 +566,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 @@ -3086,7 +3085,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 diff --git a/appveyor.yml b/appveyor.yml index b03d8ad6..f14072c4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,5 @@ version: '{build}' +image: Visual Studio 2017 environment: COVERAGE: true matrix: diff --git a/doc/youcompleteme.txt b/doc/youcompleteme.txt index 9d7ae400..8088e942 100644 --- a/doc/youcompleteme.txt +++ b/doc/youcompleteme.txt @@ -576,8 +576,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 +617,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 +782,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'. @@ -3367,7 +3367,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 diff --git a/third_party/ycmd b/third_party/ycmd index ec7a154f..60c5bba4 160000 --- a/third_party/ycmd +++ b/third_party/ycmd @@ -1 +1 @@ -Subproject commit ec7a154f8fe50c071ecd0ac6841de8a50ce92f5d +Subproject commit 60c5bba489a24148afe501216a6a37d4fa669e15 From f3ccafe3aedee0dc2ec320e3121869785e730bb8 Mon Sep 17 00:00:00 2001 From: micbou Date: Thu, 9 Mar 2017 15:57:27 +0100 Subject: [PATCH 02/11] Do not install aliases from future Installing aliases from python-future is unreliable and slow. --- python/ycm/base.py | 3 +-- python/ycm/client/base_request.py | 10 ++++------ python/ycm/client/command_request.py | 3 +-- python/ycm/client/completer_available_request.py | 3 +-- python/ycm/client/completion_request.py | 3 +-- python/ycm/client/debug_info_request.py | 3 +-- python/ycm/client/event_notification.py | 3 +-- python/ycm/client/omni_completion_request.py | 3 +-- python/ycm/client/shutdown_request.py | 3 +-- python/ycm/client/ycmd_keepalive.py | 3 +-- python/ycm/diagnostic_filter.py | 3 +-- python/ycm/diagnostic_interface.py | 3 +-- python/ycm/omni_completer.py | 3 +-- python/ycm/paths.py | 3 +-- python/ycm/syntax_parse.py | 3 +-- python/ycm/tests/__init__.py | 3 +-- python/ycm/tests/base_test.py | 3 +-- python/ycm/tests/client/command_request_test.py | 3 +-- python/ycm/tests/client/completion_request_test.py | 3 +-- python/ycm/tests/client/debug_info_request_test.py | 3 +-- .../ycm/tests/client/omni_completion_request_tests.py | 3 +-- python/ycm/tests/command_test.py | 3 +-- python/ycm/tests/completion_test.py | 3 +-- python/ycm/tests/diagnostic_filter_test.py | 3 +-- python/ycm/tests/event_notification_test.py | 3 +-- python/ycm/tests/omni_completer_test.py | 5 ++--- python/ycm/tests/paths_test.py | 3 +-- python/ycm/tests/postcomplete_test.py | 3 +-- python/ycm/tests/syntax_parse_test.py | 3 +-- python/ycm/tests/test_utils.py | 3 +-- python/ycm/tests/vimsupport_test.py | 3 +-- python/ycm/tests/youcompleteme_test.py | 3 +-- python/ycm/vimsupport.py | 3 +-- python/ycm/youcompleteme.py | 3 +-- 34 files changed, 38 insertions(+), 73 deletions(-) diff --git a/python/ycm/base.py b/python/ycm/base.py index 4de4c0bf..4bfb3663 100644 --- a/python/ycm/base.py +++ b/python/ycm/base.py @@ -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 diff --git a/python/ycm/client/base_request.py b/python/ycm/client/base_request.py index 99067b68..c8660c65 100644 --- a/python/ycm/client/base_request.py +++ b/python/ycm/client/base_request.py @@ -19,14 +19,13 @@ 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.moves.urllib.parse import urljoin, urlparse from future.utils import native from base64 import b64decode, b64encode from ycm import vimsupport @@ -120,7 +119,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 +262,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 ): diff --git a/python/ycm/client/command_request.py b/python/ycm/client/command_request.py index 5f728c92..fee5b2b3 100644 --- a/python/ycm/client/command_request.py +++ b/python/ycm/client/command_request.py @@ -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, diff --git a/python/ycm/client/completer_available_request.py b/python/ycm/client/completer_available_request.py index 37d53d88..d9b11e25 100644 --- a/python/ycm/client/completer_available_request.py +++ b/python/ycm/client/completer_available_request.py @@ -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, diff --git a/python/ycm/client/completion_request.py b/python/ycm/client/completion_request.py index 1325711d..76c969a0 100644 --- a/python/ycm/client/completion_request.py +++ b/python/ycm/client/completion_request.py @@ -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 diff --git a/python/ycm/client/debug_info_request.py b/python/ycm/client/debug_info_request.py index d7a5822b..e7eb0522 100644 --- a/python/ycm/client/debug_info_request.py +++ b/python/ycm/client/debug_info_request.py @@ -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, diff --git a/python/ycm/client/event_notification.py b/python/ycm/client/event_notification.py index e797ddb6..b46dd5e6 100644 --- a/python/ycm/client/event_notification.py +++ b/python/ycm/client/event_notification.py @@ -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, diff --git a/python/ycm/client/omni_completion_request.py b/python/ycm/client/omni_completion_request.py index 2bcb2911..7fc76594 100644 --- a/python/ycm/client/omni_completion_request.py +++ b/python/ycm/client/omni_completion_request.py @@ -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 diff --git a/python/ycm/client/shutdown_request.py b/python/ycm/client/shutdown_request.py index 31fd6c53..8bef0235 100644 --- a/python/ycm/client/shutdown_request.py +++ b/python/ycm/client/shutdown_request.py @@ -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 diff --git a/python/ycm/client/ycmd_keepalive.py b/python/ycm/client/ycmd_keepalive.py index ecf5fe39..a36d6998 100644 --- a/python/ycm/client/ycmd_keepalive.py +++ b/python/ycm/client/ycmd_keepalive.py @@ -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 diff --git a/python/ycm/diagnostic_filter.py b/python/ycm/diagnostic_filter.py index 78ab2972..e31e6e70 100644 --- a/python/ycm/diagnostic_filter.py +++ b/python/ycm/diagnostic_filter.py @@ -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 diff --git a/python/ycm/diagnostic_interface.py b/python/ycm/diagnostic_interface.py index e905b6ad..438942e7 100644 --- a/python/ycm/diagnostic_interface.py +++ b/python/ycm/diagnostic_interface.py @@ -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 diff --git a/python/ycm/omni_completer.py b/python/ycm/omni_completer.py index 2424ddd7..2587e088 100644 --- a/python/ycm/omni_completer.py +++ b/python/ycm/omni_completer.py @@ -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 diff --git a/python/ycm/paths.py b/python/ycm/paths.py index 292a2a17..c715154f 100644 --- a/python/ycm/paths.py +++ b/python/ycm/paths.py @@ -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 diff --git a/python/ycm/syntax_parse.py b/python/ycm/syntax_parse.py index 8bb3d711..964361a2 100644 --- a/python/ycm/syntax_parse.py +++ b/python/ycm/syntax_parse.py @@ -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 diff --git a/python/ycm/tests/__init__.py b/python/ycm/tests/__init__.py index b02d1204..40d4422d 100644 --- a/python/ycm/tests/__init__.py +++ b/python/ycm/tests/__init__.py @@ -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 diff --git a/python/ycm/tests/base_test.py b/python/ycm/tests/base_test.py index 3ce7ff2a..3b4fd4f0 100644 --- a/python/ycm/tests/base_test.py +++ b/python/ycm/tests/base_test.py @@ -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 diff --git a/python/ycm/tests/client/command_request_test.py b/python/ycm/tests/client/command_request_test.py index a205990d..854b498b 100644 --- a/python/ycm/tests/client/command_request_test.py +++ b/python/ycm/tests/client/command_request_test.py @@ -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 diff --git a/python/ycm/tests/client/completion_request_test.py b/python/ycm/tests/client/completion_request_test.py index 0c764522..c3bd1aed 100644 --- a/python/ycm/tests/client/completion_request_test.py +++ b/python/ycm/tests/client/completion_request_test.py @@ -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_ diff --git a/python/ycm/tests/client/debug_info_request_test.py b/python/ycm/tests/client/debug_info_request_test.py index 570e92e5..9ce2a433 100644 --- a/python/ycm/tests/client/debug_info_request_test.py +++ b/python/ycm/tests/client/debug_info_request_test.py @@ -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 diff --git a/python/ycm/tests/client/omni_completion_request_tests.py b/python/ycm/tests/client/omni_completion_request_tests.py index 02fb2e93..6b699622 100644 --- a/python/ycm/tests/client/omni_completion_request_tests.py +++ b/python/ycm/tests/client/omni_completion_request_tests.py @@ -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 diff --git a/python/ycm/tests/command_test.py b/python/ycm/tests/command_test.py index e894647b..25a2eb88 100644 --- a/python/ycm/tests/command_test.py +++ b/python/ycm/tests/command_test.py @@ -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 ) diff --git a/python/ycm/tests/completion_test.py b/python/ycm/tests/completion_test.py index f5fb958c..e16de3fa 100644 --- a/python/ycm/tests/completion_test.py +++ b/python/ycm/tests/completion_test.py @@ -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, diff --git a/python/ycm/tests/diagnostic_filter_test.py b/python/ycm/tests/diagnostic_filter_test.py index c24e4e0b..9ecff64b 100644 --- a/python/ycm/tests/diagnostic_filter_test.py +++ b/python/ycm/tests/diagnostic_filter_test.py @@ -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 diff --git a/python/ycm/tests/event_notification_test.py b/python/ycm/tests/event_notification_test.py index ee010fde..dde191d1 100644 --- a/python/ycm/tests/event_notification_test.py +++ b/python/ycm/tests/event_notification_test.py @@ -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, diff --git a/python/ycm/tests/omni_completer_test.py b/python/ycm/tests/omni_completer_test.py index 907066b9..3342768b 100644 --- a/python/ycm/tests/omni_completer_test.py +++ b/python/ycm/tests/omni_completer_test.py @@ -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 diff --git a/python/ycm/tests/paths_test.py b/python/ycm/tests/paths_test.py index 1c1c6fb9..4c2458e6 100644 --- a/python/ycm/tests/paths_test.py +++ b/python/ycm/tests/paths_test.py @@ -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 diff --git a/python/ycm/tests/postcomplete_test.py b/python/ycm/tests/postcomplete_test.py index 84b71b92..5b2c788a 100644 --- a/python/ycm/tests/postcomplete_test.py +++ b/python/ycm/tests/postcomplete_test.py @@ -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 diff --git a/python/ycm/tests/syntax_parse_test.py b/python/ycm/tests/syntax_parse_test.py index 0a8fb760..7c656633 100644 --- a/python/ycm/tests/syntax_parse_test.py +++ b/python/ycm/tests/syntax_parse_test.py @@ -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 diff --git a/python/ycm/tests/test_utils.py b/python/ycm/tests/test_utils.py index c8a4d497..652b0089 100644 --- a/python/ycm/tests/test_utils.py +++ b/python/ycm/tests/test_utils.py @@ -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 diff --git a/python/ycm/tests/vimsupport_test.py b/python/ycm/tests/vimsupport_test.py index db8dcc81..3fc5d362 100644 --- a/python/ycm/tests/vimsupport_test.py +++ b/python/ycm/tests/vimsupport_test.py @@ -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 diff --git a/python/ycm/tests/youcompleteme_test.py b/python/ycm/tests/youcompleteme_test.py index 27990bc5..7ee2c9ce 100644 --- a/python/ycm/tests/youcompleteme_test.py +++ b/python/ycm/tests/youcompleteme_test.py @@ -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, MockVimBuffers, MockVimModule, diff --git a/python/ycm/vimsupport.py b/python/ycm/vimsupport.py index 3584d412..384dd9bc 100644 --- a/python/ycm/vimsupport.py +++ b/python/ycm/vimsupport.py @@ -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 diff --git a/python/ycm/youcompleteme.py b/python/ycm/youcompleteme.py index 3fa33846..4027f477 100644 --- a/python/ycm/youcompleteme.py +++ b/python/ycm/youcompleteme.py @@ -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 From 41fb6537e290256fc3ca585bcd54860e67f1d7e5 Mon Sep 17 00:00:00 2001 From: micbou Date: Sat, 18 Mar 2017 04:51:50 +0100 Subject: [PATCH 03/11] Update ycmd Changelog: - update Clang to 4.0.0; - startup improvement. --- third_party/ycmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/ycmd b/third_party/ycmd index 60c5bba4..e7096293 160000 --- a/third_party/ycmd +++ b/third_party/ycmd @@ -1 +1 @@ -Subproject commit 60c5bba489a24148afe501216a6a37d4fa669e15 +Subproject commit e709629389e7fe524e3c18e6896026956d968d16 From e581c5c8ab876f02cd7fc8c73a4b91c8511a190f Mon Sep 17 00:00:00 2001 From: micbou Date: Sun, 19 Mar 2017 13:58:04 +0100 Subject: [PATCH 04/11] Import urljoin and urlparse from ycmd.utils --- python/ycm/client/base_request.py | 3 +-- third_party/ycmd | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/python/ycm/client/base_request.py b/python/ycm/client/base_request.py index c8660c65..5b526366 100644 --- a/python/ycm/client/base_request.py +++ b/python/ycm/client/base_request.py @@ -25,11 +25,10 @@ from builtins import * # noqa import contextlib import logging import json -from future.moves.urllib.parse import urljoin, urlparse 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 diff --git a/third_party/ycmd b/third_party/ycmd index e7096293..fc7620a8 160000 --- a/third_party/ycmd +++ b/third_party/ycmd @@ -1 +1 @@ -Subproject commit e709629389e7fe524e3c18e6896026956d968d16 +Subproject commit fc7620a8a8b3880726c81b6b4e1789d8d25e38b6 From 656ddc34e3b366bcbba709d60740a5d2353e47da Mon Sep 17 00:00:00 2001 From: Mike Perri Date: Fri, 24 Mar 2017 18:37:31 -0400 Subject: [PATCH 05/11] Enable diagnostics for TypeScript and update README --- README.md | 8 +++++--- python/ycm/youcompleteme.py | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 997bae45..c02a4c8d 100644 --- a/README.md +++ b/README.md @@ -729,6 +729,7 @@ Quick Feature Summary ### TypeScript * Semantic auto-completion +* Real-time diagnostic display * Renaming symbols (`RefactorRename `) * Go to definition, find references (`GoToDefinition`, `GoToReferences`) * Semantic type information for identifiers (`GetType`) @@ -1131,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: diff --git a/python/ycm/youcompleteme.py b/python/ycm/youcompleteme.py index 4027f477..05be837b 100644 --- a/python/ycm/youcompleteme.py +++ b/python/ycm/youcompleteme.py @@ -100,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}_' From 39dea3c3b44c8d18ca6013d04c04e35e387e5310 Mon Sep 17 00:00:00 2001 From: Mike Perri Date: Fri, 24 Mar 2017 18:45:09 -0400 Subject: [PATCH 06/11] Update ycmd version --- third_party/ycmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/ycmd b/third_party/ycmd index fc7620a8..13da3d47 160000 --- a/third_party/ycmd +++ b/third_party/ycmd @@ -1 +1 @@ -Subproject commit fc7620a8a8b3880726c81b6b4e1789d8d25e38b6 +Subproject commit 13da3d47255d559308b946242e508d3531dabda5 From f84796bf0e6c6f75cd1a258d2aa2a43d11031414 Mon Sep 17 00:00:00 2001 From: micbou Date: Sun, 6 Nov 2016 21:50:37 +0100 Subject: [PATCH 07/11] Remove Python version check Starting the Python interpreter to check its version is slow. --- python/ycm/paths.py | 41 +++++++--------------------------- python/ycm/tests/paths_test.py | 9 ++++---- 2 files changed, 12 insertions(+), 38 deletions(-) diff --git a/python/ycm/paths.py b/python/ycm/paths.py index c715154f..e3a8a982 100644 --- a/python/ycm/paths.py +++ b/python/ycm/paths.py @@ -1,4 +1,4 @@ -# Copyright (C) 2015 YouCompleteMe contributors. +# Copyright (C) 2015-2017 YouCompleteMe contributors. # # This file is part of YouCompleteMe. # @@ -51,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. @@ -72,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 @@ -84,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 " @@ -104,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' ) diff --git a/python/ycm/tests/paths_test.py b/python/ycm/tests/paths_test.py index 4c2458e6..6ff5f434 100644 --- a/python/ycm/tests/paths_test.py +++ b/python/ycm/tests/paths_test.py @@ -1,4 +1,4 @@ -# Copyright (C) 2016 YouCompleteMe contributors +# Copyright (C) 2016-2017 YouCompleteMe contributors # # This file is part of YouCompleteMe. # @@ -26,15 +26,15 @@ 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 ) ) def EndsWithPython_Bad( path ): - ok_( not EndsWithPython( path ) ) + ok_( not _EndsWithPython( path ) ) def EndsWithPython_Python2Paths_test(): @@ -50,7 +50,6 @@ def EndsWithPython_Python2Paths_test(): yield EndsWithPython_Good, path - def EndsWithPython_Python3Paths_test(): python_paths = [ 'python3', From 2542105e2f4ff788c7690a16fcbd6a94d4e6bd02 Mon Sep 17 00:00:00 2001 From: micbou Date: Mon, 27 Mar 2017 01:34:07 +0200 Subject: [PATCH 08/11] Merge s:OnBufferRead and s:OnBufferEnter Fix issue where completeopt, completefunc, and omnifunc are not set for buffers opened before the plugin is loaded. --- autoload/youcompleteme.vim | 62 +++++++++++++++----------------------- 1 file changed, 24 insertions(+), 38 deletions(-) diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index 7ef59436..733162fb 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -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( ':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 returns the unloaded buffer number as a string but we want " it as a true number for the getbufvar function. From fb000ca9e7fe3ac6b84c38e041bf6da2c95c84a6 Mon Sep 17 00:00:00 2001 From: micbou Date: Mon, 27 Mar 2017 22:23:39 +0200 Subject: [PATCH 09/11] Accept capitalized name for Python executable Python executable name may be capitalized on macOS. --- python/ycm/paths.py | 2 +- python/ycm/tests/paths_test.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/python/ycm/paths.py b/python/ycm/paths.py index e3a8a982..cd0adf29 100644 --- a/python/ycm/paths.py +++ b/python/ycm/paths.py @@ -34,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 ): diff --git a/python/ycm/tests/paths_test.py b/python/ycm/tests/paths_test.py index 6ff5f434..e50572bd 100644 --- a/python/ycm/tests/paths_test.py +++ b/python/ycm/tests/paths_test.py @@ -30,11 +30,13 @@ 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(): @@ -43,7 +45,8 @@ 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: From e45a409ac99d2e2ff9643da494829a4aec313673 Mon Sep 17 00:00:00 2001 From: micbou Date: Tue, 28 Mar 2017 21:37:58 +0200 Subject: [PATCH 10/11] Prioritize errors over warnings on the same line --- python/ycm/diagnostic_interface.py | 46 +++---- python/ycm/tests/event_notification_test.py | 4 +- python/ycm/tests/test_utils.py | 50 ++++++++ python/ycm/tests/youcompleteme_test.py | 129 +++++++++++++++++++- python/ycm/vimsupport.py | 4 +- 5 files changed, 201 insertions(+), 32 deletions(-) diff --git a/python/ycm/diagnostic_interface.py b/python/ycm/diagnostic_interface.py index 438942e7..f68d09f0 100644 --- a/python/ycm/diagnostic_interface.py +++ b/python/ycm/diagnostic_interface.py @@ -108,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 ) @@ -132,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 ) @@ -201,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: - sign = _DiagSignPlacement( next_sign_id, - line, - buffer_number, - _DiagnosticIsError( diag ) ) - if sign not in placed_signs: - new_signs += [ 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 ) ] ] + # Only one sign is visible by line. + first_diag = diags[ 0 ] + sign = _DiagSignPlacement( next_sign_id, + line, + buffer_number, + _DiagnosticIsError( first_diag ) ) + if sign not in placed_signs: + 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.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: @@ -226,7 +228,7 @@ def _PlaceNewSigns( kept_signs, new_signs ): if sign in placed_signs: continue vimsupport.PlaceSign( sign.id, sign.line, sign.buffer, sign.is_error ) - placed_signs.append(sign) + placed_signs.append( sign ) return placed_signs @@ -247,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 diff --git a/python/ycm/tests/event_notification_test.py b/python/ycm/tests/event_notification_test.py index dde191d1..b83c35bb 100644 --- a/python/ycm/tests/event_notification_test.py +++ b/python/ycm/tests/event_notification_test.py @@ -48,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 ): diff --git a/python/ycm/tests/test_utils.py b/python/ycm/tests/test_utils.py index 652b0089..36ce2478 100644 --- a/python/ycm/tests/test_utils.py +++ b/python/ycm/tests/test_utils.py @@ -41,6 +41,9 @@ BWIPEOUT_REGEX = re.compile( '^(?:silent! )bwipeout!? (?P[0-9]+)$' ) GETBUFVAR_REGEX = re.compile( '^getbufvar\((?P[0-9]+), "&(?P