Skip to content

Commit

Permalink
Better name for _RefreshFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
puremourning committed Oct 22, 2017
1 parent 110598c commit 5168175
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions ycmd/completers/language_server/language_server_completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ def ComputeCandidatesInner( self, request_data ):
if not self.ServerIsReady():
return None

self._RefreshFiles( request_data )
self._UpdateServerWithFileContents( request_data )

request_id = self.GetConnection().NextRequestId()
msg = lsp.Completion( request_id, request_data )
Expand Down Expand Up @@ -782,16 +782,16 @@ def OnFileReadyToParse( self, request_data ):
return

# If we haven't finished initializing yet, we need to queue up a call to
# _RefreshFiles. This ensures that the server is up to date as soon as we
# are able to send more messages. This is important because server start up
# can be quite slow and we must not block the user, while we must keep the
# server synchronized.
# _UpdateServerWithFileContents. This ensures that the server is up to date
# as soon as we are able to send more messages. This is important because
# server start up can be quite slow and we must not block the user, while we
# must keep the server synchronized.
if not self._initialise_event.is_set():
self._OnInitialiseComplete( lambda self: self._RefreshFiles(
request_data ) )
self._OnInitialiseComplete(
lambda self: self._UpdateServerWithFileContents( request_data ) )
return

self._RefreshFiles( request_data )
self._UpdateServerWithFileContents( request_data )

# Return the latest diagnostics that we have received.
#
Expand Down Expand Up @@ -930,7 +930,7 @@ def _ConvertNotificationToMessage( self, request_data, notification ):
return None


def _RefreshFiles( self, request_data ):
def _UpdateServerWithFileContents( self, request_data ):
"""Update the server with the current contents of all open buffers, and
close any buffers no longer open.
Expand Down Expand Up @@ -1035,8 +1035,8 @@ def _HandleInitialiseInPollThread( self, response ):
self._initialise_event.set()

# Fire any events that are pending on the completion of the initialize
# exchange. Typically, this will be calls to _RefreshFiles or something that
# occurred while we were waiting.
# exchange. Typically, this will be calls to _UpdateServerWithFileContents
# or something that occurred while we were waiting.
for handler in self._on_initialise_complete_handlers:
handler( self )

Expand All @@ -1059,7 +1059,7 @@ def GetHoverResponse( self, request_data ):
if not self.ServerIsReady():
raise RuntimeError( 'Server is initializing. Please wait.' )

self._RefreshFiles( request_data )
self._UpdateServerWithFileContents( request_data )

request_id = self.GetConnection().NextRequestId()
response = self.GetConnection().GetResponse(
Expand All @@ -1076,7 +1076,7 @@ def GoToDeclaration( self, request_data ):
if not self.ServerIsReady():
raise RuntimeError( 'Server is initializing. Please wait.' )

self._RefreshFiles( request_data )
self._UpdateServerWithFileContents( request_data )

request_id = self.GetConnection().NextRequestId()
response = self.GetConnection().GetResponse(
Expand All @@ -1101,7 +1101,7 @@ def GoToReferences( self, request_data ):
if not self.ServerIsReady():
raise RuntimeError( 'Server is initializing. Please wait.' )

self._RefreshFiles( request_data )
self._UpdateServerWithFileContents( request_data )

request_id = self.GetConnection().NextRequestId()
response = self.GetConnection().GetResponse(
Expand All @@ -1118,7 +1118,7 @@ def GetCodeActions( self, request_data, args ):
if not self.ServerIsReady():
raise RuntimeError( 'Server is initializing. Please wait.' )

self._RefreshFiles( request_data )
self._UpdateServerWithFileContents( request_data )

line_num_ls = request_data[ 'line_num' ] - 1

Expand Down Expand Up @@ -1187,7 +1187,7 @@ def RefactorRename( self, request_data, args ):
'Usage: RefactorRename <new name>' )


self._RefreshFiles( request_data )
self._UpdateServerWithFileContents( request_data )

new_name = args[ 0 ]

Expand Down

0 comments on commit 5168175

Please sign in to comment.