Only importing ycm_core in ycmd
I'm not sure, but it seems that loading both ycm_client_support and ycm_core into the same process is causing random ycmd crashes.
This commit is contained in:
parent
b288dce5ba
commit
f91790e2ee
@ -18,8 +18,13 @@
|
|||||||
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
import ycm_client_support
|
from ycm.utils import ToUtf8IfNeeded, ForceSemanticCompletion, RunningInsideVim
|
||||||
from ycm.utils import ToUtf8IfNeeded, ForceSemanticCompletion
|
|
||||||
|
if RunningInsideVim():
|
||||||
|
from ycm_client_support import FilterAndSortCandidates
|
||||||
|
else:
|
||||||
|
from ycm_core import FilterAndSortCandidates
|
||||||
|
|
||||||
from ycm.completers.completer_utils import TriggersForFiletype
|
from ycm.completers.completer_utils import TriggersForFiletype
|
||||||
|
|
||||||
NO_USER_COMMANDS = 'This completer does not define any commands.'
|
NO_USER_COMMANDS = 'This completer does not define any commands.'
|
||||||
@ -206,10 +211,9 @@ class Completer( object ):
|
|||||||
elif 'insertion_text' in candidates[ 0 ]:
|
elif 'insertion_text' in candidates[ 0 ]:
|
||||||
sort_property = 'insertion_text'
|
sort_property = 'insertion_text'
|
||||||
|
|
||||||
matches = ycm_client_support.FilterAndSortCandidates(
|
matches = FilterAndSortCandidates( candidates,
|
||||||
candidates,
|
sort_property,
|
||||||
sort_property,
|
ToUtf8IfNeeded( query ) )
|
||||||
ToUtf8IfNeeded( query ) )
|
|
||||||
|
|
||||||
return matches
|
return matches
|
||||||
|
|
||||||
|
@ -62,6 +62,14 @@ def MakeFolderAccessibleToAll( path_to_folder ):
|
|||||||
os.chmod( path_to_folder, flags )
|
os.chmod( path_to_folder, flags )
|
||||||
|
|
||||||
|
|
||||||
|
def RunningInsideVim():
|
||||||
|
try:
|
||||||
|
import vim # NOQA
|
||||||
|
return True
|
||||||
|
except ImportError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def GetUnusedLocalhostPort():
|
def GetUnusedLocalhostPort():
|
||||||
sock = socket.socket()
|
sock = socket.socket()
|
||||||
# This tells the OS to give us any free port in the range [1024 - 65535]
|
# This tells the OS to give us any free port in the range [1024 - 65535]
|
||||||
|
Loading…
Reference in New Issue
Block a user