Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[READY] Update jdt.ls to 0.25.0 #1109

Merged
merged 1 commit into from
Sep 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@
)$
"""

JDTLS_MILESTONE = '0.18.0'
JDTLS_BUILD_STAMP = '201805010001'
JDTLS_MILESTONE = '0.25.0'
JDTLS_BUILD_STAMP = '201809172205'
JDTLS_SHA256 = (
'9253d4222519442b65b4a01516c9496354b59813d906357a5f3f265601cc77db'
'7eb952056243f8ac7cd43405d8ed29dc111395866fee9fe895a80efcc2a8140c'
)

BUILD_ERROR_MESSAGE = (
Expand Down
22 changes: 14 additions & 8 deletions ycmd/completers/java/java_completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,22 +542,28 @@ def GetType( self, request_data ):
# throw any other time.

# Strictly we seem to receive:
# - [""]
# - ""
# when there really is no documentation or type info available
# - [{language:java, value:<type info>}]
# - {language:java, value:<type info>}
# when there only the type information is available
# - [{language:java, value:<type info>},
# 'doc line 1',
# 'doc line 2',
# ...]
# when there is type and documentation information available.

try:
get_type_java = hover_response[ 0 ][ 'value' ]
except ( KeyError, TypeError, IndexError ):
if not hover_response:
raise RuntimeError( 'Unknown type' )

if isinstance( hover_response, list ):
hover_response = hover_response[ 0 ]

if ( not isinstance( hover_response, dict ) or
hover_response.get( 'language' ) != 'java' or
'value' not in hover_response ):
raise RuntimeError( 'Unknown type' )

return responses.BuildDisplayMessageResponse( get_type_java )
return responses.BuildDisplayMessageResponse( hover_response[ 'value' ] )


def GetDoc( self, request_data ):
Expand All @@ -577,9 +583,9 @@ def GetDoc( self, request_data ):
# and throw any other time.

# Strictly we seem to receive:
# - [""]
# - ""
# when there really is no documentation or type info available
# - [{language:java, value:<type info>}]
# - {language:java, value:<type info>}
# when there only the type information is available
# - [{language:java, value:<type info>},
# 'doc line 1',
Expand Down
15 changes: 10 additions & 5 deletions ycmd/tests/java/diagnostics_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def ProjectPath( *args ):
*args )


ProjectRoot = PathToTestFile( DEFAULT_PROJECT_DIR )
InternalNonProjectFile = PathToTestFile( DEFAULT_PROJECT_DIR, 'test.java' )
TestFactory = ProjectPath( 'TestFactory.java' )
TestLauncher = ProjectPath( 'TestLauncher.java' )
Expand All @@ -74,6 +75,7 @@ def ProjectPath( *args ):
'Test.java' )

DIAG_MATCHERS_PER_FILE = {
ProjectRoot: [],
InternalNonProjectFile: [],
TestFactory: contains_inanyorder(
has_entries( {
Expand Down Expand Up @@ -391,11 +393,14 @@ def Poll_Diagnostics_ChangeFileContents_test( app ):
messages_for_filepath = []

def PollForMessagesInAnotherThread( filepath, contents ):
for message in PollForMessages( app,
{ 'filepath': filepath,
'contents': contents } ):
if 'filepath' in message and message[ 'filepath' ] == filepath:
messages_for_filepath.append( message )
try:
for message in PollForMessages( app,
{ 'filepath': filepath,
'contents': contents } ):
if 'filepath' in message and message[ 'filepath' ] == filepath:
messages_for_filepath.append( message )
except PollForMessagesTimeoutException:
pass

StartThread( PollForMessagesInAnotherThread, filepath, old_contents )

Expand Down
8 changes: 6 additions & 2 deletions ycmd/tests/java/java_completer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ def JavaCompleter_GetType_test( app ):
assert_that( calling( completer.GetType ).with_args( BuildRequest() ),
raises( RuntimeError, 'Unknown type' ) )

with patch.object( completer, 'GetHoverResponse', return_value = 'value' ):
assert_that( calling( completer.GetType ).with_args( BuildRequest() ),
raises( RuntimeError, 'Unknown type' ) )

with patch.object( completer, 'GetHoverResponse', return_value = [] ):
assert_that( calling( completer.GetType ).with_args( BuildRequest() ),
raises( RuntimeError, 'Unknown type' ) )
Expand All @@ -105,8 +109,8 @@ def JavaCompleter_GetType_test( app ):
with patch.object( completer,
'GetHoverResponse',
return_value = { 'language': 'java', 'value': 'test' } ):
assert_that( calling( completer.GetType ).with_args( BuildRequest() ),
raises( RuntimeError, 'Unknown type' ) )
assert_that( completer.GetType( BuildRequest() ),
has_entries( { 'message': 'test' } ) )

with patch.object(
completer,
Expand Down
17 changes: 11 additions & 6 deletions ycmd/tests/java/subcommands_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
contains_inanyorder,
empty,
has_entries,
instance_of )
instance_of,
matches_regexp )
from nose.tools import eq_
from pprint import pformat
import requests
Expand All @@ -43,6 +44,7 @@
ChunkMatcher,
CombineRequest,
ErrorMatcher,
ExpectedFailure,
LocationMatcher,
WithRetry )
from mock import patch
Expand Down Expand Up @@ -617,6 +619,9 @@ def Subcommands_RefactorRename_Simple_test( app ):
} )


@ExpectedFailure( 'Renaming does not work on overridden methods '
'since jdt.ls 0.21.0',
matches_regexp( 'No item matched:.*TestWidgetImpl.java' ) )
@WithRetry
@SharedYcmd
def Subcommands_RefactorRename_MultipleFiles_test( app ):
Expand Down Expand Up @@ -645,7 +650,7 @@ def Subcommands_RefactorRename_MultipleFiles_test( app ):
'description': 'RefactorRename works across files',
'request': {
'command': 'RefactorRename',
'arguments': [ 'a-quite-long-string' ],
'arguments': [ 'a_quite_long_string' ],
'filepath': TestLauncher,
'line_num': 32,
'column_num': 13,
Expand All @@ -656,19 +661,19 @@ def Subcommands_RefactorRename_MultipleFiles_test( app ):
'fixits': contains( has_entries( {
'chunks': contains(
ChunkMatcher(
'a-quite-long-string',
'a_quite_long_string',
LocationMatcher( AbstractTestWidget, 10, 15 ),
LocationMatcher( AbstractTestWidget, 10, 39 ) ),
ChunkMatcher(
'a-quite-long-string',
'a_quite_long_string',
LocationMatcher( TestFactory, 28, 9 ),
LocationMatcher( TestFactory, 28, 33 ) ),
ChunkMatcher(
'a-quite-long-string',
'a_quite_long_string',
LocationMatcher( TestLauncher, 32, 11 ),
LocationMatcher( TestLauncher, 32, 35 ) ),
ChunkMatcher(
'a-quite-long-string',
'a_quite_long_string',
LocationMatcher( TestWidgetImpl, 20, 15 ),
LocationMatcher( TestWidgetImpl, 20, 39 ) ),
),
Expand Down