diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index 98cbf650..05c0b199 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -40,7 +40,7 @@ function! youcompleteme#Enable() py import sys py import vim exe 'python sys.path.insert( 0, "' . s:script_folder_path . '/../python" )' - py import extra_conf_store + py from ycm import extra_conf_store py extra_conf_store.CallExtraConfYcmCorePreloadIfExists() py import ycm diff --git a/python/ycm/__init__.py b/python/ycm/__init__.py new file mode 100644 index 00000000..6dbc7fcd --- /dev/null +++ b/python/ycm/__init__.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# +# Copyright (C) 2011, 2012 Strahinja Val Markovic +# +# This file is part of YouCompleteMe. +# +# YouCompleteMe is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# YouCompleteMe is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with YouCompleteMe. If not, see . + +from youcompleteme import ( + YouCompleteMe, CompatibleWithYcmCore, CurrentIdentifierFinished, + CompletionStartColumn ) + +# We don't really need to do this, but if we don't, pyflakes complains that we +# have unused imports. Pyflakes should ignore unused imports in __init__.py +# files, but doesn't. See this bug report: +# https://bugs.launchpad.net/pyflakes/+bug/1178905 +__all__ = [ + YouCompleteMe.__name__, + CompatibleWithYcmCore.__name__, + CurrentIdentifierFinished.__name__, + CompletionStartColumn.__name__ +] diff --git a/python/completers/__init__.py b/python/ycm/completers/__init__.py similarity index 100% rename from python/completers/__init__.py rename to python/ycm/completers/__init__.py diff --git a/python/completers/all/__init__.py b/python/ycm/completers/all/__init__.py similarity index 100% rename from python/completers/all/__init__.py rename to python/ycm/completers/all/__init__.py diff --git a/python/completers/all/identifier_completer.py b/python/ycm/completers/all/identifier_completer.py similarity index 97% rename from python/completers/all/identifier_completer.py rename to python/ycm/completers/all/identifier_completer.py index 858fd34e..691b6df4 100644 --- a/python/completers/all/identifier_completer.py +++ b/python/ycm/completers/all/identifier_completer.py @@ -17,11 +17,11 @@ # You should have received a copy of the GNU General Public License # along with YouCompleteMe. If not, see . -from completers.general_completer import GeneralCompleter import vim -import vimsupport import ycm_core -import ycm_utils as utils +from ycm.completers.general_completer import GeneralCompleter +from ycm import vimsupport +from ycm import utils MAX_IDENTIFIER_COMPLETIONS_RETURNED = 10 MIN_NUM_CHARS = int( vimsupport.GetVariableValue( diff --git a/python/completers/all/omni_completer.py b/python/ycm/completers/all/omni_completer.py similarity index 97% rename from python/completers/all/omni_completer.py rename to python/ycm/completers/all/omni_completer.py index abea1d8d..17052647 100644 --- a/python/completers/all/omni_completer.py +++ b/python/ycm/completers/all/omni_completer.py @@ -18,8 +18,8 @@ # along with YouCompleteMe. If not, see . import vim -import vimsupport -from completers.completer import Completer +from ycm import vimsupport +from ycm.completers.completer import Completer 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" ' diff --git a/python/completers/c/hook.py b/python/ycm/completers/c/hook.py similarity index 93% rename from python/completers/c/hook.py rename to python/ycm/completers/c/hook.py index c60f3956..a4b02e0b 100644 --- a/python/completers/c/hook.py +++ b/python/ycm/completers/c/hook.py @@ -18,7 +18,7 @@ # along with YouCompleteMe. If not, see . import ycm_core -from completers.cpp.clang_completer import ClangCompleter +from ycm.completers.cpp.clang_completer import ClangCompleter def GetCompleter(): if ycm_core.HasClangSupport(): diff --git a/python/completers/completer.py b/python/ycm/completers/completer.py similarity index 99% rename from python/completers/completer.py rename to python/ycm/completers/completer.py index 1c1ae842..e4c41e14 100644 --- a/python/completers/completer.py +++ b/python/ycm/completers/completer.py @@ -19,8 +19,8 @@ import abc import vim -import vimsupport import ycm_core +from ycm import vimsupport from collections import defaultdict NO_USER_COMMANDS = 'This completer does not define any commands.' diff --git a/python/completers/cpp/__init__.py b/python/ycm/completers/cpp/__init__.py similarity index 100% rename from python/completers/cpp/__init__.py rename to python/ycm/completers/cpp/__init__.py diff --git a/python/completers/cpp/clang_completer.py b/python/ycm/completers/cpp/clang_completer.py similarity index 98% rename from python/completers/cpp/clang_completer.py rename to python/ycm/completers/cpp/clang_completer.py index cedcabf3..ae011eaf 100644 --- a/python/completers/cpp/clang_completer.py +++ b/python/ycm/completers/cpp/clang_completer.py @@ -17,13 +17,13 @@ # You should have received a copy of the GNU General Public License # along with YouCompleteMe. If not, see . -from completers.completer import Completer from collections import defaultdict import vim -import vimsupport import ycm_core -import extra_conf_store -from flags import Flags +from ycm import vimsupport +from ycm import extra_conf_store +from ycm.completers.completer import Completer +from ycm.completers.cpp.flags import Flags CLANG_FILETYPES = set( [ 'c', 'cpp', 'objc', 'objcpp' ] ) MAX_DIAGNOSTICS_TO_DISPLAY = int( vimsupport.GetVariableValue( diff --git a/python/completers/cpp/clang_helpers.py b/python/ycm/completers/cpp/clang_helpers.py similarity index 100% rename from python/completers/cpp/clang_helpers.py rename to python/ycm/completers/cpp/clang_helpers.py diff --git a/python/completers/cpp/flags.py b/python/ycm/completers/cpp/flags.py similarity index 98% rename from python/completers/cpp/flags.py rename to python/ycm/completers/cpp/flags.py index 8623e8b1..5b0b76cd 100644 --- a/python/completers/cpp/flags.py +++ b/python/ycm/completers/cpp/flags.py @@ -19,8 +19,8 @@ import ycm_core import os -import vimsupport -import extra_conf_store +from ycm import vimsupport +from ycm import extra_conf_store NO_EXTRA_CONF_FILENAME_MESSAGE = ('No {0} file detected, so no compile flags ' 'are available. Thus no semantic support for C/C++/ObjC/ObjC++. See the ' diff --git a/python/completers/cpp/hook.py b/python/ycm/completers/cpp/hook.py similarity index 93% rename from python/completers/cpp/hook.py rename to python/ycm/completers/cpp/hook.py index c60f3956..a4b02e0b 100644 --- a/python/completers/cpp/hook.py +++ b/python/ycm/completers/cpp/hook.py @@ -18,7 +18,7 @@ # along with YouCompleteMe. If not, see . import ycm_core -from completers.cpp.clang_completer import ClangCompleter +from ycm.completers.cpp.clang_completer import ClangCompleter def GetCompleter(): if ycm_core.HasClangSupport(): diff --git a/python/completers/cpp/tests/__init__.py b/python/ycm/completers/cpp/tests/__init__.py similarity index 100% rename from python/completers/cpp/tests/__init__.py rename to python/ycm/completers/cpp/tests/__init__.py diff --git a/python/completers/cpp/tests/flags_test.py b/python/ycm/completers/cpp/tests/flags_test.py similarity index 100% rename from python/completers/cpp/tests/flags_test.py rename to python/ycm/completers/cpp/tests/flags_test.py diff --git a/python/completers/general/__init__.py b/python/ycm/completers/general/__init__.py similarity index 100% rename from python/completers/general/__init__.py rename to python/ycm/completers/general/__init__.py diff --git a/python/completers/general/filename_completer.py b/python/ycm/completers/general/filename_completer.py similarity index 95% rename from python/completers/general/filename_completer.py rename to python/ycm/completers/general/filename_completer.py index 01af4382..42ad6711 100644 --- a/python/completers/general/filename_completer.py +++ b/python/ycm/completers/general/filename_completer.py @@ -16,14 +16,15 @@ # You should have received a copy of the GNU General Public License # along with YouCompleteMe. If not, see . -from completers.threaded_completer import ThreadedCompleter -from completers.cpp.clang_completer import InCFamilyFile -from completers.cpp.flags import Flags import vim -import vimsupport import os import re +from ycm import vimsupport +from ycm.completers.threaded_completer import ThreadedCompleter +from ycm.completers.cpp.clang_completer import InCFamilyFile +from ycm.completers.cpp.flags import Flags + USE_WORKING_DIR = vimsupport.GetBoolValue( 'g:ycm_filepath_completion_use_working_dir' ) diff --git a/python/completers/general/general_completer_store.py b/python/ycm/completers/general/general_completer_store.py similarity index 94% rename from python/completers/general/general_completer_store.py rename to python/ycm/completers/general/general_completer_store.py index 746f0b12..943281bd 100644 --- a/python/completers/general/general_completer_store.py +++ b/python/ycm/completers/general/general_completer_store.py @@ -18,12 +18,12 @@ # You should have received a copy of the GNU General Public License # along with YouCompleteMe. If not, see . -from completers.completer import Completer -from completers.all.identifier_completer import IdentifierCompleter -from completers.general.filename_completer import FilenameCompleter +from ycm.completers.completer import Completer +from ycm.completers.all.identifier_completer import IdentifierCompleter +from ycm.completers.general.filename_completer import FilenameCompleter try: - from completers.general.ultisnips_completer import UltiSnipsCompleter + from ycm.completers.general.ultisnips_completer import UltiSnipsCompleter USE_ULTISNIPS_COMPLETER = True except ImportError: USE_ULTISNIPS_COMPLETER = False diff --git a/python/completers/general/ultisnips_completer.py b/python/ycm/completers/general/ultisnips_completer.py similarity index 97% rename from python/completers/general/ultisnips_completer.py rename to python/ycm/completers/general/ultisnips_completer.py index 94afb406..32710a10 100644 --- a/python/completers/general/ultisnips_completer.py +++ b/python/ycm/completers/general/ultisnips_completer.py @@ -18,7 +18,7 @@ # You should have received a copy of the GNU General Public License # along with YouCompleteMe. If not, see . -from completers.general_completer import GeneralCompleter +from ycm.completers.general_completer import GeneralCompleter from UltiSnips import UltiSnips_Manager diff --git a/python/completers/general_completer.py b/python/ycm/completers/general_completer.py similarity index 96% rename from python/completers/general_completer.py rename to python/ycm/completers/general_completer.py index ba8de867..dd59e1b6 100644 --- a/python/completers/general_completer.py +++ b/python/ycm/completers/general_completer.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with YouCompleteMe. If not, see . -from completer import Completer +from ycm.completers.completer import Completer class GeneralCompleter( Completer ): """ diff --git a/python/completers/objc/hook.py b/python/ycm/completers/objc/hook.py similarity index 93% rename from python/completers/objc/hook.py rename to python/ycm/completers/objc/hook.py index a6a4c1a7..737f795c 100644 --- a/python/completers/objc/hook.py +++ b/python/ycm/completers/objc/hook.py @@ -18,7 +18,7 @@ # along with YouCompleteMe. If not, see . import ycm_core -from completers.cpp.clang_completer import ClangCompleter +from ycm.completers.cpp.clang_completer import ClangCompleter def GetCompleter(): if ycm_core.HasClangSupport(): diff --git a/python/completers/objcpp/hook.py b/python/ycm/completers/objcpp/hook.py similarity index 93% rename from python/completers/objcpp/hook.py rename to python/ycm/completers/objcpp/hook.py index c60f3956..a4b02e0b 100644 --- a/python/completers/objcpp/hook.py +++ b/python/ycm/completers/objcpp/hook.py @@ -18,7 +18,7 @@ # along with YouCompleteMe. If not, see . import ycm_core -from completers.cpp.clang_completer import ClangCompleter +from ycm.completers.cpp.clang_completer import ClangCompleter def GetCompleter(): if ycm_core.HasClangSupport(): diff --git a/python/completers/python/__init__.py b/python/ycm/completers/python/__init__.py similarity index 100% rename from python/completers/python/__init__.py rename to python/ycm/completers/python/__init__.py diff --git a/python/completers/python/hook.py b/python/ycm/completers/python/hook.py similarity index 92% rename from python/completers/python/hook.py rename to python/ycm/completers/python/hook.py index fdf611da..db8ac883 100644 --- a/python/completers/python/hook.py +++ b/python/ycm/completers/python/hook.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with YouCompleteMe. If not, see . -from completers.python.jedi_completer import JediCompleter +from ycm.completers.python.jedi_completer import JediCompleter def GetCompleter(): return JediCompleter() diff --git a/python/completers/python/jedi_completer.py b/python/ycm/completers/python/jedi_completer.py similarity index 98% rename from python/completers/python/jedi_completer.py rename to python/ycm/completers/python/jedi_completer.py index 222ad974..1923e2a5 100644 --- a/python/completers/python/jedi_completer.py +++ b/python/ycm/completers/python/jedi_completer.py @@ -20,8 +20,8 @@ # along with YouCompleteMe. If not, see . import vim -from completers.threaded_completer import ThreadedCompleter -import vimsupport +from ycm.completers.threaded_completer import ThreadedCompleter +from ycm import vimsupport import sys from os.path import join, abspath, dirname diff --git a/python/completers/threaded_completer.py b/python/ycm/completers/threaded_completer.py similarity index 98% rename from python/completers/threaded_completer.py rename to python/ycm/completers/threaded_completer.py index 81d39ef7..71641948 100644 --- a/python/completers/threaded_completer.py +++ b/python/ycm/completers/threaded_completer.py @@ -19,7 +19,7 @@ import abc from threading import Thread, Event -from completer import Completer +from ycm.completers.completer import Completer class ThreadedCompleter( Completer ): def __init__( self ): diff --git a/python/extra_conf_store.py b/python/ycm/extra_conf_store.py similarity index 99% rename from python/extra_conf_store.py rename to python/ycm/extra_conf_store.py index 1a2b6694..8dc08eef 100644 --- a/python/extra_conf_store.py +++ b/python/ycm/extra_conf_store.py @@ -24,8 +24,8 @@ import imp import random import string import sys -import vimsupport import vim +from ycm import vimsupport from fnmatch import fnmatch # Constants diff --git a/python/ycm_test_utils.py b/python/ycm/test_utils.py similarity index 100% rename from python/ycm_test_utils.py rename to python/ycm/test_utils.py diff --git a/python/ycm_utils.py b/python/ycm/utils.py similarity index 100% rename from python/ycm_utils.py rename to python/ycm/utils.py diff --git a/python/vimsupport.py b/python/ycm/vimsupport.py similarity index 100% rename from python/vimsupport.py rename to python/ycm/vimsupport.py diff --git a/python/ycm.py b/python/ycm/youcompleteme.py similarity index 97% rename from python/ycm.py rename to python/ycm/youcompleteme.py index b46c1ee7..e95e9b80 100644 --- a/python/ycm.py +++ b/python/ycm/youcompleteme.py @@ -19,9 +19,9 @@ import imp import os -import vimsupport import vim -import ycm_utils as utils +from ycm import vimsupport +from ycm import utils try: import ycm_core @@ -33,8 +33,8 @@ except ImportError as e: os.path.dirname( os.path.abspath( __file__ ) ), str( e ) ) ) -from completers.all.omni_completer import OmniCompleter -from completers.general.general_completer_store import GeneralCompleterStore +from ycm.completers.all.omni_completer import OmniCompleter +from ycm.completers.general.general_completer_store import GeneralCompleterStore FILETYPE_SPECIFIC_COMPLETION_TO_DISABLE = vim.eval( 'g:ycm_filetype_specific_completion_to_disable' )