Skip to content

Commit

Permalink
MESSAGE_POLL_TIMEOUT should be enough for extra conf and StartServer(…
Browse files Browse the repository at this point in the history
…) to complete

This is a UT fixup for a change in _AwaitServerMessages.

Note that #1434 (comment) is not exactly correct together with #1434.
Quote:
> (...) Note that the java completer has a ton of setup to do before it gets to the super().StartServer().

It's true that it has some additional tasks (wiping out workspace) before it calls *super()._StartServerNoLock()*. But
PR 1434 doesn't address it - wiping workspace is called from JavaCompleter.StartServer() at which point _server_started
is already True, so the following part from that PR in _AwaitServerMessages():

-return self._initialize_event.is_set()
+return not self._server_started or self._initialize_event.is_set()

did not make it return True. In other words, #1434 seems to not address the JavaCompleter issue, but only the issue with
potentially long extra conf Settings(). However according to
#1433 (comment) this should rather be solved by increasing
MESSAGE_POLL_TIMEOUT. Anyway, one of the first things we do from OnFileReadyToParse() when server is not healthy is
setting _server_started to True.
  • Loading branch information
analizator1 committed Jan 12, 2025
1 parent 89ed4cf commit 6b6084a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ycmd/tests/language_server/language_server_completer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1482,11 +1482,11 @@ def test_LanguageServerCompleter_Diagnostics_PercentEncodeCannonical(

@IsolatedYcmd()
@patch.object( completer, 'MESSAGE_POLL_TIMEOUT', 0.01 )
def test_LanguageServerCompleter_PollForMessages_ServerNotStarted(
def test_LanguageServerCompleter_PollForMessages_ServerStartTooLong(
self, app ):
server = MockCompleter()
request_data = RequestWrap( BuildRequest() )
assert_that( server.PollForMessages( request_data ), equal_to( True ) )
assert_that( server.PollForMessages( request_data ), equal_to( False ) )


@IsolatedYcmd()
Expand Down

0 comments on commit 6b6084a

Please sign in to comment.