Update ycmd, and use JoinLinesAsUnicode in GetUnsavedAndCurrentBufferData().

This function is invoked on every kepress.  On a large file (15+k loc),
using this new function takes kepress latency down to <10ms from ~100ms.
This commit is contained in:
Justin Lebar 2016-10-06 18:41:57 -07:00
parent c1cd62dc3c
commit a33f20d690
3 changed files with 4 additions and 4 deletions

View File

@ -1407,7 +1407,7 @@ def GetUnsavedAndCurrentBufferData_EncodedUnicodeCharsInBuffers_test( *args ):
mock_buffer = MagicMock() mock_buffer = MagicMock()
mock_buffer.name = os.path.realpath( 'filename' ) mock_buffer.name = os.path.realpath( 'filename' )
mock_buffer.number = 1 mock_buffer.number = 1
mock_buffer.__iter__.return_value = [ u'abc', ToBytes( u'fДa' ) ] mock_buffer.__iter__.return_value = [ ToBytes ( u'abc' ), ToBytes( u'fДa' ) ]
with patch( 'vim.buffers', [ mock_buffer ] ): with patch( 'vim.buffers', [ mock_buffer ] ):
assert_that( vimsupport.GetUnsavedAndCurrentBufferData(), assert_that( vimsupport.GetUnsavedAndCurrentBufferData(),

View File

@ -30,7 +30,7 @@ import tempfile
import json import json
import re import re
from collections import defaultdict from collections import defaultdict
from ycmd.utils import ToUnicode, ToBytes from ycmd.utils import ToUnicode, ToBytes, JoinLinesAsUnicode
from ycmd import user_options_store from ycmd import user_options_store
BUFFER_COMMAND_MAP = { 'same-buffer' : 'edit', BUFFER_COMMAND_MAP = { 'same-buffer' : 'edit',
@ -125,7 +125,7 @@ def GetUnsavedAndCurrentBufferData():
buffers_data[ GetBufferFilepath( buffer_object ) ] = { buffers_data[ GetBufferFilepath( buffer_object ) ] = {
# Add a newline to match what gets saved to disk. See #1455 for details. # Add a newline to match what gets saved to disk. See #1455 for details.
'contents': '\n'.join( ToUnicode( x ) for x in buffer_object ) + '\n', 'contents': JoinLinesAsUnicode( buffer_object ) + '\n',
'filetypes': FiletypesForBuffer( buffer_object ) 'filetypes': FiletypesForBuffer( buffer_object )
} }

2
third_party/ycmd vendored

@ -1 +1 @@
Subproject commit 363506449fe18337b6aabbf29d8a14720483ccf6 Subproject commit f3232ce5180753822d839c80e9b9ea4e33e89d4c